diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs index b2bbb78e7b..36012a123b 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs @@ -2,7 +2,6 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Middleware; @@ -27,12 +26,10 @@ public class AbpDynamicClaimsMiddleware : AbpMiddlewareBase, ITransientDependenc var abpClaimsPrincipalFactory = context.RequestServices.GetRequiredService(); var user = await abpClaimsPrincipalFactory.CreateDynamicAsync(context.User); - authenticateResultFeature.AuthenticateResult = AuthenticateResult.Success(new AuthenticationTicket(user, authenticationType)); - var httpAuthenticationFeature = context.Features.Get(); - if (httpAuthenticationFeature != null) - { - httpAuthenticationFeature.User = authenticateResultFeature.AuthenticateResult.Principal; - } + authenticateResultFeature.AuthenticateResult = AuthenticateResult.Success(new AuthenticationTicket( + user, + authenticateResultFeature?.AuthenticateResult?.Properties, + authenticationType)); } if (context.User.Identity?.IsAuthenticated == false)