From da30431ab52eed0229eab032255b848b97c70196 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 17 Nov 2023 20:52:58 +0800 Subject: [PATCH] Move `WebRemoteDynamicClaimsPrincipalContributor` to `AbpAspNetCoreAuthenticationJwtBearerModule`. --- framework/Volo.Abp.sln | 7 ----- ...hentication.JwtBearer.DynamicClaims.csproj | 27 ------------------- ...henticationJwtBearerDynamicClaimsModule.cs | 25 ----------------- ...AspNetCore.Authentication.JwtBearer.csproj | 2 ++ ...AspNetCoreAuthenticationJwtBearerModule.cs | 20 +++++++++++--- ...RemoteDynamicClaimsPrincipalContributor.cs | 0 ...eDynamicClaimsPrincipalContributorCache.cs | 0 ...ynamicClaimsPrincipalContributorOptions.cs | 0 nupkg/common.ps1 | 1 - 9 files changed, 19 insertions(+), 63 deletions(-) delete mode 100644 framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims.csproj delete mode 100644 framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/AbpAspNetCoreAuthenticationJwtBearerDynamicClaimsModule.cs rename framework/src/{Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims => Volo.Abp.AspNetCore.Authentication.JwtBearer}/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributor.cs (100%) rename framework/src/{Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims => Volo.Abp.AspNetCore.Authentication.JwtBearer}/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorCache.cs (100%) rename framework/src/{Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims => Volo.Abp.AspNetCore.Authentication.JwtBearer}/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs (100%) diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index c06ede33c1..42339a60ac 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -463,8 +463,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Imaging.SkiaSharp" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Imaging.SkiaSharp.Tests", "test\Volo.Abp.Imaging.SkiaSharp.Tests\Volo.Abp.Imaging.SkiaSharp.Tests.csproj", "{DFAF8763-D1D6-4EB4-B459-20E31007FE2F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims", "src\Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims\Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims.csproj", "{6F72FFCE-0183-4EF1-80B6-8FC3268E8E99}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1383,10 +1381,6 @@ Global {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Release|Any CPU.ActiveCfg = Release|Any CPU {DFAF8763-D1D6-4EB4-B459-20E31007FE2F}.Release|Any CPU.Build.0 = Release|Any CPU - {6F72FFCE-0183-4EF1-80B6-8FC3268E8E99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F72FFCE-0183-4EF1-80B6-8FC3268E8E99}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F72FFCE-0183-4EF1-80B6-8FC3268E8E99}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F72FFCE-0183-4EF1-80B6-8FC3268E8E99}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1620,7 +1614,6 @@ Global {F19A6E0C-F719-4ED9-A024-14E4B8D40883} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {198683D0-7DC6-40F2-B81B-8E446E70A9DE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {DFAF8763-D1D6-4EB4-B459-20E31007FE2F} = {447C8A77-E5F0-4538-8687-7383196D04EA} - {6F72FFCE-0183-4EF1-80B6-8FC3268E8E99} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims.csproj b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims.csproj deleted file mode 100644 index d02a8df68c..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - net8.0 - enable - Nullable - Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; - false - false - false - - - - - - - - - - - - - diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/AbpAspNetCoreAuthenticationJwtBearerDynamicClaimsModule.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/AbpAspNetCoreAuthenticationJwtBearerDynamicClaimsModule.cs deleted file mode 100644 index a21bf70d6d..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/AbpAspNetCoreAuthenticationJwtBearerDynamicClaimsModule.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Caching; -using Volo.Abp.Modularity; -using Volo.Abp.Security.Claims; - -namespace Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims; - -[DependsOn( - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpCachingModule) -)] -public class AbpAspNetCoreAuthenticationJwtBearerDynamicClaimsModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddHttpClient(); - context.Services.AddHttpContextAccessor(); - var abpClaimsPrincipalFactoryOptions = context.Services.ExecutePreConfiguredActions(); - if (abpClaimsPrincipalFactoryOptions.IsRemoteRefreshEnabled) - { - context.Services.AddTransient(); - context.Services.AddTransient(); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj index a0f4b31158..d43da06dde 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj @@ -18,10 +18,12 @@ + + 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 1fa5077a91..3d6bf5e5be 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 @@ -1,10 +1,24 @@ -using Volo.Abp.Modularity; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims; +using Volo.Abp.Caching; +using Volo.Abp.Modularity; using Volo.Abp.Security; +using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Authentication.JwtBearer; -[DependsOn(typeof(AbpSecurityModule))] +[DependsOn(typeof(AbpSecurityModule), typeof(AbpCachingModule))] public class AbpAspNetCoreAuthenticationJwtBearerModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddHttpClient(); + context.Services.AddHttpContextAccessor(); + var abpClaimsPrincipalFactoryOptions = context.Services.ExecutePreConfiguredActions(); + if (abpClaimsPrincipalFactoryOptions.IsRemoteRefreshEnabled) + { + context.Services.AddTransient(); + context.Services.AddTransient(); + } + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributor.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributor.cs similarity index 100% rename from framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributor.cs rename to framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributor.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorCache.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorCache.cs similarity index 100% rename from framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorCache.cs rename to framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorCache.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs similarity index 100% rename from framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs rename to framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo/Abp/AspNetCore/Authentication/JwtBearer/DynamicClaims/WebRemoteDynamicClaimsPrincipalContributorOptions.cs diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index db18b918b3..78de2aef44 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -95,7 +95,6 @@ $projects = ( # framework "framework/src/Volo.Abp.ApiVersioning.Abstractions", "framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer", - "framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer.DynamicClaims", "framework/src/Volo.Abp.AspNetCore.Authentication.OAuth", "framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect", "framework/src/Volo.Abp.AspNetCore",