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 a502f2f886..b2bbb78e7b 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 @@ -22,11 +22,11 @@ public class AbpDynamicClaimsMiddleware : AbpMiddlewareBase, ITransientDependenc var authenticateResultFeature = context.Features.Get(); var authenticationType = authenticateResultFeature?.AuthenticateResult?.Ticket?.AuthenticationScheme ?? context.User.Identity.AuthenticationType; - var abpClaimsPrincipalFactory = context.RequestServices.GetRequiredService(); - var user = await abpClaimsPrincipalFactory.CreateDynamicAsync(context.User); - if (authenticateResultFeature != null && !authenticationType.IsNullOrWhiteSpace()) { + 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)