Browse Source

Add `IsEnabled ` to `WebRemoteDynamicClaimsPrincipalContributorOptions`.

pull/18197/head
maliming 3 years ago
parent
commit
29eac02f0a
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  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