From c4dde78f89fb131a74e94f07e84d381dd598d9d9 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 3 Apr 2024 13:08:20 +0800 Subject: [PATCH] Make sure the `ImplementationType` is `RemoteAuthenticationService` --- .../WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs index 7c0c79a174..640d42d3ff 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.WebAssembly.Authentication; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Volo.Abp.AspNetCore.Components.Web; @@ -52,7 +53,10 @@ public class AbpAspNetCoreComponentsWebAssemblyModule : AbpModule public override void PostConfigureServices(ServiceConfigurationContext context) { var msAuthenticationStateProvider = context.Services.FirstOrDefault(x => x.ServiceType == typeof(AuthenticationStateProvider)); - if (msAuthenticationStateProvider != null && msAuthenticationStateProvider.ImplementationType != null) + if (msAuthenticationStateProvider != null && + msAuthenticationStateProvider.ImplementationType != null && + msAuthenticationStateProvider.ImplementationType.IsGenericType && + msAuthenticationStateProvider.ImplementationType.GetGenericTypeDefinition() == typeof(RemoteAuthenticationService<,,>)) { var webAssemblyAuthenticationStateProviderType = typeof(WebAssemblyAuthenticationStateProvider<,,>).MakeGenericType( msAuthenticationStateProvider.ImplementationType.GenericTypeArguments[0],