Browse Source

Merge pull request #18197 from abpframework/WebRemoteDynamicClaimsPrincipalContributorOptions

Add `IsEnabled ` to `WebRemoteDynamicClaimsPrincipalContributorOptions`.
pull/18200/head
liangshiwei 2 years ago
committed by GitHub
parent
commit
7eeabc24ae
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/AbpAspNetCoreAuthenticationJwtBearerModule.cs
  2. 3
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs

5
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<AbpClaimsPrincipalFactoryOptions>();
if (abpClaimsPrincipalFactoryOptions.IsRemoteRefreshEnabled)
if (context.Services.ExecutePreConfiguredActions<WebRemoteDynamicClaimsPrincipalContributorOptions>().IsEnabled &&
context.Services.ExecutePreConfiguredActions<AbpClaimsPrincipalFactoryOptions>().IsRemoteRefreshEnabled)
{
context.Services.AddTransient<WebRemoteDynamicClaimsPrincipalContributor>();
context.Services.AddTransient<WebRemoteDynamicClaimsPrincipalContributorCache>();

3
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;
}
}

Loading…
Cancel
Save