From 29eac02f0ac7629dc2cabed875c64e92dd0b43b6 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 20 Nov 2023 11:08:36 +0800 Subject: [PATCH] Add `IsEnabled ` to `WebRemoteDynamicClaimsPrincipalContributorOptions`. --- .../JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs | 5 +++-- .../WebRemoteDynamicClaimsPrincipalContributorOptions.cs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs index 3d6bf5e5be..89d957fe57 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs @@ -14,8 +14,9 @@ public class AbpAspNetCoreAuthenticationJwtBearerModule : AbpModule { context.Services.AddHttpClient(); context.Services.AddHttpContextAccessor(); - var abpClaimsPrincipalFactoryOptions = context.Services.ExecutePreConfiguredActions(); - if (abpClaimsPrincipalFactoryOptions.IsRemoteRefreshEnabled) + + if (context.Services.ExecutePreConfiguredActions().IsEnabled && + context.Services.ExecutePreConfiguredActions().IsRemoteRefreshEnabled) { context.Services.AddTransient(); context.Services.AddTransient(); diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs index 960ebbb38c..1d51a29661 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs @@ -4,10 +4,13 @@ namespace Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims; public class WebRemoteDynamicClaimsPrincipalContributorOptions { + public bool IsEnabled { get; set; } + public string AuthenticationScheme { get; set; } public WebRemoteDynamicClaimsPrincipalContributorOptions() { + IsEnabled = false; AuthenticationScheme = JwtBearerDefaults.AuthenticationScheme; } }