Browse Source

Merge pull request #1600 from colinin/identity-claim-map

feat: Optimize identity token mapping
pull/1626/head
yx lin 2 months ago
committed by GitHub
parent
commit
edd64d7e1f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      Directory.Packages.props
  2. 3
      aspnet-core/LINGYUN.MicroService.All.slnx
  3. 3
      aspnet-core/LINGYUN.MicroService.Aspire.slnx
  4. 4
      aspnet-core/LINGYUN.MicroService.SingleProject.slnx
  5. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/AIServiceModule.cs
  6. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/LINGYUN.Abp.MicroService.AIService.csproj
  7. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/AdminServiceModule.cs
  8. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/LINGYUN.Abp.MicroService.AdminService.csproj
  9. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/LINGYUN.Abp.MicroService.AuthServer.csproj
  10. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/IdentityServiceModule.cs
  11. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/LINGYUN.Abp.MicroService.IdentityService.csproj
  12. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/LINGYUN.Abp.MicroService.LocalizationService.csproj
  13. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/LocalizationServiceModule.cs
  14. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/LINGYUN.Abp.MicroService.MessageService.csproj
  15. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/MessageServiceModule.cs
  16. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/LINGYUN.Abp.MicroService.PlatformService.csproj
  17. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/PlatformServiceModule.cs
  18. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.TaskService/LINGYUN.Abp.MicroService.TaskService.csproj
  19. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.TaskService/TaskServiceModule.cs
  20. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/LINGYUN.Abp.MicroService.WeChatService.csproj
  21. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/WeChatServiceModule.cs
  22. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/LINGYUN.Abp.MicroService.WebhookService.csproj
  23. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/WebhookServiceModule.cs
  24. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj
  25. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs
  26. 0
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/FodyWeavers.xml
  27. 0
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/FodyWeavers.xsd
  28. 15
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN.Abp.AspNetCore.Authentication.csproj
  29. 36
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN/Abp/AspNetCore/Authentication/AbpAspNetCoreAuthenticationModule.cs
  30. 86
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN/Abp/AspNetCore/Authentication/AbpClaimsMapClaimsTransformation.cs
  31. 1
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/Microsoft/IdentityModel/Tokens/TokenWildcardIssuerValidator.cs
  32. 13
      aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN/Abp/Claims/Mapping/AbpClaimsMappingModule.cs
  33. 21
      aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN/Abp/Claims/Mapping/JwtClaimTypesMapping.cs
  34. 18
      aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/README.md
  35. 3
      aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml
  36. 30
      aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xsd
  37. 21
      aspnet-core/framework/security/LINGYUN.Abp.Security/LINGYUN.Abp.Security.csproj
  38. 38
      aspnet-core/framework/security/LINGYUN.Abp.Security/README.EN.md
  39. 38
      aspnet-core/framework/security/LINGYUN.Abp.Security/README.md
  40. 20
      aspnet-core/framework/security/LINGYUN.Abp.Security/Volo/Abp/Security/Claims/JwtClaimTypesMapping.cs
  41. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.AIService/AIServiceModule.cs
  42. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.AIService/LINGYUN.Abp.MicroService.AIService.csproj
  43. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.AdminService/AdminServiceModule.cs
  44. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.AdminService/LINGYUN.Abp.MicroService.AdminService.csproj
  45. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.AuthServer/LINGYUN.Abp.MicroService.AuthServer.csproj
  46. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.IdentityService/IdentityServiceModule.cs
  47. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.IdentityService/LINGYUN.Abp.MicroService.IdentityService.csproj
  48. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.LocalizationService/LINGYUN.Abp.MicroService.LocalizationService.csproj
  49. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.LocalizationService/LocalizationServiceModule.cs
  50. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.MessageService/LINGYUN.Abp.MicroService.MessageService.csproj
  51. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.MessageService/MessageServiceModule.cs
  52. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.PlatformService/LINGYUN.Abp.MicroService.PlatformService.csproj
  53. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.PlatformService/PlatformServiceModule.cs
  54. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.TaskService/LINGYUN.Abp.MicroService.TaskService.csproj
  55. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.TaskService/TaskServiceModule.cs
  56. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.WeChatService/LINGYUN.Abp.MicroService.WeChatService.csproj
  57. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.WeChatService/WeChatServiceModule.cs
  58. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.WebhookService/LINGYUN.Abp.MicroService.WebhookService.csproj
  59. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.WebhookService/WebhookServiceModule.cs
  60. 2
      aspnet-core/services/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj
  61. 4
      aspnet-core/services/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs
  62. 2
      aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs
  63. 2
      aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj
  64. 2
      aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs
  65. 4
      aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs
  66. 2
      aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/LY.MicroService.identityServer.HttpApi.Host.csproj
  67. 2
      aspnet-core/templates/micro/content/Directory.Packages.props
  68. 2
      aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj
  69. 4
      aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs
  70. 131
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/InternalGatewayModule.cs
  71. 2
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/LINGYUN.MicroService.Internal.Gateway.csproj
  72. 4
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/appsettings.Development.json

8
Directory.Packages.props

@ -288,6 +288,7 @@
<PackageVersion Include="OpenTelemetry.Instrumentation.Quartz" Version="1.17.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.17.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.17.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.17.0-beta.1" />
</ItemGroup>
<!-- AI -->
<ItemGroup>
@ -333,6 +334,13 @@
<PackageVersion Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="$(MicrosoftAspNetCorePackageVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.Twitter" Version="$(MicrosoftAspNetCorePackageVersion)" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.19.1" />
<PackageVersion Include="Duende.IdentityModel" Version="7.1.0" />
<PackageVersion Include="Microsoft.IdentityModel.Abstractions" Version="8.19.1" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.19.1" />
<PackageVersion Include="Microsoft.IdentityModel.Logging" Version="8.19.1" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.19.1" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.19.1" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.19.1" />
<PackageVersion Include="aliyun-net-sdk-core" Version="1.6.2" />
<PackageVersion Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
<PackageVersion Include="AlibabaCloud.SDK.Captcha20230305" Version="1.1.4" />

3
aspnet-core/LINGYUN.MicroService.All.slnx

@ -101,6 +101,7 @@
</Folder>
<Folder Name="/framework/" />
<Folder Name="/framework/aspnetcore/">
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN.Abp.AspNetCore.Authentication.csproj" Id="1f287d5d-eaea-4533-9a5d-852365d7c21e" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Mvc.Client/LINGYUN.Abp.AspNetCore.Mvc.Client.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN.Abp.AspNetCore.Session.csproj" />
@ -247,9 +248,7 @@
<Project Path="framework/rules/LINGYUN.Abp.Rules/LINGYUN.Abp.Rules.csproj" />
</Folder>
<Folder Name="/framework/security/">
<Project Path="framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN.Abp.Claims.Mapping.csproj" />
<Project Path="framework/security/LINGYUN.Abp.Encryption.SM4/LINGYUN.Abp.Encryption.SM4.csproj" />
<Project Path="framework/security/LINGYUN.Abp.Security/LINGYUN.Abp.Security.csproj" />
</Folder>
<Folder Name="/framework/settings/">
<Project Path="framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" />

3
aspnet-core/LINGYUN.MicroService.Aspire.slnx

@ -109,6 +109,7 @@
<Project Path="framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN.Abp.Tencent.csproj" />
</Folder>
<Folder Name="/framework/common/">
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Mvc.Client/LINGYUN.Abp.AspNetCore.Mvc.Client.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN.Abp.AspNetCore.Session.csproj" Id="beb0a878-b5bb-4b50-918c-8d4a6527cf74" />
@ -217,9 +218,7 @@
<Project Path="framework/rules/LINGYUN.Abp.Rules/LINGYUN.Abp.Rules.csproj" />
</Folder>
<Folder Name="/framework/security/">
<Project Path="framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN.Abp.Claims.Mapping.csproj" />
<Project Path="framework/security/LINGYUN.Abp.Encryption.SM4/LINGYUN.Abp.Encryption.SM4.csproj" />
<Project Path="framework/security/LINGYUN.Abp.Security/LINGYUN.Abp.Security.csproj" />
</Folder>
<Folder Name="/framework/settings/">
<Project Path="framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" />

4
aspnet-core/LINGYUN.MicroService.SingleProject.slnx

@ -15,6 +15,7 @@
<Project Path="framework/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN.Abp.Sms.Aliyun.csproj" />
</Folder>
<Folder Name="/framework/aspnetcore/">
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN.Abp.AspNetCore.Session.csproj" />
</Folder>
@ -116,9 +117,6 @@
<Project Path="framework/tenants/LINGYUN.Abp.MultiTenancy.Editions/LINGYUN.Abp.MultiTenancy.Editions.csproj" />
<Project Path="modules/saas/LINGYUN.Abp.MultiTenancy.Saas/LINGYUN.Abp.MultiTenancy.Saas.csproj" />
</Folder>
<Folder Name="/framework/security/">
<Project Path="framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN.Abp.Claims.Mapping.csproj" />
</Folder>
<Folder Name="/framework/settings/">
<Project Path="framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" />
<Project Path="framework/settings/LINGYUN.Abp.Settings/LINGYUN.Abp.Settings.csproj" />

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/AIServiceModule.cs

@ -7,7 +7,7 @@ using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -68,7 +68,7 @@ namespace LINGYUN.Abp.MicroService.AIService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/LINGYUN.Abp.MicroService.AIService.csproj

@ -53,7 +53,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/AdminServiceModule.cs

@ -7,7 +7,7 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.BlobManagement.SettingManagement;
using LINGYUN.Abp.CachingManagement;
using LINGYUN.Abp.CachingManagement.StackExchangeRedis;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.DataProtectionManagement;
using LINGYUN.Abp.Dynamic.Definitions;
@ -99,7 +99,7 @@ namespace LINGYUN.Abp.MicroService.AdminService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/LINGYUN.Abp.MicroService.AdminService.csproj

@ -54,7 +54,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\wx-pusher\LINGYUN.Abp.WxPusher.SettingManagement\LINGYUN.Abp.WxPusher.SettingManagement.csproj" />
<ProjectReference Include="..\..\modules\blob-management\LINGYUN.Abp.BlobManagement.SettingManagement\LINGYUN.Abp.BlobManagement.SettingManagement.csproj" />
</ItemGroup>

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/LINGYUN.Abp.MicroService.AuthServer.csproj

@ -54,7 +54,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.AspNetCore.MultiTenancy\LINGYUN.Abp.AspNetCore.MultiTenancy.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.AspNetCore.Mvc.UI.MultiTenancy\LINGYUN.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj" />
<ProjectReference Include="..\..\modules\account\LINGYUN.Abp.Account.Web.AliyunCaptcha\LINGYUN.Abp.Account.Web.AliyunCaptcha.csproj" />

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/IdentityServiceModule.cs

@ -5,7 +5,7 @@ using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EventBus.CAP;
@ -84,7 +84,7 @@ namespace LINGYUN.Abp.MicroService.IdentityService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpExporterMiniSoftwareModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/LINGYUN.Abp.MicroService.IdentityService.csproj

@ -55,7 +55,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/LINGYUN.Abp.MicroService.LocalizationService.csproj

@ -48,7 +48,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/LocalizationServiceModule.cs

@ -3,7 +3,7 @@ using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -59,7 +59,7 @@ namespace LINGYUN.Abp.MicroService.LocalizationService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/LINGYUN.Abp.MicroService.MessageService.csproj

@ -51,7 +51,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.Identity.WeChat.Work\LINGYUN.Abp.Identity.WeChat.Work.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.Identity.WeChat\LINGYUN.Abp.Identity.WeChat.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.WeChat.Official.Handlers\LINGYUN.Abp.WeChat.Official.Handlers.csproj" />

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/MessageServiceModule.cs

@ -5,7 +5,7 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -115,7 +115,7 @@ namespace LINGYUN.Abp.MicroService.MessageService;
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpHttpClientModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/LINGYUN.Abp.MicroService.PlatformService.csproj

@ -56,7 +56,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\modules\blob-management\LINGYUN.Abp.BlobManagement.MimeCheck\LINGYUN.Abp.BlobManagement.MimeCheck.csproj" />
</ItemGroup>

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/PlatformServiceModule.cs

@ -10,7 +10,7 @@ using LINGYUN.Abp.BlobManagement.MimeCheck;
using LINGYUN.Abp.BlobManagement.Minio;
using LINGYUN.Abp.BlobManagement.Tencent;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.EventBus.CAP;
@ -92,7 +92,7 @@ namespace LINGYUN.Abp.MicroService.PlatformService;
typeof(AbpHttpClientModule),
typeof(AbpMailKitModule),
typeof(AbpAliyunSmsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.TaskService/LINGYUN.Abp.MicroService.TaskService.csproj

@ -51,7 +51,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.MultiTenancy.Editions\LINGYUN.Abp.MultiTenancy.Editions.csproj" />

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.TaskService/TaskServiceModule.cs

@ -8,7 +8,7 @@ using LINGYUN.Abp.BackgroundTasks.Jobs;
using LINGYUN.Abp.BackgroundTasks.Notifications;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Elasticsearch.Jobs;
@ -87,7 +87,7 @@ namespace LINGYUN.Abp.MicroService.TaskService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpCAPEventBusModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/LINGYUN.Abp.MicroService.WeChatService.csproj

@ -53,7 +53,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.MultiTenancy.Editions\LINGYUN.Abp.MultiTenancy.Editions.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.Identity.WeChat.Work\LINGYUN.Abp.Identity.WeChat.Work.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.WeChat.MiniProgram\LINGYUN.Abp.WeChat.MiniProgram.csproj" />

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/WeChatServiceModule.cs

@ -3,7 +3,7 @@ using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
@ -77,7 +77,7 @@ namespace LINGYUN.Abp.MicroService.WeChatService;
typeof(AbpSwashbuckleModule),
typeof(AbpHttpClientWrapperModule),
typeof(AbpMailKitModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/LINGYUN.Abp.MicroService.WebhookService.csproj

@ -49,7 +49,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/WebhookServiceModule.cs

@ -5,7 +5,7 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dapr.Client.Wrapper;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -58,7 +58,7 @@ namespace LINGYUN.Abp.MicroService.WebhookService;
typeof(AbpSwashbuckleModule),
typeof(AbpHttpClientWrapperModule),
typeof(AbpDaprClientWrapperModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpAspNetCoreSessionModule),

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj

@ -58,7 +58,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs

@ -6,7 +6,7 @@ using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Elsa;
@ -82,7 +82,7 @@ namespace LINGYUN.Abp.MicroService.WorkflowService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpSmsPlatformModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcNewtonsoftModule),
typeof(AbpAspNetCoreHttpOverridesModule),

0
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/FodyWeavers.xml → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/FodyWeavers.xml

0
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/FodyWeavers.xsd → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/FodyWeavers.xsd

15
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN.Abp.Claims.Mapping.csproj → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN.Abp.AspNetCore.Authentication.csproj

@ -4,9 +4,9 @@
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0;net10.0</TargetFrameworks>
<AssemblyName>LINGYUN.Abp.Claims.Mapping</AssemblyName>
<PackageId>LINGYUN.Abp.Claims.Mapping</PackageId>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>LINGYUN.Abp.AspNetCore.Authentication</AssemblyName>
<PackageId>LINGYUN.Abp.AspNetCore.Authentication</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
@ -14,9 +14,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore" />
<PackageReference Include="Volo.Abp.Security" />
<PackageReference Include="IdentityModel" />
<PackageReference Include="Duende.IdentityModel" />
<!-- 对齐整体Microsoft.IdentityModel.Tokens版本 -->
<PackageReference Include="Microsoft.IdentityModel.Tokens" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
</ItemGroup>
</Project>
</Project>

36
aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN/Abp/AspNetCore/Authentication/AbpAspNetCoreAuthenticationModule.cs

@ -0,0 +1,36 @@
using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using Volo.Abp.AspNetCore;
using Volo.Abp.AspNetCore.Security.Claims;
using Volo.Abp.Modularity;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.AspNetCore.Authentication;
[DependsOn(typeof(AbpAspNetCoreModule))]
public class AbpAspNetCoreAuthenticationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpClaimsMapOptions>(options =>
{
options.Maps[JwtClaimTypes.Subject] = () => AbpClaimTypes.UserId;
options.Maps[JwtClaimTypes.Role] = () => AbpClaimTypes.Role;
options.Maps[JwtClaimTypes.Email] = () => AbpClaimTypes.Email;
options.Maps[JwtClaimTypes.EmailVerified] = () => AbpClaimTypes.EmailVerified;
options.Maps[JwtClaimTypes.PhoneNumber] = () => AbpClaimTypes.PhoneNumber;
options.Maps[JwtClaimTypes.PhoneNumberVerified] = () => AbpClaimTypes.PhoneNumberVerified;
options.Maps[JwtClaimTypes.Name] = () => AbpClaimTypes.Name;
options.Maps[JwtClaimTypes.FamilyName] = () => AbpClaimTypes.SurName;
options.Maps[JwtClaimTypes.GivenName] = () => AbpClaimTypes.Name;
options.Maps[JwtClaimTypes.PreferredUserName] = () => AbpClaimTypes.UserName;
options.Maps["unique_name"] = () => AbpClaimTypes.UserName;
});
context.Services.Replace(
ServiceDescriptor.Transient<IClaimsTransformation, AbpClaimsMapClaimsTransformation>());
}
}

86
aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/LINGYUN/Abp/AspNetCore/Authentication/AbpClaimsMapClaimsTransformation.cs

@ -0,0 +1,86 @@
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Security.Claims;
namespace LINGYUN.Abp.AspNetCore.Authentication;
public class AbpClaimsMapClaimsTransformation : AbpClaimsTransformation
{
public AbpClaimsMapClaimsTransformation(IOptions<AbpClaimsMapOptions> abpClaimsMapOptions)
: base(abpClaimsMapOptions)
{
}
public override Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var maps = AbpClaimsMapOptions.Value.Maps;
if (maps.Count == 0)
{
return Task.FromResult(principal);
}
var mappedClaims = new List<Claim>();
foreach (var claim in principal.Claims)
{
if (!maps.TryGetValue(claim.Type, out var mapClaimType))
{
continue;
}
var mappedClaimType = mapClaimType();
if (string.IsNullOrWhiteSpace(mappedClaimType))
{
continue;
}
if (string.Equals(mappedClaimType, claim.Type, StringComparison.Ordinal))
{
continue;
}
if (principal.HasClaim(mappedClaimType, claim.Value))
{
continue;
}
mappedClaims.Add(new Claim(
mappedClaimType,
claim.Value,
claim.ValueType,
claim.Issuer,
claim.OriginalIssuer));
}
if (mappedClaims.Count == 0)
{
return Task.FromResult(principal);
}
var identity = principal.Identities.FirstOrDefault(x => x.IsAuthenticated) ?? principal.Identities.FirstOrDefault();
if (identity is ClaimsIdentity claimsIdentity)
{
try
{
foreach (var mappedClaim in mappedClaims)
{
claimsIdentity.AddClaim(mappedClaim);
}
return Task.FromResult(principal);
}
catch (InvalidOperationException)
{
// ignore
}
}
principal.AddIdentity(new ClaimsIdentity(mappedClaims));
return Task.FromResult(principal);
}
}

1
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/Microsoft/IdentityModel/Tokens/TokenWildcardIssuerValidator.cs → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Authentication/Microsoft/IdentityModel/Tokens/TokenWildcardIssuerValidator.cs

@ -128,4 +128,3 @@ public static class TokenWildcardIssuerValidator
return first ? Utility.Empty : sb.ToString();
}
}

13
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN/Abp/Claims/Mapping/AbpClaimsMappingModule.cs

@ -1,13 +0,0 @@
using Volo.Abp.Modularity;
using Volo.Abp.Security;
namespace LINGYUN.Abp.Claims.Mapping;
[DependsOn(typeof(AbpSecurityModule))]
public class AbpClaimsMappingModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
JwtClaimTypesMapping.MapAbpClaimTypes();
}
}

21
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/LINGYUN/Abp/Claims/Mapping/JwtClaimTypesMapping.cs

@ -1,21 +0,0 @@
using IdentityModel;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.Claims.Mapping;
public static class JwtClaimTypesMapping
{
public static void MapAbpClaimTypes()
{
AbpClaimTypes.UserId = JwtClaimTypes.Subject;
AbpClaimTypes.Role = JwtClaimTypes.Role;
AbpClaimTypes.UserName = JwtClaimTypes.PreferredUserName;
AbpClaimTypes.Name = JwtClaimTypes.GivenName;
AbpClaimTypes.SurName = JwtClaimTypes.FamilyName;
AbpClaimTypes.PhoneNumber = JwtClaimTypes.PhoneNumber;
AbpClaimTypes.PhoneNumberVerified = JwtClaimTypes.PhoneNumberVerified;
AbpClaimTypes.Email = JwtClaimTypes.Email;
AbpClaimTypes.EmailVerified = JwtClaimTypes.EmailVerified;
AbpClaimTypes.ClientId = JwtClaimTypes.ClientId;
}
}

18
aspnet-core/framework/security/LINGYUN.Abp.Claims.Mapping/README.md

@ -1,18 +0,0 @@
# LINGYUN.Abp.Claims.Mapping
引入此模块解决*IdentityServer*身份令牌映射,需要配合 *MapInboundClaims* 使用
## 注意
身份认证服务器使用 *OpenIddict* 时无需处理
## 配置使用
```csharp
[DependsOn(typeof(AbpClaimsMappingModule))]
public class YouProjectModule : AbpModule
{
// other
}
```

3
aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xml

@ -1,3 +0,0 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>

30
aspnet-core/framework/security/LINGYUN.Abp.Security/FodyWeavers.xsd

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

21
aspnet-core/framework/security/LINGYUN.Abp.Security/LINGYUN.Abp.Security.csproj

@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0;net10.0</TargetFrameworks>
<AssemblyName>LINGYUN.Abp.Security</AssemblyName>
<PackageId>LINGYUN.Abp.Security</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Security" />
<PackageReference Include="IdentityModel" />
</ItemGroup>
</Project>

38
aspnet-core/framework/security/LINGYUN.Abp.Security/README.EN.md

@ -1,38 +0,0 @@
# LINGYUN.Abp.Security
## Module Description
Extends the Abp Security module, providing additional security features.
### Base Modules
* Volo.Abp.Security
### Features
* Provides JWT Claims type mapping functionality
* Extends standard JWT Claims type definitions
### Configuration
No special configuration items
### How to Use
1. Add `AbpSecurityModule` dependency
```csharp
[DependsOn(typeof(AbpSecurityModule))]
public class YouProjectModule : AbpModule
{
}
```
2. Use JWT Claims mapping
```csharp
// JWT Claims type mapping is done automatically, no manual configuration needed
// If you need custom mapping, you can configure it in the module's ConfigureServices method
```
[Back to TOC](../../../README.md)

38
aspnet-core/framework/security/LINGYUN.Abp.Security/README.md

@ -1,38 +0,0 @@
# LINGYUN.Abp.Security
## 模块说明
扩展 Abp Security 模块,提供额外的安全功能。
### 基础模块
* Volo.Abp.Security
### 功能定义
* 提供 JWT Claims 类型映射功能
* 扩展了标准的 JWT Claims 类型定义
### 配置定义
无特殊配置项
### 如何使用
1. 添加 `AbpSecurityModule` 依赖
```csharp
[DependsOn(typeof(AbpSecurityModule))]
public class YouProjectModule : AbpModule
{
}
```
2. 使用 JWT Claims 映射
```csharp
// JWT Claims 类型映射会自动完成,无需手动配置
// 如果需要自定义映射,可以在模块的 ConfigureServices 方法中进行配置
```
[返回目录](../../../README.md)

20
aspnet-core/framework/security/LINGYUN.Abp.Security/Volo/Abp/Security/Claims/JwtClaimTypesMapping.cs

@ -1,20 +0,0 @@
using IdentityModel;
namespace Volo.Abp.Security.Claims;
public static class JwtClaimTypesMapping
{
public static void MapAbpClaimTypes()
{
AbpClaimTypes.UserId = JwtClaimTypes.Subject;
AbpClaimTypes.Role = JwtClaimTypes.Role;
AbpClaimTypes.UserName = JwtClaimTypes.PreferredUserName;
AbpClaimTypes.Name = JwtClaimTypes.GivenName;
AbpClaimTypes.SurName = JwtClaimTypes.FamilyName;
AbpClaimTypes.PhoneNumber = JwtClaimTypes.PhoneNumber;
AbpClaimTypes.PhoneNumberVerified = JwtClaimTypes.PhoneNumberVerified;
AbpClaimTypes.Email = JwtClaimTypes.Email;
AbpClaimTypes.EmailVerified = JwtClaimTypes.EmailVerified;
AbpClaimTypes.ClientId = JwtClaimTypes.ClientId;
}
}

4
aspnet-core/services/LINGYUN.Abp.MicroService.AIService/AIServiceModule.cs

@ -7,7 +7,7 @@ using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -64,7 +64,7 @@ namespace LINGYUN.Abp.MicroService.AIService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/services/LINGYUN.Abp.MicroService.AIService/LINGYUN.Abp.MicroService.AIService.csproj

@ -55,7 +55,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>

4
aspnet-core/services/LINGYUN.Abp.MicroService.AdminService/AdminServiceModule.cs

@ -7,7 +7,7 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.BlobManagement.SettingManagement;
using LINGYUN.Abp.CachingManagement;
using LINGYUN.Abp.CachingManagement.StackExchangeRedis;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.DataProtectionManagement;
using LINGYUN.Abp.Dynamic.Definitions;
@ -124,7 +124,7 @@ namespace LINGYUN.Abp.MicroService.AdminService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/services/LINGYUN.Abp.MicroService.AdminService/LINGYUN.Abp.MicroService.AdminService.csproj

@ -64,7 +64,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\wx-pusher\LINGYUN.Abp.WxPusher.SettingManagement\LINGYUN.Abp.WxPusher.SettingManagement.csproj" />

2
aspnet-core/services/LINGYUN.Abp.MicroService.AuthServer/LINGYUN.Abp.MicroService.AuthServer.csproj

@ -57,7 +57,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.AspNetCore.MultiTenancy\LINGYUN.Abp.AspNetCore.MultiTenancy.csproj" />

4
aspnet-core/services/LINGYUN.Abp.MicroService.IdentityService/IdentityServiceModule.cs

@ -5,7 +5,7 @@ using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EntityFrameworkCore.MySQL;
@ -87,7 +87,7 @@ namespace LINGYUN.Abp.MicroService.IdentityService;
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpExporterMiniSoftwareModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/services/LINGYUN.Abp.MicroService.IdentityService/LINGYUN.Abp.MicroService.IdentityService.csproj

@ -59,7 +59,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

2
aspnet-core/services/LINGYUN.Abp.MicroService.LocalizationService/LINGYUN.Abp.MicroService.LocalizationService.csproj

@ -52,7 +52,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

4
aspnet-core/services/LINGYUN.Abp.MicroService.LocalizationService/LocalizationServiceModule.cs

@ -3,7 +3,7 @@ using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -67,7 +67,7 @@ namespace LINGYUN.Abp.MicroService.LocalizationService;
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/services/LINGYUN.Abp.MicroService.MessageService/LINGYUN.Abp.MicroService.MessageService.csproj

@ -59,7 +59,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.Identity.WeChat.Work\LINGYUN.Abp.Identity.WeChat.Work.csproj" />

4
aspnet-core/services/LINGYUN.Abp.MicroService.MessageService/MessageServiceModule.cs

@ -5,7 +5,7 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -120,7 +120,7 @@ namespace LINGYUN.Abp.MicroService.MessageService;
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpHttpClientModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpAspNetCoreSessionModule),

2
aspnet-core/services/LINGYUN.Abp.MicroService.PlatformService/LINGYUN.Abp.MicroService.PlatformService.csproj

@ -60,7 +60,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

4
aspnet-core/services/LINGYUN.Abp.MicroService.PlatformService/PlatformServiceModule.cs

@ -11,7 +11,7 @@ using LINGYUN.Abp.BlobManagement.Minio;
using LINGYUN.Abp.BlobManagement.SettingManagement;
using LINGYUN.Abp.BlobManagement.Tencent;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.EventBus.CAP;
@ -109,7 +109,7 @@ namespace LINGYUN.Abp.MicroService.PlatformService;
typeof(AbpAliyunSmsModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpSwashbuckleModule),

2
aspnet-core/services/LINGYUN.Abp.MicroService.TaskService/LINGYUN.Abp.MicroService.TaskService.csproj

@ -60,7 +60,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.MultiTenancy.Editions\LINGYUN.Abp.MultiTenancy.Editions.csproj" />

4
aspnet-core/services/LINGYUN.Abp.MicroService.TaskService/TaskServiceModule.cs

@ -8,7 +8,7 @@ using LINGYUN.Abp.BackgroundTasks.Jobs;
using LINGYUN.Abp.BackgroundTasks.Notifications;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Elasticsearch.Jobs;
@ -94,7 +94,7 @@ namespace LINGYUN.Abp.MicroService.TaskService;
typeof(AbpDynamicDefinitionsModule),
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpCAPEventBusModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/services/LINGYUN.Abp.MicroService.WeChatService/LINGYUN.Abp.MicroService.WeChatService.csproj

@ -55,7 +55,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.MultiTenancy.Editions\LINGYUN.Abp.MultiTenancy.Editions.csproj" />

4
aspnet-core/services/LINGYUN.Abp.MicroService.WeChatService/WeChatServiceModule.cs

@ -3,7 +3,7 @@ using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.EntityFrameworkCore.MySQL;
using LINGYUN.Abp.EventBus.CAP;
@ -79,7 +79,7 @@ namespace LINGYUN.Abp.MicroService.WeChatService;
typeof(AbpSwashbuckleModule),
typeof(AbpHttpClientWrapperModule),
typeof(AbpMailKitModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpAspNetCoreSessionModule),

2
aspnet-core/services/LINGYUN.Abp.MicroService.WebhookService/LINGYUN.Abp.MicroService.WebhookService.csproj

@ -54,7 +54,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

4
aspnet-core/services/LINGYUN.Abp.MicroService.WebhookService/WebhookServiceModule.cs

@ -5,7 +5,7 @@ using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dapr.Client.Wrapper;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
@ -79,7 +79,7 @@ namespace LINGYUN.Abp.MicroService.WebhookService;
typeof(AbpSwashbuckleModule),
typeof(AbpHttpClientWrapperModule),
typeof(AbpDaprClientWrapperModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpTelemetryOpenTelemetryModule),

2
aspnet-core/services/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj

@ -62,7 +62,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

4
aspnet-core/services/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs

@ -6,7 +6,7 @@ using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
using LINGYUN.Abp.BackgroundTasks.Quartz;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Elsa;
@ -83,7 +83,7 @@ namespace LINGYUN.Abp.MicroService.WorkflowService;
typeof(AbpHttpClientWrapperModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpMailKitModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpAspNetCoreSessionModule),

2
aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs

@ -41,7 +41,7 @@ global using LINGYUN.Abp.BlobManagement.Tencent;
global using LINGYUN.Abp.BlobStoring.BlobManagement;
global using LINGYUN.Abp.CachingManagement;
global using LINGYUN.Abp.CachingManagement.StackExchangeRedis;
global using LINGYUN.Abp.Claims.Mapping;
global using LINGYUN.Abp.AspNetCore.Authentication;
global using LINGYUN.Abp.Dapr.Client;
global using LINGYUN.Abp.Data.DbMigrator;
global using LINGYUN.Abp.DataProtectionManagement;

2
aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj

@ -107,7 +107,7 @@
<ProjectReference Include="..\..\framework\navigation\LINGYUN.Abp.UI.Navigation\LINGYUN.Abp.UI.Navigation.csproj" />
<ProjectReference Include="..\..\framework\open-api\LINGYUN.Abp.OpenApi.Authorization\LINGYUN.Abp.OpenApi.Authorization.csproj" />
<ProjectReference Include="..\..\framework\open-api\LINGYUN.Abp.OpenApi\LINGYUN.Abp.OpenApi.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\settings\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.MultiTenancy.Editions\LINGYUN.Abp.MultiTenancy.Editions.csproj" />
<ProjectReference Include="..\..\framework\tenants\LINGYUN.Abp.AspNetCore.MultiTenancy\LINGYUN.Abp.AspNetCore.MultiTenancy.csproj" />

2
aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs

@ -403,7 +403,7 @@ namespace LY.MicroService.Applications.Single;
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpMailKitModule),
typeof(AbpAutofacModule),

4
aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs

@ -3,7 +3,7 @@ using LINGYUN.Abp.AspNetCore.Mvc.Localization;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EntityFrameworkCore.MySQL;
using LINGYUN.Abp.EventBus.CAP;
@ -80,7 +80,7 @@ namespace LY.MicroService.IdentityServer;
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpExporterMiniSoftwareModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAutofacModule)
)]

2
aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/LY.MicroService.identityServer.HttpApi.Host.csproj

@ -62,7 +62,7 @@
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.OpenTelemetry\LINGYUN.Abp.Telemetry.OpenTelemetry.csproj" />
<ProjectReference Include="..\..\framework\telemetry\LINGYUN.Abp.Telemetry.SkyWalking\LINGYUN.Abp.Telemetry.SkyWalking.csproj" />
</ItemGroup>

2
aspnet-core/templates/micro/content/Directory.Packages.props

@ -12,7 +12,7 @@
<!-- LINGYUN Abp Framework -->
<ItemGroup>
<PackageVersion Include="LINGYUN.Abp.Claims.Mapping" Version="$(LINGYUNAbpPackageVersion)" />
<PackageVersion Include="LINGYUN.Abp.AspNetCore.Authentication" Version="$(LINGYUNAbpPackageVersion)" />
<PackageVersion Include="LINGYUN.Abp.AspNetCore.HttpOverrides" Version="$(LINGYUNAbpPackageVersion)" />
<PackageVersion Include="LINGYUN.Abp.AspNetCore.Mvc.Localization" Version="$(LINGYUNAbpPackageVersion)" />
<PackageVersion Include="LINGYUN.Abp.AspNetCore.Mvc.Wrapper" Version="$(LINGYUNAbpPackageVersion)" />

2
aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj

@ -15,7 +15,7 @@
<PackageReference Include="DotNetCore.CAP.PostgreSql" Condition="'$(PostgreSql)'=='true'" />
<PackageReference Include="DotNetCore.CAP.Sqlite" Condition="'$(Sqlite)'=='true'" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" />
<PackageReference Include="LINGYUN.Abp.Claims.Mapping" />
<PackageReference Include="LINGYUN.Abp.AspNetCore.Authentication" />
<PackageReference Include="LINGYUN.Abp.AspNetCore.HttpOverrides" />
<PackageReference Include="LINGYUN.Abp.AspNetCore.Mvc.Wrapper" />
<PackageReference Include="LINGYUN.Abp.AspNetCore.Session" />

4
aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs

@ -3,7 +3,7 @@ using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EventBus.CAP;
@ -75,7 +75,7 @@ namespace PackageName.CompanyName.ProjectName;
typeof(AbpTelemetrySkyWalkingModule),
typeof(AbpTelemetryOpenTelemetryModule),
typeof(AbpExporterMiniSoftwareModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpSwashbuckleModule),

131
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/InternalGatewayModule.cs

@ -1,6 +1,6 @@
using Autofac.Core;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.Claims.Mapping;
using LINGYUN.Abp.AspNetCore.Authentication;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@ -12,6 +12,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi;
using StackExchange.Redis;
@ -34,7 +35,7 @@ namespace LINGYUN.MicroService.Internal.Gateway;
[DependsOn(
typeof(AbpSerilogEnrichersApplicationModule),
typeof(AbpSerilogEnrichersUniqueIdModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreAuthenticationModule),
typeof(AbpAutofacModule),
typeof(AbpDataModule),
typeof(AbpSwashbuckleModule),
@ -46,6 +47,7 @@ public class InternalGatewayModule : AbpModule
public static string ApplicationName { get; set; } = "InternalApiGateway";
public override void PreConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
AbpSerilogEnrichersConsts.ApplicationName = ApplicationName;
PreConfigure<AbpSerilogEnrichersUniqueIdOptions>(options =>
@ -55,6 +57,12 @@ public class InternalGatewayModule : AbpModule
options.SnowflakeIdOptions.WorkerIdBits = 5;
options.SnowflakeIdOptions.DatacenterId = 1;
});
if (configuration.GetValue<bool>("App:ShowPii"))
{
IdentityModelEventSource.ShowPII = true;
IdentityModelEventSource.LogCompleteSecurityArtifact = true;
}
}
public override void ConfigureServices(ServiceConfigurationContext context)
@ -70,25 +78,29 @@ public class InternalGatewayModule : AbpModule
options.ControllersToRemove.Add(typeof(AbpApplicationConfigurationScriptController));
});
context.Services.AddAbpSwaggerGenWithOAuth(
authority: configuration["AuthServer:Authority"],
scopes: new Dictionary<string, string>
{
{"identity-service", "Identity Service API"},
{"admin-service", "Admin Service API"},
{"localization-service", "Localization Service API"},
{"platform-service", "Platform Service API"},
{"message-service", "Message Service API"},
{"task-service", "Task Service API"},
{"webhook-service", "Webhook Service API"},
{"wechat-service", "WeChat Service API"},
},
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "ApiGateway", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
if (hostingEnvironment.IsDevelopment())
{
context.Services.AddAbpSwaggerGenWithOAuth(
authority: configuration["AuthServer:Authority"],
scopes: new Dictionary<string, string>
{
{"identity-service", "Identity Service API"},
{"admin-service", "Admin Service API"},
{"localization-service", "Localization Service API"},
{"platform-service", "Platform Service API"},
{"message-service", "Message Service API"},
{"task-service", "Task Service API"},
{"webhook-service", "Webhook Service API"},
{"wechat-service", "WeChat Service API"},
},
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "ApiGateway", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
}
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
@ -175,49 +187,52 @@ public class InternalGatewayModule : AbpModule
// 授权
app.UseAuthorization();
app.UseSwagger();
app.UseSwaggerUI(options =>
if (env.IsDevelopment())
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Open API Document");
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>();
var logger = context.ServiceProvider.GetRequiredService<ILogger<ApplicationInitializationContext>>();
var proxyConfigProvider = context.ServiceProvider.GetRequiredService<IProxyConfigProvider>();
var yarpConfig = proxyConfigProvider.GetConfig();
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Open API Document");
var routedClusters = yarpConfig.Clusters
.SelectMany(t => t.Destinations,
(clusterId, destination) => new { clusterId.ClusterId, destination.Value });
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>();
var logger = context.ServiceProvider.GetRequiredService<ILogger<ApplicationInitializationContext>>();
var proxyConfigProvider = context.ServiceProvider.GetRequiredService<IProxyConfigProvider>();
var yarpConfig = proxyConfigProvider.GetConfig();
var groupedClusters = routedClusters
.GroupBy(q => q.Value.Address)
.Select(t => t.First())
.Distinct()
.ToList();
var routedClusters = yarpConfig.Clusters
.SelectMany(t => t.Destinations,
(clusterId, destination) => new { clusterId.ClusterId, destination.Value });
foreach (var clusterGroup in groupedClusters)
{
var routeConfig = yarpConfig.Routes.FirstOrDefault(q =>
q.ClusterId == clusterGroup.ClusterId);
if (routeConfig == null)
{
logger.LogWarning($"Swagger UI: Couldn't find route configuration for {clusterGroup.ClusterId}...");
continue;
}
var groupedClusters = routedClusters
.GroupBy(q => q.Value.Address)
.Select(t => t.First())
.Distinct()
.ToList();
var swaggerEndpoint = clusterGroup.Value.Address;
if (clusterGroup.Value.Metadata != null &&
clusterGroup.Value.Metadata.TryGetValue("SwaggerEndpoint", out var address) &&
!address.IsNullOrWhiteSpace())
foreach (var clusterGroup in groupedClusters)
{
swaggerEndpoint = address;
var routeConfig = yarpConfig.Routes.FirstOrDefault(q =>
q.ClusterId == clusterGroup.ClusterId);
if (routeConfig == null)
{
logger.LogWarning($"Swagger UI: Couldn't find route configuration for {clusterGroup.ClusterId}...");
continue;
}
var swaggerEndpoint = clusterGroup.Value.Address;
if (clusterGroup.Value.Metadata != null &&
clusterGroup.Value.Metadata.TryGetValue("SwaggerEndpoint", out var address) &&
!address.IsNullOrWhiteSpace())
{
swaggerEndpoint = address;
}
options.SwaggerEndpoint($"{swaggerEndpoint}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API");
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
}
options.SwaggerEndpoint($"{swaggerEndpoint}/swagger/v1/swagger.json", $"{routeConfig.RouteId} API");
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
}
});
});
}
// app.UseRewriter(new RewriteOptions().AddRedirect("^(|\\|\\s+)$", "/swagger"));
@ -225,10 +240,10 @@ public class InternalGatewayModule : AbpModule
app.UseAuditing();
app.UseWebSockets();
app.UseWebSocketsTelemetry();
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapReverseProxy();
});
app.UseAbpSerilogEnrichers();
}
}

2
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/LINGYUN.MicroService.Internal.Gateway.csproj

@ -37,7 +37,7 @@
<ProjectReference Include="..\..\..\..\..\aspnet-core\framework\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\aspnet-core\framework\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" />
<ProjectReference Include="..\..\..\..\..\aspnet-core\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\..\..\..\aspnet-core\framework\security\LINGYUN.Abp.Claims.Mapping\LINGYUN.Abp.Claims.Mapping.csproj" />
<ProjectReference Include="..\..\..\..\..\aspnet-core\framework\common\LINGYUN.Abp.AspNetCore.Authentication\LINGYUN.Abp.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>

4
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.Gateway/appsettings.Development.json

@ -17,8 +17,8 @@
},
"AuthServer": {
"Authority": "http://localhost:44385/",
"Audience": "lingyun-abp-application",
"ValidAudiences": [ "api-gateway" ],
"Audience": "api-gateway",
"ValidAudiences": [ "lingyun-abp-application" ],
"MapInboundClaims": false,
"RequireHttpsMetadata": false
},

Loading…
Cancel
Save