diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs index 8df1824e81..74cbd37e29 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Security/AbpComponentsClaimsCache.cs @@ -1,9 +1,9 @@ using System.Security.Claims; using System.Threading.Tasks; +using JetBrains.Annotations; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; -using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Components.Web.Security; @@ -12,18 +12,16 @@ public class AbpComponentsClaimsCache : IScopedDependency public ClaimsPrincipal Principal { get; private set; } = default!; private readonly AuthenticationStateProvider? _authenticationStateProvider; - private readonly IAbpClaimsPrincipalFactory _abpClaimsPrincipalFactory; public AbpComponentsClaimsCache( IClientScopeServiceProviderAccessor serviceProviderAccessor) { _authenticationStateProvider = serviceProviderAccessor.ServiceProvider.GetService(); - _abpClaimsPrincipalFactory = serviceProviderAccessor.ServiceProvider.GetRequiredService(); if (_authenticationStateProvider != null) { _authenticationStateProvider.AuthenticationStateChanged += async (task) => { - Principal = await _abpClaimsPrincipalFactory.CreateDynamicAsync((await task).User); + Principal = (await task).User; }; } } @@ -34,7 +32,6 @@ public class AbpComponentsClaimsCache : IScopedDependency { var authenticationState = await _authenticationStateProvider.GetAuthenticationStateAsync(); Principal = authenticationState.User; - await _abpClaimsPrincipalFactory.CreateDynamicAsync(Principal); } } }