dotnet / dotnet/aspnetcore

IClaimsTransformation do not automagically compose

Open
#46,120 19 comments 25 reactions 0 assignees View on GitHub
area-auth enhancement help wanted Pillar: Dev Experience untriaged
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] 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 TransformAsync(ClaimsPrincipal principal)
{
foreach (var transformation in _transformations)
{
principal = await transformation.TransformAsync(principal);
}

return principal;
}
}
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.