dotnet/aspnetcore

IClaimsTransformation do not automagically compose

开放

#46,120 创建于 2023年1月16日

 (19 条评论) (25 个反应) (0 位负责人)C# (10,653 个派生)batch import
Pillar: Dev Experiencearea-authenhancementhelp wanteduntriaged

仓库指标

星标
 (37,933 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Multiple registrations on IClaimsTransformation should compose. For pete's sake, the signature for IClaimsTransformation is literally an async reduce function.

Describe the solution you'd like

A ReducerClaimsTransformer should be injected into AuthenticationService.Transform

public class ReducerClaimsTransformation : IClaimsTransformation
{
    public async Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
    {
        foreach (var transformation in _transformations)
        {
            principal = await transformation.TransformAsync(principal);
        }

        return principal;
    }
}

Additional context

No response

贡献者指南