abpframework / abp

Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.42k stars 3.34k forks source link

Use `IClaimsTransformation` to map claims. #19752

Closed maliming closed 1 month ago

maliming commented 1 month ago

Resolve #19728

The AbpClaimsMapMiddleware can map the ClaimsPrincipal in the HTTP request pipeline, but it can't work if we call IAuthenticationService.AuthenticateAsync("scheme") elsewhere to get ClaimsPrincipal.

The IClaimsTransformation is used by the IAuthenticationService for claims transformation.

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/claims?view=aspnetcore-8.0#extend-or-add-custom-claims-using-iclaimstransformation