Browse Source

Merge pull request #1582 from colinin/refactor-identity-session

feat: Refactor the session module
pull/1586/head
yx lin 2 months ago
committed by GitHub
parent
commit
7bb4acbaf5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 18
      aspnet-core/LINGYUN.MicroService.All.slnx
  2. 5
      aspnet-core/LINGYUN.MicroService.Aspire.slnx
  3. 12
      aspnet-core/LINGYUN.MicroService.SingleProject.slnx
  4. 3
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/AIServiceModule.Configure.cs
  5. 5
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/AIServiceModule.cs
  6. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/LINGYUN.Abp.MicroService.AIService.csproj
  7. 5
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/Program.cs
  8. 5
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/AdminServiceModule.cs
  9. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/LINGYUN.Abp.MicroService.AdminService.csproj
  10. 3
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/Program.cs
  11. 17
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs
  12. 9
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.cs
  13. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/LINGYUN.Abp.MicroService.AuthServer.csproj
  14. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/Program.cs
  15. 3
      aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.Development.json
  16. 6
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Handlers/IdentitySessionAccessEventHandler.cs
  17. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/IdentityServiceModule.cs
  18. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/LINGYUN.Abp.MicroService.IdentityService.csproj
  19. 5
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Program.cs
  20. 6
      aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/appsettings.Development.json
  21. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/LINGYUN.Abp.MicroService.LocalizationService.csproj
  22. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/LocalizationServiceModule.cs
  23. 5
      aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/Program.cs
  24. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/LINGYUN.Abp.MicroService.MessageService.csproj
  25. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/MessageServiceModule.cs
  26. 5
      aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/Program.cs
  27. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/LINGYUN.Abp.MicroService.PlatformService.csproj
  28. 6
      aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/PlatformServiceModule.cs
  29. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/Program.cs
  30. 1
      aspnet-core/aspire/LINGYUN.Abp.MicroService.TaskService/LINGYUN.Abp.MicroService.TaskService.csproj
  31. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.TaskService/TaskServiceModule.cs
  32. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/LINGYUN.Abp.MicroService.WeChatService.csproj
  33. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/Program.cs
  34. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WeChatService/WeChatServiceModule.cs
  35. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/LINGYUN.Abp.MicroService.WebhookService.csproj
  36. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/Program.cs
  37. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WebhookService/WebhookServiceModule.cs
  38. 2
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj
  39. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/Program.cs
  40. 4
      aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs
  41. 11
      aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging/LINGYUN/Abp/AuditLogging/AbpAuditLoggingModule.cs
  42. 0
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/FodyWeavers.xml
  43. 0
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/FodyWeavers.xsd
  44. 8
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN.Abp.AspNetCore.Session.csproj
  45. 15
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/AbpAspNetCoreSessionModule.cs
  46. 7
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/AbpAspNetCoreSessionOptions.cs
  47. 6
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/AbpIdentitySessionDynamicClaimsPrincipalContributor.cs
  48. 12
      aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/HttpContextDeviceInfoProvider.cs
  49. 24
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs
  50. 102
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Handlers/AbpIdentitySessionEventServiceHandler.cs
  51. 8
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Handlers/AbpIdentitySessionUserInfoRequestValidator.cs
  52. 2
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Handlers/Constants.cs
  53. 114
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Services/IdentityServerSessionAuthenticationService.cs
  54. 0
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/System/StringsExtensions.cs
  55. 24
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/AbpAccountWebOpenIddictModule.cs
  56. 28
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Controllers/AuthorizeController.cs
  57. 14
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/ProcessSignOutIdentitySession.cs
  58. 2
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/RevocationIdentitySession.cs
  59. 25
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/ServerValidationTokenCheckIdentitySession.cs
  60. 4
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/ValidationTokenCheckIdentitySession.cs
  61. 114
      aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Services/OpenIddictSessionAuthenticationService.cs
  62. 24
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN.Abp.Identity.AspNetCore.Session.csproj
  63. 26
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN/Abp/Identity/AspNetCore/Session/AbpIdentityAspNetCoreSessionModule.cs
  64. 58
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN/Abp/Identity/AspNetCore/Session/AbpIdentitySessionAuthenticationService.cs
  65. 67
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/README.EN.md
  66. 67
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/README.md
  67. 11
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IIdentitySessionManager.cs
  68. 38
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IdentitySessionClaimsPrincipalContributor.cs
  69. 19
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IdentitySessionManager.cs
  70. 31
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IdentitySessionSignInOptions.cs
  71. 3
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/FodyWeavers.xml
  72. 30
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/FodyWeavers.xsd
  73. 12
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpIdentitySessionAspNetCoreModule.cs
  74. 22
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpSessionApplicationBuilderExtensions.cs
  75. 42
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpSessionMiddleware.cs
  76. 97
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/README.EN.md
  77. 98
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/README.md
  78. 14
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN/Abp/Identity/Session/DefaultIdentitySessionChecker.cs
  79. 1
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN/Abp/Identity/Session/DefaultSessionInfoProvider.cs
  80. 2
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN/Abp/Identity/Session/ISessionInfoProvider.cs
  81. 3
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/FodyWeavers.xml
  82. 30
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/FodyWeavers.xsd
  83. 22
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN.Abp.IdentityServer.Session.csproj
  84. 42
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN/Abp/IdentityServer/Session/AbpIdentityServerSessionModule.cs
  85. 102
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN/Abp/IdentityServer/Session/AbpIdentitySessionEventServiceHandler.cs
  86. 77
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/README.EN.md
  87. 77
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/README.md
  88. 3
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/FodyWeavers.xml
  89. 30
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/FodyWeavers.xsd
  90. 25
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj
  91. 54
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/AbpOpenIddictAspNetCoreSessionModule.cs
  92. 14
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/AbpOpenIddictAspNetCoreSessionOptions.cs
  93. 56
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/ProcessSignInIdentitySession.cs
  94. 49
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/UserinfoIdentitySession.cs
  95. 76
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/README.EN.md
  96. 76
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/README.md
  97. 1
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateRenderingEngine.cs
  98. 9
      aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs
  99. 4
      aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj
  100. 13
      aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs

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

@ -93,6 +93,11 @@
<Project Path="../gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.OpenApi.Gateway/LINGYUN.MicroService.OpenApi.Gateway.csproj" />
</Folder>
<Folder Name="/framework/" />
<Folder Name="/framework/aspnetcore/">
<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" />
</Folder>
<Folder Name="/framework/auditing/">
<Project Path="framework/auditing/LINGYUN.Abp.AspNetCore.Auditing/LINGYUN.Abp.AspNetCore.Auditing.csproj" />
<Project Path="framework/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
@ -123,8 +128,6 @@
<Project Path="framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN.Abp.Tencent.csproj" />
</Folder>
<Folder Name="/framework/common/">
<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.Core/LINGYUN.Abp.Core.csproj" />
<Project Path="framework/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN.Abp.Data.DbMigrator.csproj" />
<Project Path="framework/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj" />
@ -147,8 +150,8 @@
<Project Path="framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN.Abp.DataProtection.csproj" />
</Folder>
<Folder Name="/framework/dynamic-definition/">
<Project Path="framework/dynamic-definition/LINGYUN.Abp.Dynamic.Definitions/LINGYUN.Abp.Dynamic.Definitions.csproj" Id="6b19229f-012f-436a-b2b4-16ef943eb3fa" />
<Project Path="framework/dynamic-definition/LINGYUN.Abp.Dynamic.Definitions.Core/LINGYUN.Abp.Dynamic.Definitions.Core.csproj" Id="4cc5fdb2-2b0b-4937-a5b5-1c2afbc0c071" />
<Project Path="framework/dynamic-definition/LINGYUN.Abp.Dynamic.Definitions/LINGYUN.Abp.Dynamic.Definitions.csproj" Id="6b19229f-012f-436a-b2b4-16ef943eb3fa" />
</Folder>
<Folder Name="/framework/dynamic-queryable/">
<Project Path="framework/dynamic-queryable/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts/LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj" />
@ -295,8 +298,10 @@
<Project Path="modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN.Abp.Account.HttpApi.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN.Abp.Account.OAuth.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.Security/LINGYUN.Abp.Account.Security.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.Web.LazyCaptcha/LINGYUN.Abp.Account.Web.LazyCaptcha.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.Web.OAuth/LINGYUN.Abp.Account.Web.OAuth.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.Web.OpenIddict/LINGYUN.Abp.Account.Web.OpenIddict.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.Web.TencentCaptcha/LINGYUN.Abp.Account.Web.TencentCaptcha.csproj" />
<Project Path="modules/account/LINGYUN.Abp.Account.Web/LINGYUN.Abp.Account.Web.csproj" />
</Folder>
<Folder Name="/modules/auditing/">
@ -328,6 +333,10 @@
<Project Path="modules/caching-management/LINGYUN.Abp.CachingManagement.HttpApi/LINGYUN.Abp.CachingManagement.HttpApi.csproj" />
<Project Path="modules/caching-management/LINGYUN.Abp.CachingManagement.StackExchangeRedis/LINGYUN.Abp.CachingManagement.StackExchangeRedis.csproj" />
</Folder>
<Folder Name="/modules/captcha/">
<Project Path="modules/captcha/LINGYUN.Abp.Captcha.Abstractions/LINGYUN.Abp.Captcha.Abstractions.csproj" />
<Project Path="modules/captcha/LINGYUN.Abp.LazyCaptcha/LINGYUN.Abp.LazyCaptcha.csproj" />
</Folder>
<Folder Name="/modules/data-protection/">
<Project Path="modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application.Contracts/LINGYUN.Abp.DataProtectionManagement.Application.Contracts.csproj" />
<Project Path="modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN.Abp.DataProtectionManagement.Application.csproj" />
@ -371,7 +380,6 @@
<Project Path="modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN.Abp.Identity.Application.Contracts.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN.Abp.Identity.Application.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore.QrCode/LINGYUN.Abp.Identity.AspNetCore.QrCode.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN.Abp.Identity.AspNetCore.Session.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.EntityFrameworkCore/LINGYUN.Abp.Identity.EntityFrameworkCore.csproj" />
@ -380,7 +388,6 @@
<Project Path="modules/identity/LINGYUN.Abp.Identity.Notifications/LINGYUN.Abp.Identity.Notifications.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.OrganizaztionUnits/LINGYUN.Abp.Identity.OrganizaztionUnits.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.QrCode/LINGYUN.Abp.Identity.QrCode.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN.Abp.Identity.Session.csproj" />
<Project Path="modules/task-management/LINGYUN.Abp.Identity.Jobs/LINGYUN.Abp.Identity.Jobs.csproj" />
</Folder>
@ -396,7 +403,6 @@
<Folder Name="/modules/openiddict/">
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Application.Contracts/LINGYUN.Abp.OpenIddict.Application.Contracts.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Application/LINGYUN.Abp.OpenIddict.Application.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Dapr.Client/LINGYUN.Abp.OpenIddict.Dapr.Client.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.HttpApi.Client/LINGYUN.Abp.OpenIddict.HttpApi.Client.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.HttpApi/LINGYUN.Abp.OpenIddict.HttpApi.csproj" />

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

@ -109,6 +109,7 @@
<Folder Name="/framework/common/">
<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" />
<Project Path="framework/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN.Abp.Data.DbMigrator.csproj" />
<Project Path="framework/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj" />
<Project Path="framework/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj" />
@ -360,7 +361,6 @@
<Project Path="modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN.Abp.Identity.Application.Contracts.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN.Abp.Identity.Application.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore.QrCode/LINGYUN.Abp.Identity.AspNetCore.QrCode.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN.Abp.Identity.AspNetCore.Session.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore/LINGYUN.Abp.Identity.AspNetCore.csproj" Id="e25f7078-3af5-4456-b6e5-4027266de1ff" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj" />
@ -370,7 +370,6 @@
<Project Path="modules/identity/LINGYUN.Abp.Identity.Notifications/LINGYUN.Abp.Identity.Notifications.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.OrganizaztionUnits/LINGYUN.Abp.Identity.OrganizaztionUnits.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.QrCode/LINGYUN.Abp.Identity.QrCode.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN.Abp.Identity.Session.csproj" />
</Folder>
<Folder Name="/modules/identityServer/">
@ -381,7 +380,6 @@
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN.Abp.IdentityServer.HttpApi.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN.Abp.IdentityServer.Portal.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN.Abp.IdentityServer.Session.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN.Abp.IdentityServer.SmsValidator.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat.Work/LINGYUN.Abp.IdentityServer.WeChat.Work.csproj" />
</Folder>
@ -397,7 +395,6 @@
<Folder Name="/modules/openiddict/">
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Application.Contracts/LINGYUN.Abp.OpenIddict.Application.Contracts.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Application/LINGYUN.Abp.OpenIddict.Application.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Dapr.Client/LINGYUN.Abp.OpenIddict.Dapr.Client.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.HttpApi.Client/LINGYUN.Abp.OpenIddict.HttpApi.Client.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.HttpApi/LINGYUN.Abp.OpenIddict.HttpApi.csproj" />

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

@ -1,6 +1,5 @@
<Solution>
<Folder Name="/framework/">
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<Project Path="framework/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN.Abp.Data.DbMigrator.csproj" />
<Project Path="framework/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj" />
<Project Path="framework/common/LINGYUN.Abp.IP.Location/LINGYUN.Abp.IP.Location.csproj" />
@ -14,6 +13,10 @@
<Project Path="framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN.Abp.BlobStoring.Aliyun.csproj" />
<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.HttpOverrides/LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<Project Path="framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN.Abp.AspNetCore.Session.csproj" />
</Folder>
<Folder Name="/framework/authorization/">
<Project Path="framework/authorization/LINGYUN.Abp.Authorization.OrganizationUnits/LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.OrganizaztionUnits/LINGYUN.Abp.Identity.OrganizaztionUnits.csproj" />
@ -112,6 +115,9 @@
<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" />
@ -268,7 +274,6 @@
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN.Abp.IdentityServer.HttpApi.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.Portal/LINGYUN.Abp.IdentityServer.Portal.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN.Abp.IdentityServer.Session.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN.Abp.IdentityServer.SmsValidator.csproj" />
<Project Path="modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat.Work/LINGYUN.Abp.IdentityServer.WeChat.Work.csproj" />
</Folder>
@ -276,7 +281,6 @@
<Project Path="modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN.Abp.Identity.Application.Contracts.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN.Abp.Identity.Application.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore.QrCode/LINGYUN.Abp.Identity.AspNetCore.QrCode.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN.Abp.Identity.AspNetCore.Session.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.AspNetCore/LINGYUN.Abp.Identity.AspNetCore.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj" />
@ -284,7 +288,6 @@
<Project Path="modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN.Abp.Identity.HttpApi.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Notifications/LINGYUN.Abp.Identity.Notifications.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.QrCode/LINGYUN.Abp.Identity.QrCode.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<Project Path="modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN.Abp.Identity.Session.csproj" />
<Project Path="modules/task-management/LINGYUN.Abp.Identity.Jobs/LINGYUN.Abp.Identity.Jobs.csproj" />
</Folder>
@ -321,7 +324,6 @@
<Folder Name="/modules/openIddict/">
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Application.Contracts/LINGYUN.Abp.OpenIddict.Application.Contracts.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Application/LINGYUN.Abp.OpenIddict.Application.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.HttpApi/LINGYUN.Abp.OpenIddict.HttpApi.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.LinkUser/LINGYUN.Abp.OpenIddict.LinkUser.csproj" />
<Project Path="modules/openIddict/LINGYUN.Abp.OpenIddict.Portal/LINGYUN.Abp.OpenIddict.Portal.csproj" />

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

@ -387,9 +387,6 @@ public partial class AIServiceModule
options.TokenCookie.SameSite = SameSiteMode.Lax;
});
services.AddAlwaysAllowAuthorization();
services.AddAlwaysAllowSession();
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddAbpJwtBearer(options =>
{

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

@ -5,6 +5,7 @@ using LINGYUN.Abp.AI.Tools.Mcp;
using LINGYUN.Abp.AIManagement;
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.Data.DbMigrator;
@ -12,7 +13,6 @@ using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.Logging.Serilog.Elasticsearch;
@ -48,8 +48,6 @@ namespace LINGYUN.Abp.MicroService.AIService;
// 重写模板引擎支持外部本地化
typeof(AbpTextTemplatingScribanModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpAIOllamaModule),
typeof(AbpAIToolsModule),
typeof(AbpAIToolsHttpModule),
@ -66,6 +64,7 @@ namespace LINGYUN.Abp.MicroService.AIService;
typeof(AbpEmailingPlatformModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),

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

@ -42,6 +42,7 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -63,7 +64,6 @@
<ProjectReference Include="..\..\modules\ai\LINGYUN.Abp.AI.Tools.Mcp\LINGYUN.Abp.AI.Tools.Mcp.csproj" />
<ProjectReference Include="..\..\modules\ai\LINGYUN.Abp.AIManagement.Application\LINGYUN.Abp.AIManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\ai\LINGYUN.Abp.AIManagement.HttpApi\LINGYUN.Abp.AIManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Emailing.Platform\LINGYUN.Abp.Emailing.Platform.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Sms.Platform\LINGYUN.Abp.Sms.Platform.csproj" />
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Scriban\LINGYUN.Abp.TextTemplating.Scriban.csproj" />

5
aspnet-core/aspire/LINGYUN.Abp.MicroService.AIService/Program.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.AIService;
using LINGYUN.Abp.MicroService.AIService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Serilog;
using Volo.Abp.IO;
@ -59,8 +58,6 @@ try
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
// jwt
app.UseDynamicClaims();
// 授权

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

@ -1,6 +1,7 @@
using LINGYUN.Abp.Aliyun.SettingManagement;
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.Auditing;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.BlobManagement.SettingManagement;
@ -15,7 +16,6 @@ using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.FeatureManagement;
using LINGYUN.Abp.FeatureManagement.HttpApi;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.Logging.Serilog.Elasticsearch;
using LINGYUN.Abp.PermissionManagement;
@ -86,8 +86,6 @@ namespace LINGYUN.Abp.MicroService.AdminService;
// 重写模板引擎支持外部本地化
typeof(AbpTextTemplatingScribanModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AdminServiceMigrationsEntityFrameworkCoreModule),
typeof(AbpDataDbMigratorModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
@ -97,6 +95,7 @@ namespace LINGYUN.Abp.MicroService.AdminService;
typeof(AbpEmailingPlatformModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),

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

@ -43,6 +43,7 @@
<ProjectReference Include="..\..\framework\cloud-aliyun\LINGYUN.Abp.Aliyun.SettingManagement\LINGYUN.Abp.Aliyun.SettingManagement.csproj" />
<ProjectReference Include="..\..\framework\cloud-tencent\LINGYUN.Abp.Tencent.SettingManagement\LINGYUN.Abp.Tencent.SettingManagement.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -69,7 +70,6 @@
<ProjectReference Include="..\..\modules\data-protection\LINGYUN.Abp.DataProtectionManagement.HttpApi\LINGYUN.Abp.DataProtectionManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\feature-management\LINGYUN.Abp.FeatureManagement.Application\LINGYUN.Abp.FeatureManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\feature-management\LINGYUN.Abp.FeatureManagement.HttpApi\LINGYUN.Abp.FeatureManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Application\LINGYUN.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.HttpApi\LINGYUN.Abp.PermissionManagement.HttpApi.csproj" />

3
aspnet-core/aspire/LINGYUN.Abp.MicroService.AdminService/Program.cs

@ -1,4 +1,3 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.AdminService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Serilog;
@ -59,8 +58,6 @@ try
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
// jwt
app.UseDynamicClaims();
// 授权

17
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs

@ -4,14 +4,8 @@ using LINGYUN.Abp.Identity;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement;
using LINGYUN.Abp.MicroService.AuthServer.Ui.Branding;
using LINGYUN.Abp.OpenIddict.AspNetCore.Session;
using LINGYUN.Abp.OpenIddict.Impersonation;
using LINGYUN.Abp.OpenIddict.LinkUser;
using LINGYUN.Abp.OpenIddict.Portal;
using LINGYUN.Abp.OpenIddict.Sms;
using LINGYUN.Abp.OpenIddict.WeChat;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.WeChat.Work;
using LINGYUN.Abp.Wrapper;
using Medallion.Threading;
using Medallion.Threading.Redis;
@ -291,17 +285,6 @@ public partial class AuthServerModule
options.IsDynamicClaimsEnabled = true;
options.IsRemoteRefreshEnabled = false;
});
Configure<AbpOpenIddictAspNetCoreSessionOptions>(options =>
{
options.PersistentSessionGrantTypes.Add(SmsTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(PortalTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(LinkUserTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(ImpersonationTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(WeChatTokenExtensionGrantConsts.OfficialGrantType);
options.PersistentSessionGrantTypes.Add(WeChatTokenExtensionGrantConsts.MiniProgramGrantType);
options.PersistentSessionGrantTypes.Add(AbpWeChatWorkGlobalConsts.GrantType);
});
}
private void ConfigureVirtualFileSystem()
{

9
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Account;
using LINGYUN.Abp.Account.Web.LazyCaptcha;
using LINGYUN.Abp.Account.Web.OAuth;
using LINGYUN.Abp.Account.Web.OpenIddict;
using LINGYUN.Abp.Account.Web.TencentCaptcha;
@ -7,6 +6,7 @@ using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.MultiTenancy;
using LINGYUN.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.BlobStoring.BlobManagement;
using LINGYUN.Abp.Data.DbMigrator;
@ -17,11 +17,8 @@ using LINGYUN.Abp.Exporter.MiniSoftware;
using LINGYUN.Abp.Gdpr;
using LINGYUN.Abp.Gdpr.Web;
using LINGYUN.Abp.Identity.AspNetCore;
using LINGYUN.Abp.Identity.AspNetCore.Session;
using LINGYUN.Abp.Identity.OrganizaztionUnits;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.OpenIddict.AspNetCore.Session;
using LINGYUN.Abp.OpenIddict.Impersonation;
using LINGYUN.Abp.OpenIddict.LinkUser;
using LINGYUN.Abp.OpenIddict.Portal;
@ -64,9 +61,6 @@ namespace LINGYUN.Abp.MicroService.AuthServer;
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpIdentityAspNetCoreModule),
typeof(AbpIdentityAspNetCoreSessionModule),
typeof(AbpOpenIddictAspNetCoreSessionModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpOpenIddictSmsModule),
typeof(AbpOpenIddictWeChatModule),
typeof(AbpOpenIddictLinkUserModule),
@ -80,6 +74,7 @@ namespace LINGYUN.Abp.MicroService.AuthServer;
typeof(AbpAuditLoggingElasticsearchModule), // 放在 AbpIdentity 模块之后,避免被覆盖
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),

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

@ -45,6 +45,7 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\dynamic-definition\LINGYUN.Abp.Dynamic.Definitions\LINGYUN.Abp.Dynamic.Definitions.csproj" />
@ -72,10 +73,7 @@
<ProjectReference Include="..\..\modules\gdpr\LINGYUN.Abp.Gdpr.Web\LINGYUN.Abp.Gdpr.Web.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Application.Contracts\LINGYUN.Abp.Identity.Application.Contracts.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.AspNetCore\LINGYUN.Abp.Identity.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.AspNetCore.Session\LINGYUN.Abp.Identity.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.OrganizaztionUnits\LINGYUN.Abp.Identity.OrganizaztionUnits.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.AspNetCore.Session\LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.Impersonation\LINGYUN.Abp.OpenIddict.Impersonation.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.LinkUser\LINGYUN.Abp.OpenIddict.LinkUser.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.Portal\LINGYUN.Abp.OpenIddict.Portal.csproj" />

4
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/Program.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.AuthServer;
using LINGYUN.Abp.MicroService.AuthServer;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -70,7 +69,6 @@ try
app.UseAuthentication();
app.UseAbpOpenIddictValidation();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseUnitOfWork();
app.UseDynamicClaims();
app.UseAuthorization();

3
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/appsettings.Development.json

@ -156,7 +156,8 @@
"System": "Warning",
"Microsoft": "Warning",
"DotNetCore": "Warning",
"OpenIddict": "Warning"
"OpenIddict": "Warning",
"LINGYUN.Abp.Account": "Debug"
}
},
"WriteTo": [

6
aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Handlers/IdentitySessionAccessEventHandler.cs

@ -4,6 +4,7 @@ using LINGYUN.Abp.Identity.Settings;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.DistributedLocking;
@ -128,7 +129,10 @@ public class IdentitySessionAccessEventHandler :
{
if (!eventData.IpAddresses.IsNullOrWhiteSpace())
{
idetitySession.SetIpAddresses(eventData.IpAddresses.Split(","));
var ipAddresses = idetitySession.GetIpAddresses().ToList();
ipAddresses.RemoveAll(x => x == eventData.IpAddresses);
ipAddresses.Add(eventData.IpAddresses);
idetitySession.SetIpAddresses(ipAddresses);
}
idetitySession.UpdateLastAccessedTime(eventData.LastAccessed);

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

@ -1,6 +1,7 @@
using LINGYUN.Abp.Account;
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BlobStoring.BlobManagement;
@ -16,7 +17,6 @@ using LINGYUN.Abp.Gdpr.Identity;
using LINGYUN.Abp.Identity;
using LINGYUN.Abp.Identity.AspNetCore;
using LINGYUN.Abp.Identity.EntityFrameworkCore;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.OpenIddict;
@ -78,8 +78,8 @@ namespace LINGYUN.Abp.MicroService.IdentityService;
typeof(AbpEmailingPlatformModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpDynamicDefinitionsModule),

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

@ -46,6 +46,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\framework\dynamic-definition\LINGYUN.Abp.Dynamic.Definitions\LINGYUN.Abp.Dynamic.Definitions.csproj" />
@ -65,7 +66,6 @@
<ProjectReference Include="..\..\modules\gdpr\LINGYUN.Abp.Gdpr.EntityFrameworkCore\LINGYUN.Abp.Gdpr.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\gdpr\LINGYUN.Abp.Gdpr.HttpApi\LINGYUN.Abp.Gdpr.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.AspNetCore\LINGYUN.Abp.Identity.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.Application\LINGYUN.Abp.OpenIddict.Application.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.HttpApi\LINGYUN.Abp.OpenIddict.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Application\LINGYUN.Abp.Identity.Application.csproj" />

5
aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/Program.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.IdentityService;
using LINGYUN.Abp.MicroService.IdentityService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -65,8 +64,6 @@ try
app.UseAuthentication();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
// 动态身份
app.UseDynamicClaims();
// 授权

6
aspnet-core/aspire/LINGYUN.Abp.MicroService.IdentityService/appsettings.Development.json

@ -111,10 +111,10 @@
},
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Default": "Information",
"Override": {
"System": "Information",
"Microsoft": "Information",
"System": "Warning",
"Microsoft": "Warning",
"DotNetCore": "Warning"
}
},

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

@ -39,6 +39,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -52,7 +53,6 @@
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.MicroService.LocalizationService.EntityFrameworkCore\LINGYUN.Abp.MicroService.LocalizationService.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.Application\LINGYUN.Abp.LocalizationManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.HttpApi\LINGYUN.Abp.LocalizationManagement.HttpApi.csproj" />

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
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;
@ -7,7 +8,6 @@ using LINGYUN.Abp.Data.DbMigrator;
using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
@ -52,10 +52,10 @@ namespace LINGYUN.Abp.MicroService.LocalizationService;
typeof(AbpCAPEventBusModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpHttpClientModule),
typeof(AbpSmsPlatformModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),

5
aspnet-core/aspire/LINGYUN.Abp.MicroService.LocalizationService/Program.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.LocalizationService;
using LINGYUN.Abp.MicroService.LocalizationService;
using LINGYUN.Abp.MicroService.ServiceDefaults;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
@ -69,8 +68,6 @@ try
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
// 授权
app.UseAuthorization();

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

@ -42,6 +42,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Features.LimitValidation.Redis.Client\LINGYUN.Abp.Features.LimitValidation.Redis.Client.csproj" />
@ -62,7 +63,6 @@
<ProjectReference Include="..\LINGYUN.Abp.MicroService.MessageService.EntityFrameworkCore\LINGYUN.Abp.MicroService.MessageService.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.EntityFrameworkCore\LINGYUN.Abp.Identity.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Notifications\LINGYUN.Abp.Identity.Notifications.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Emailing.Platform\LINGYUN.Abp.Emailing.Platform.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Sms.Platform\LINGYUN.Abp.Sms.Platform.csproj" />
<ProjectReference Include="..\..\modules\realtime-message\LINGYUN.Abp.IM.SignalR\LINGYUN.Abp.IM.SignalR.csproj" />

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
@ -13,7 +14,6 @@ using LINGYUN.Abp.ExceptionHandling.Notifications;
using LINGYUN.Abp.Features.LimitValidation.Redis;
using LINGYUN.Abp.Identity.EntityFrameworkCore;
using LINGYUN.Abp.Identity.Notifications;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Identity.WeChat;
using LINGYUN.Abp.Identity.WeChat.Work;
using LINGYUN.Abp.IM.SignalR;
@ -112,11 +112,11 @@ namespace LINGYUN.Abp.MicroService.MessageService;
typeof(AbpFeaturesValidationRedisModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpHttpClientModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),

5
aspnet-core/aspire/LINGYUN.Abp.MicroService.MessageService/Program.cs

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.MessageService;
using LINGYUN.Abp.MicroService.MessageService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -66,8 +65,6 @@ try
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
// 授权
app.UseAuthorization();

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

@ -44,6 +44,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -61,7 +62,6 @@
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.MicroService.PlatformService.EntityFrameworkCore\LINGYUN.Abp.MicroService.PlatformService.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\blob-management\LINGYUN.Abp.BlobManagement.Application\LINGYUN.Abp.BlobManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\blob-management\LINGYUN.Abp.BlobManagement.Aliyun\LINGYUN.Abp.BlobManagement.Aliyun.csproj" />

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BlobManagement;
@ -15,7 +16,6 @@ using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.Features.LimitValidation.Redis;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.MicroService.PlatformService.BackgroundWorkers;
@ -89,12 +89,12 @@ namespace LINGYUN.Abp.MicroService.PlatformService;
// typeof(AbpFeaturesValidationRedisClientModule),// 当需要客户端特性限制时取消注释此模块
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpHttpClientModule),
typeof(AbpMailKitModule),
typeof(AbpAliyunSmsModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpSwashbuckleModule),

2
aspnet-core/aspire/LINGYUN.Abp.MicroService.PlatformService/Program.cs

@ -1,4 +1,3 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.PlatformService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Serilog;
@ -60,7 +59,6 @@ try
// 多租户
app.UseMultiTenancy();
// 会话
app.UseAbpSession();
app.UseDynamicClaims();
// 授权
app.UseAuthorization();

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

@ -42,6 +42,7 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
@ -82,6 +83,7 @@ namespace LINGYUN.Abp.MicroService.TaskService;
typeof(AbpAspNetCoreMvcModule),
typeof(AbpSwashbuckleModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),

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

@ -43,6 +43,7 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Http.Client.Wrapper\LINGYUN.Abp.Http.Client.Wrapper.csproj" />
@ -68,7 +69,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" />
</ItemGroup>

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

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.WeChatService;
using LINGYUN.Abp.MicroService.WeChatService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -57,7 +56,6 @@ app.UseCors();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseAuthorization();
app.UseSwagger();

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
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;
@ -7,7 +8,6 @@ using LINGYUN.Abp.Dynamic.Definitions;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.Http.Client.Wrapper;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Identity.WeChat.Work;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.Saas.EntityFrameworkCore;
@ -78,10 +78,10 @@ namespace LINGYUN.Abp.MicroService.WeChatService;
typeof(AbpHttpClientWrapperModule),
typeof(AbpMailKitModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpAutofacModule)
)]
public partial class WeChatServiceModule : AbpModule

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

@ -37,6 +37,7 @@
<ItemGroup>
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\dapr\LINGYUN.Abp.Dapr.Client.Wrapper\LINGYUN.Abp.Dapr.Client.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -55,7 +56,6 @@
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.MicroService.WebhookService.EntityFrameworkCore\LINGYUN.Abp.MicroService.WebhookService.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Emailing.Platform\LINGYUN.Abp.Emailing.Platform.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Sms.Platform\LINGYUN.Abp.Sms.Platform.csproj" />
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.Webhooks.EventBus\LINGYUN.Abp.Webhooks.EventBus.csproj" />

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

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.WebhookService;
using LINGYUN.Abp.MicroService.WebhookService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -59,7 +58,6 @@ try
app.UseAuthentication();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseAuthorization();
app.UseSwagger();

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
@ -11,7 +12,6 @@ using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.Http.Client.Wrapper;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.Sms.Platform;
@ -61,10 +61,10 @@ namespace LINGYUN.Abp.MicroService.WebhookService;
typeof(AbpClaimsMappingModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpSmsPlatformModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcWrapperModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpAutofacModule)
)]
public partial class WebhookServiceModule : AbpModule

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

@ -48,6 +48,7 @@
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -67,7 +68,6 @@
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities\LINGYUN.Abp.Elsa.Activities.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj" />
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.Emailing.Platform\LINGYUN.Abp.Emailing.Platform.csproj" />

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

@ -1,5 +1,4 @@
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.MicroService.WorkflowService;
using LINGYUN.Abp.MicroService.WorkflowService;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -58,7 +57,6 @@ app.UseCors();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
app.UseMultiTenancy();
app.UseAbpSession();
app.UseDynamicClaims();
app.UseAuthorization();
app.UseSwagger();

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

@ -1,5 +1,6 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.AspNetCore.Session;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.BackgroundTasks.DistributedLocking;
@ -16,7 +17,6 @@ using LINGYUN.Abp.Emailing.Platform;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.Http.Client.Wrapper;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.Quartz.PostgresSqlInstaller;
@ -83,10 +83,10 @@ namespace LINGYUN.Abp.MicroService.WorkflowService;
typeof(AbpSmsPlatformModule),
typeof(AbpEmailingPlatformModule),
typeof(AbpClaimsMappingModule),
typeof(AbpAspNetCoreSessionModule),
typeof(AbpAspNetCoreMvcNewtonsoftModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpDynamicDefinitionsModule),
typeof(AbpIdentitySessionAspNetCoreModule),
typeof(AbpAutofacModule)
)]
public partial class WorkflowServiceModule : AbpModule

11
aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging/LINGYUN/Abp/AuditLogging/AbpAuditLoggingModule.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Threading;
@ -43,13 +44,16 @@ public class AbpAuditLoggingModule : AbpModule
{
var rootServiceProvider = context.ServiceProvider.GetRequiredService<IRootServiceProvider>();
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpAuditLoggingOptions>>();
var logger = context.ServiceProvider.GetRequiredService<ILogger<AbpAuditLoggingModule>>();
if (options.Value.UseAuditLogQueue)
{
var auditLogQueue = rootServiceProvider.GetRequiredService<IAuditLogQueue>();
if (auditLogQueue is AuditLogQueue queue1)
{
logger.LogInformation("Prepare to start the audit log queue.");
await queue1.StartAsync(_cancellationTokenSource.Token);
logger.LogInformation("The audit log queue is ready.");
}
}
@ -58,7 +62,9 @@ public class AbpAuditLoggingModule : AbpModule
var securityLogQueue = rootServiceProvider.GetRequiredService<ISecurityLogQueue>();
if (securityLogQueue is SecurityLogQueue queue2)
{
logger.LogInformation("Prepare to start the security log queue.");
await queue2.StartAsync(_cancellationTokenSource.Token);
logger.LogInformation("The security log queue is ready.");
}
}
}
@ -67,13 +73,16 @@ public class AbpAuditLoggingModule : AbpModule
{
var rootServiceProvider = context.ServiceProvider.GetRequiredService<IRootServiceProvider>();
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpAuditLoggingOptions>>();
var logger = context.ServiceProvider.GetRequiredService<ILogger<AbpAuditLoggingModule>>();
if (options.Value.UseAuditLogQueue)
{
var auditLogQueue = rootServiceProvider.GetRequiredService<IAuditLogQueue>();
if (auditLogQueue is AuditLogQueue queue1)
{
logger.LogInformation("Prepare to stop the audit log queue.");
await queue1.StopAsync(_cancellationTokenSource.Token);
logger.LogInformation("The audit log queue has been stopped.");
}
}
@ -82,7 +91,9 @@ public class AbpAuditLoggingModule : AbpModule
var securityLogQueue = rootServiceProvider.GetRequiredService<ISecurityLogQueue>();
if (securityLogQueue is SecurityLogQueue queue2)
{
logger.LogInformation("Prepare to stop the security log queue.");
await queue2.StopAsync(_cancellationTokenSource.Token);
logger.LogInformation("The security log queue has been stopped.");
}
}

0
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/FodyWeavers.xml → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/FodyWeavers.xml

0
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/FodyWeavers.xsd → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/FodyWeavers.xsd

8
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN.Abp.Identity.Session.AspNetCore.csproj → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN.Abp.AspNetCore.Session.csproj

@ -5,8 +5,8 @@
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>LINGYUN.Abp.Identity.Session.AspNetCore</AssemblyName>
<PackageId>LINGYUN.Abp.Identity.Session.AspNetCore</PackageId>
<AssemblyName>LINGYUN.Abp.AspNetCore.Session</AssemblyName>
<PackageId>LINGYUN.Abp.AspNetCore.Session</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
@ -18,8 +18,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\common\LINGYUN.Abp.IP.Location\LINGYUN.Abp.IP.Location.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Identity.Session\LINGYUN.Abp.Identity.Session.csproj" />
<ProjectReference Include="..\..\..\modules\identity\LINGYUN.Abp.Identity.Session\LINGYUN.Abp.Identity.Session.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.IP.Location\LINGYUN.Abp.IP.Location.csproj" />
</ItemGroup>
</Project>

15
aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/AbpAspNetCoreSessionModule.cs

@ -0,0 +1,15 @@
using LINGYUN.Abp.Identity.Session;
using LINGYUN.Abp.IP.Location;
using Volo.Abp.AspNetCore;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AspNetCore.Session;
[DependsOn(
typeof(AbpIdentitySessionModule),
typeof(AbpIPLocationModule),
typeof(AbpAspNetCoreModule))]
public class AbpAspNetCoreSessionModule : AbpModule
{
}

7
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpIdentitySessionAspNetCoreOptions.cs → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/AbpAspNetCoreSessionOptions.cs

@ -1,12 +1,13 @@
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
public class AbpIdentitySessionAspNetCoreOptions
namespace LINGYUN.Abp.AspNetCore.Session;
public class AbpAspNetCoreSessionOptions
{
/// <summary>
/// 是否解析IP地理信息
/// </summary>
public bool IsParseIpLocation { get; set; }
public AbpIdentitySessionAspNetCoreOptions()
public AbpAspNetCoreSessionOptions()
{
IsParseIpLocation = false;
}

6
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpIdentitySessionDynamicClaimsPrincipalContributor.cs → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/AbpIdentitySessionDynamicClaimsPrincipalContributor.cs

@ -1,4 +1,5 @@
using System;
using LINGYUN.Abp.Identity.Session;
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
@ -7,7 +8,8 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
namespace LINGYUN.Abp.AspNetCore.Session;
public class AbpIdentitySessionDynamicClaimsPrincipalContributor : IAbpDynamicClaimsPrincipalContributor, ITransientDependency
{
public async virtual Task ContributeAsync(AbpClaimsPrincipalContributorContext context)

12
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/HttpContextDeviceInfoProvider.cs → aspnet-core/framework/common/LINGYUN.Abp.AspNetCore.Session/LINGYUN/Abp/AspNetCore/Session/HttpContextDeviceInfoProvider.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.IP.Location;
using LINGYUN.Abp.Identity.Session;
using LINGYUN.Abp.IP.Location;
using Microsoft.Extensions.Options;
using MyCSharp.HttpUserAgentParser;
using MyCSharp.HttpUserAgentParser.Providers;
@ -7,19 +8,20 @@ using System.Threading.Tasks;
using Volo.Abp.AspNetCore.WebClientInfo;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
namespace LINGYUN.Abp.AspNetCore.Session;
public class HttpContextDeviceInfoProvider : IDeviceInfoProvider, ITransientDependency
{
protected IIPLocationResolver IPLocationResolver { get; }
protected IWebClientInfoProvider WebClientInfoProvider { get; }
protected IHttpUserAgentParserProvider HttpUserAgentParser { get; }
protected AbpIdentitySessionAspNetCoreOptions Options { get; }
protected AbpAspNetCoreSessionOptions Options { get; }
public HttpContextDeviceInfoProvider(
IIPLocationResolver iPLocationResolver,
IWebClientInfoProvider webClientInfoProvider,
IHttpUserAgentParserProvider httpUserAgentParserProvider,
IOptions<AbpIdentitySessionAspNetCoreOptions> options)
IOptions<AbpAspNetCoreSessionOptions> options)
{
IPLocationResolver = iPLocationResolver;
WebClientInfoProvider = webClientInfoProvider;
@ -103,3 +105,5 @@ public class HttpContextDeviceInfoProvider : IDeviceInfoProvider, ITransientDepe
}
}
}

24
aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs

@ -1,5 +1,12 @@
using Microsoft.Extensions.DependencyInjection;
using IdentityServer4.Validation;
using LINGYUN.Abp.Account.Web.IdentityServer.Handlers;
using LINGYUN.Abp.Account.Web.IdentityServer.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.IdentityServer;
using Volo.Abp.Modularity;
using Volo.Abp.Security.Claims;
using Volo.Abp.VirtualFileSystem;
using VoloAbpAccountWebIdentityServerModule = Volo.Abp.Account.Web.AbpAccountWebIdentityServerModule;
@ -24,5 +31,20 @@ public class AbpAccountWebIdentityServerModule : AbpModule
{
options.FileSets.AddEmbedded<AbpAccountWebIdentityServerModule>();
});
//Configure<AbpIdentityServerEventOptions>(options =>
//{
// options.EventServiceHandlers.Add<AbpIdentitySessionEventServiceHandler>();
//});
Configure<AbpClaimsServiceOptions>(options =>
{
options.RequestedClaims.Add(AbpClaimTypes.SessionId);
});
context.Services.Replace(
ServiceDescriptor.Transient<IUserInfoRequestValidator, AbpIdentitySessionUserInfoRequestValidator>());
context.Services.Replace(
ServiceDescriptor.Transient<IAuthenticationService, IdentityServerSessionAuthenticationService>());
}
}

102
aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Handlers/AbpIdentitySessionEventServiceHandler.cs

@ -0,0 +1,102 @@
//using IdentityServer4.Events;
//using LINGYUN.Abp.Identity.Session;
//using System;
//using System.Security.Claims;
//using System.Threading.Tasks;
//using Volo.Abp.DependencyInjection;
//using Volo.Abp.MultiTenancy;
//using Volo.Abp.Security.Claims;
//using Volo.Abp.Uow;
//namespace LINGYUN.Abp.IdentityServer.Session;
///// <summary>
///// 持久化用户会话
///// </summary>
//public class AbpIdentitySessionEventServiceHandler : IAbpIdentityServerEventServiceHandler, ITransientDependency
//{
// protected ICurrentTenant CurrentTenant { get; }
// protected ISessionInfoProvider SessionInfoProvider { get; }
// protected IIdentitySessionManager IdentitySessionManager { get; }
// protected ICurrentPrincipalAccessor CurrentPrincipalAccessor { get; }
// public AbpIdentitySessionEventServiceHandler(
// ICurrentTenant currentTenant,
// ISessionInfoProvider sessionInfoProvider,
// IIdentitySessionManager identitySessionManager,
// ICurrentPrincipalAccessor currentPrincipalAccessor)
// {
// CurrentTenant = currentTenant;
// SessionInfoProvider = sessionInfoProvider;
// IdentitySessionManager = identitySessionManager;
// CurrentPrincipalAccessor = currentPrincipalAccessor;
// }
// public virtual bool CanRaiseEventType(EventTypes evtType)
// {
// return evtType == EventTypes.Success;
// }
// [UnitOfWork]
// public virtual Task RaiseAsync(Event evt)
// {
// if (evt is UserLoginSuccessEvent loginEvent)
// {
// // 用户登录事件
// return RaiseUserLoginSuccessEventAsync(loginEvent);
// }
// if (evt is UserLogoutSuccessEvent logoutEvent)
// {
// // 用户退出事件
// return RaiseUserLogoutSuccessEventAsync(logoutEvent);
// }
// if (evt is TokenRevokedSuccessEvent revokeEvent)
// {
// // 撤销令牌事件
// return RaiseTokenRevokedSuccessEventAsync(revokeEvent);
// }
// return Task.CompletedTask;
// }
// protected async virtual Task RaiseUserLoginSuccessEventAsync(UserLoginSuccessEvent loginEvent)
// {
// var subjectId = loginEvent.SubjectId;
// var sessionId = SessionInfoProvider.SessionId;
// if (!sessionId.IsNullOrWhiteSpace() &&
// Guid.TryParse(subjectId, out var userId))
// {
// var claimsIdentity = new ClaimsIdentity();
// claimsIdentity.AddClaim(new Claim(AbpClaimTypes.UserId, userId.ToString()));
// claimsIdentity.AddClaim(new Claim(AbpClaimTypes.SessionId, sessionId));
// if (!loginEvent.ClientId.IsNullOrWhiteSpace())
// {
// claimsIdentity.AddClaim(new Claim(AbpClaimTypes.ClientId, loginEvent.ClientId));
// }
// if (CurrentTenant.IsAvailable)
// {
// claimsIdentity.AddClaim(new Claim(AbpClaimTypes.TenantId, CurrentTenant.Id!.Value.ToString()));
// }
// var claimsPrincipal = new ClaimsPrincipal(claimsIdentity);
// using (CurrentPrincipalAccessor.Change(claimsPrincipal))
// {
// await IdentitySessionManager.SaveSessionAsync(claimsPrincipal);
// }
// }
// }
// protected async virtual Task RaiseUserLogoutSuccessEventAsync(UserLogoutSuccessEvent logoutEvent)
// {
// var sessionId = SessionInfoProvider.SessionId;
// if (!sessionId.IsNullOrWhiteSpace())
// {
// await IdentitySessionManager.RevokeSessionAsync(sessionId);
// }
// }
// protected async virtual Task RaiseTokenRevokedSuccessEventAsync(TokenRevokedSuccessEvent revokeEvent)
// {
// var sessionId = SessionInfoProvider.SessionId;
// if (!sessionId.IsNullOrWhiteSpace())
// {
// await IdentitySessionManager.RevokeSessionAsync(sessionId);
// }
// }
//}

8
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN/Abp/IdentityServer/Session/AbpIdentitySessionUserInfoRequestValidator.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Handlers/AbpIdentitySessionUserInfoRequestValidator.cs

@ -1,4 +1,4 @@
using IdentityModel;
using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
@ -6,11 +6,12 @@ using IdentityServer4.Services;
using IdentityServer4.Validation;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace LINGYUN.Abp.IdentityServer.Session;
namespace LINGYUN.Abp.Account.Web.IdentityServer.Handlers;
public class AbpIdentitySessionUserInfoRequestValidator : IUserInfoRequestValidator
{
private readonly IHttpContextAccessor _httpContextAccessor;
@ -104,3 +105,4 @@ public class AbpIdentitySessionUserInfoRequestValidator : IUserInfoRequestValida
}
}

2
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN/Abp/IdentityServer/Session/Constants.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Handlers/Constants.cs

@ -1,7 +1,7 @@
using IdentityModel;
using System.Collections.Generic;
namespace LINGYUN.Abp.IdentityServer.Session;
namespace LINGYUN.Abp.Account.Web.IdentityServer.Handlers;
internal static class Constants
{
public static Dictionary<string, int> ProtectedResourceErrorStatusCodes = new Dictionary<string, int>

114
aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/Services/IdentityServerSessionAuthenticationService.cs

@ -0,0 +1,114 @@
using Duende.IdentityModel;
using LINGYUN.Abp.Identity.Session;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.Account.Web.IdentityServer.Services;
public class IdentityServerSessionAuthenticationService : AuthenticationService
{
protected IIdentitySessionManager IdentitySessionManager { get; }
public IdentityServerSessionAuthenticationService(
IAuthenticationSchemeProvider schemes,
IAuthenticationHandlerProvider handlers,
IClaimsTransformation transform,
IOptions<AuthenticationOptions> options,
IIdentitySessionManager identitySessionManager) : base(schemes, handlers, transform, options)
{
IdentitySessionManager = identitySessionManager;
}
public async override Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties)
{
var claimsIdentity = principal.Identities.FirstOrDefault();
if (claimsIdentity == null || !claimsIdentity.FindSessionId().IsNullOrWhiteSpace())
{
await base.SignInAsync(context, scheme, principal, properties);
return;
}
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.SessionId, Guid.NewGuid().ToString()));
var clientId = principal.FindClientId();
if (clientId.IsNullOrWhiteSpace())
{
// 从授权回调中获取客户端Id
clientId = FindClientId(context);
}
await base.SignInAsync(context, scheme, principal, properties);
await IdentitySessionManager.SaveSessionAsync(clientId, principal, context.RequestAborted);
}
public async override Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
{
var sessionId = context.User?.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
// Revoke the user session.
await IdentitySessionManager.RevokeSessionAsync(sessionId, context.RequestAborted);
}
await base.SignOutAsync(context, scheme, properties);
}
private static string? FindClientId(HttpContext context)
{
if (context.Request.Query.TryGetValue("ReturnUrl", out var queryReturnUrls))
{
var clientId = GetQueryValue(queryReturnUrls.FirstOrDefault());
if (!clientId.IsNullOrWhiteSpace())
{
return clientId;
}
}
if (context.Request.Form.TryGetValue("ReturnUrl", out var formReturnUrls))
{
var clientId = GetQueryValue(formReturnUrls.FirstOrDefault());
if (!clientId.IsNullOrWhiteSpace())
{
return clientId;
}
}
if (context.Request.Query.TryGetValue(JwtClaimTypes.ClientId, out var queryClientIds))
{
return queryClientIds.FirstOrDefault();
}
if (context.Request.Form.TryGetValue(JwtClaimTypes.ClientId, out var formClientIds))
{
return formClientIds.FirstOrDefault();
}
return null;
}
private static string? GetQueryValue(string? returnUrls)
{
if (string.IsNullOrWhiteSpace(returnUrls))
{
return null;
}
if (returnUrls.Contains('?'))
{
returnUrls = returnUrls.Split('?')[1];
}
var parameters = QueryHelpers.ParseQuery(returnUrls);
return parameters.TryGetValue(JwtClaimTypes.ClientId, out var clientId) ? clientId.ToString() : null;
}
}

0
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/System/StringsExtensions.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/System/StringsExtensions.cs

24
aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/AbpAccountWebOpenIddictModule.cs

@ -1,7 +1,12 @@
using LINGYUN.Abp.Account.Web.OpenIddict.Pages.Account;
using LINGYUN.Abp.Account.Web.OpenIddict.Handlers;
using LINGYUN.Abp.Account.Web.OpenIddict.Pages.Account;
using LINGYUN.Abp.Account.Web.OpenIddict.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using OpenIddict.Validation;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Localization;
@ -28,6 +33,13 @@ public class AbpAccountWebOpenIddictModule : AbpModule
{
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountWebOpenIddictModule).Assembly);
});
PreConfigure<OpenIddictServerBuilder>(builder =>
{
builder.AddEventHandler(ProcessSignOutIdentitySession.Descriptor);
builder.AddEventHandler(RevocationIdentitySession.Descriptor);
builder.AddEventHandler(ServerValidationTokenCheckIdentitySession.Descriptor);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
@ -68,5 +80,15 @@ public class AbpAccountWebOpenIddictModule : AbpModule
bundle.AddFiles("/css/select-account.css");
});
});
context.Services.Add(ValidationTokenCheckIdentitySession.Descriptor.ServiceDescriptor);
Configure<OpenIddictValidationOptions>(options =>
{
options.Handlers.Add(ValidationTokenCheckIdentitySession.Descriptor);
});
context.Services.Replace(
ServiceDescriptor.Transient<IAuthenticationService, OpenIddictSessionAuthenticationService>());
}
}

28
aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Controllers/AuthorizeController.cs

@ -15,6 +15,7 @@ using System.Collections.Immutable;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Security;
@ -185,6 +186,14 @@ public class AuthorizeController : Volo.Abp.OpenIddict.Controllers.AuthorizeCont
principal.Identities.FirstOrDefault()?.AddClaim(claim);
}
// 需透传会话Id,避免创建多个会话
var claimsIdentity = principal.Identities.FirstOrDefault();
var sessionId = result.Principal.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
claimsIdentity?.AddClaim(new Claim(AbpClaimTypes.SessionId, sessionId));
}
// Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes.
// For that, simply restrict the list of scopes before calling SetScopes.
@ -287,10 +296,21 @@ public class AuthorizeController : Volo.Abp.OpenIddict.Controllers.AuthorizeCont
}
var result = await HttpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme);
if (result.Succeeded && result.Properties != null && result.Properties.IsPersistent)
if (result.Succeeded)
{
var claim = new Claim(AbpClaimTypes.RememberMe, true.ToString()).SetDestinations(OpenIddictConstants.Destinations.AccessToken);
principal.Identities.FirstOrDefault()?.AddClaim(claim);
if (result.Properties != null && result.Properties.IsPersistent)
{
var claim = new Claim(AbpClaimTypes.RememberMe, true.ToString()).SetDestinations(OpenIddictConstants.Destinations.AccessToken);
principal.Identities.FirstOrDefault()?.AddClaim(claim);
}
// 需透传会话Id,避免创建多个会话
var claimsIdentity = principal.Identities.FirstOrDefault();
var sessionId = result.Principal.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
claimsIdentity?.AddClaim(new Claim(AbpClaimTypes.SessionId, sessionId));
}
}
var scopes = Request.Form["selected_scopes"].ToString()?.Split(" ").ToImmutableArray() ?? [];
if (scopes.IsNullOrEmpty())
@ -313,7 +333,7 @@ public class AuthorizeController : Volo.Abp.OpenIddict.Controllers.AuthorizeCont
subject: await UserManager.GetUserIdAsync(user),
client: (await ApplicationManager.GetIdAsync(application))!,
type: OpenIddictConstants.AuthorizationTypes.Permanent,
scopes: principal.GetScopes());
scopes: scopes);
}
principal.SetAuthorizationId(await AuthorizationManager.GetIdAsync(authorization));

14
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/ProcessSignOutIdentitySession.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/ProcessSignOutIdentitySession.cs

@ -1,15 +1,18 @@
using LINGYUN.Abp.Identity.Session;
using OpenIddict.Server;
using System;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.Users;
namespace LINGYUN.Abp.Account.Web.OpenIddict.Handlers;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
/// <summary>
/// 用户退出登录终止会话
/// </summary>
public class ProcessSignOutIdentitySession : IOpenIddictServerHandler<OpenIddictServerEvents.ProcessSignOutContext>
{
protected ISessionInfoProvider SessionInfoProvider { get; }
protected ICurrentUser CurrentUser { get; }
protected IIdentitySessionManager IdentitySessionManager { get; }
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
@ -21,19 +24,20 @@ public class ProcessSignOutIdentitySession : IOpenIddictServerHandler<OpenIddict
.Build();
public ProcessSignOutIdentitySession(
ISessionInfoProvider sessionInfoProvider,
ICurrentUser currentUser,
IIdentitySessionManager identitySessionManager)
{
SessionInfoProvider = sessionInfoProvider;
CurrentUser = currentUser;
IdentitySessionManager = identitySessionManager;
}
public async virtual ValueTask HandleAsync(OpenIddictServerEvents.ProcessSignOutContext context)
{
var sessionId = SessionInfoProvider.SessionId;
var sessionId = CurrentUser.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
await IdentitySessionManager.RevokeSessionAsync(sessionId);
}
}
}

2
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/RevocationIdentitySession.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/RevocationIdentitySession.cs

@ -7,7 +7,7 @@ using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
namespace LINGYUN.Abp.Account.Web.OpenIddict.Handlers;
/// <summary>
/// 令牌撤销终止用户会话
/// </summary>

25
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/ServerValidationTokenCheckIdentitySession.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/ServerValidationTokenCheckIdentitySession.cs

@ -1,20 +1,20 @@
using LINGYUN.Abp.Identity.Session;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using OpenIddict.Server;
using System;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
using static OpenIddict.Abstractions.OpenIddictConstants;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
namespace LINGYUN.Abp.Account.Web.OpenIddict.Handlers;
public class ServerValidationTokenCheckIdentitySession : IOpenIddictServerHandler<OpenIddictServerEvents.ValidateTokenContext>
{
public ILogger<ServerValidationTokenCheckIdentitySession> Logger { protected get; set; }
protected ICurrentTenant CurrentTenant { get; }
protected IIdentitySessionChecker IdentitySessionChecker { get; }
protected AbpOpenIddictAspNetCoreSessionOptions AbpOpenIddictAspNetCoreSessionOptions { get; }
public static OpenIddictServerHandlerDescriptor Descriptor { get; } =
OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.ValidateTokenContext>()
@ -23,30 +23,28 @@ public class ServerValidationTokenCheckIdentitySession : IOpenIddictServerHandle
.SetType(OpenIddictServerHandlerType.Custom).Build();
public ServerValidationTokenCheckIdentitySession(
ICurrentTenant currentTenant,
IIdentitySessionChecker identitySessionChecker,
IOptions<AbpOpenIddictAspNetCoreSessionOptions> abpOpenIddictAspNetCoreSessionOptions)
ICurrentTenant currentTenant,
IIdentitySessionChecker identitySessionChecker)
{
CurrentTenant = currentTenant;
IdentitySessionChecker = identitySessionChecker;
AbpOpenIddictAspNetCoreSessionOptions = abpOpenIddictAspNetCoreSessionOptions.Value;
Logger = NullLogger<ServerValidationTokenCheckIdentitySession>.Instance;
}
public async virtual ValueTask HandleAsync(OpenIddictServerEvents.ValidateTokenContext context)
{
Logger.LogInformation("Server Validate Token: {endpointType} - {requestUri}", context.EndpointType, context.RequestUri);
Logger.LogDebug("Server Validate Token: {endpointType} - {requestUri}", context.EndpointType, context.RequestUri);
if (!AbpOpenIddictAspNetCoreSessionOptions.ValidationSessionEndpointTypes.Contains(context.EndpointType))
if (context.Principal == null || context.Principal.Identity?.IsAuthenticated == false)
{
Logger.LogDebug("Endpoint '{endpointType}' is not in validation whitelist, skipping session validation.", context.EndpointType);
Logger.LogWarning("Principal is null or not authenticated for endpoint '{endpointType}', skipping session validation.", context.EndpointType);
return;
}
if (context.Principal == null || context.Principal.Identity?.IsAuthenticated == false)
var sessionId = context.Principal?.FindSessionId();
if (sessionId.IsNullOrWhiteSpace())
{
Logger.LogWarning("Principal is null or not authenticated for endpoint '{endpointType}', skipping session validation.", context.EndpointType);
Logger.LogWarning("SessionId is null for endpoint '{endpointType}', skipping session validation.", context.EndpointType);
return;
}
@ -63,3 +61,4 @@ public class ServerValidationTokenCheckIdentitySession : IOpenIddictServerHandle
}
}
}

4
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/ValidationTokenCheckIdentitySession.cs → aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Handlers/ValidationTokenCheckIdentitySession.cs

@ -7,7 +7,8 @@ using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
using static OpenIddict.Abstractions.OpenIddictConstants;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
namespace LINGYUN.Abp.Account.Web.OpenIddict.Handlers;
public class ValidationTokenCheckIdentitySession : IOpenIddictValidationHandler<OpenIddictValidationEvents.ValidateTokenContext>
{
public ILogger<ValidationTokenCheckIdentitySession> Logger { protected get; set; }
@ -48,3 +49,4 @@ public class ValidationTokenCheckIdentitySession : IOpenIddictValidationHandler<
}
}
}

114
aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OpenIddict/Services/OpenIddictSessionAuthenticationService.cs

@ -0,0 +1,114 @@
using Duende.IdentityModel;
using LINGYUN.Abp.Identity.Session;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.Account.Web.OpenIddict.Services;
public class OpenIddictSessionAuthenticationService : AuthenticationService
{
protected IIdentitySessionManager IdentitySessionManager { get; }
public OpenIddictSessionAuthenticationService(
IAuthenticationSchemeProvider schemes,
IAuthenticationHandlerProvider handlers,
IClaimsTransformation transform,
IOptions<AuthenticationOptions> options,
IIdentitySessionManager identitySessionManager) : base(schemes, handlers, transform, options)
{
IdentitySessionManager = identitySessionManager;
}
public async override Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties)
{
var claimsIdentity = principal.Identities.FirstOrDefault();
if (claimsIdentity == null || !claimsIdentity.FindSessionId().IsNullOrWhiteSpace())
{
await base.SignInAsync(context, scheme, principal, properties);
return;
}
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.SessionId, Guid.NewGuid().ToString()));
var clientId = principal.FindClientId();
if (clientId.IsNullOrWhiteSpace())
{
// 从授权回调中获取客户端Id
clientId = FindClientId(context);
}
await base.SignInAsync(context, scheme, principal, properties);
await IdentitySessionManager.SaveSessionAsync(clientId, principal, context.RequestAborted);
}
public async override Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
{
var sessionId = context.User?.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
// Revoke the user session.
await IdentitySessionManager.RevokeSessionAsync(sessionId, context.RequestAborted);
}
await base.SignOutAsync(context, scheme, properties);
}
private static string? FindClientId(HttpContext context)
{
if (context.Request.Query.TryGetValue("ReturnUrl", out var queryReturnUrls))
{
var clientId = GetQueryValue(queryReturnUrls.FirstOrDefault());
if (!clientId.IsNullOrWhiteSpace())
{
return clientId;
}
}
if (context.Request.Form.TryGetValue("ReturnUrl", out var formReturnUrls))
{
var clientId = GetQueryValue(formReturnUrls.FirstOrDefault());
if (!clientId.IsNullOrWhiteSpace())
{
return clientId;
}
}
if (context.Request.Query.TryGetValue(JwtClaimTypes.ClientId, out var queryClientIds))
{
return queryClientIds.FirstOrDefault();
}
if (context.Request.Form.TryGetValue(JwtClaimTypes.ClientId, out var formClientIds))
{
return formClientIds.FirstOrDefault();
}
return null;
}
private static string? GetQueryValue(string? returnUrls)
{
if (string.IsNullOrWhiteSpace(returnUrls))
{
return null;
}
if (returnUrls.Contains('?'))
{
returnUrls = returnUrls.Split('?')[1];
}
var parameters = QueryHelpers.ParseQuery(returnUrls);
return parameters.TryGetValue(JwtClaimTypes.ClientId, out var clientId) ? clientId.ToString() : null;
}
}

24
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN.Abp.Identity.AspNetCore.Session.csproj

@ -1,24 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>LINGYUN.Abp.Identity.AspNetCore.Session</AssemblyName>
<PackageId>LINGYUN.Abp.Identity.AspNetCore.Session</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Identity.AspNetCore" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Identity.Domain\LINGYUN.Abp.Identity.Domain.csproj" />
</ItemGroup>
</Project>

26
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN/Abp/Identity/AspNetCore/Session/AbpIdentityAspNetCoreSessionModule.cs

@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Identity.AspNetCore;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Identity.AspNetCore.Session;
[DependsOn(
typeof(AbpIdentityAspNetCoreModule),
typeof(AbpIdentityDomainModule))]
public class AbpIdentityAspNetCoreSessionModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<IdentityBuilder>(builder =>
{
// builder.AddSignInManager<AbpIdentitySessionSignInManager>();
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient<IAuthenticationService, AbpIdentitySessionAuthenticationService>();
}
}

58
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/LINGYUN/Abp/Identity/AspNetCore/Session/AbpIdentitySessionAuthenticationService.cs

@ -1,58 +0,0 @@
using LINGYUN.Abp.Identity.Session;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using System;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
namespace LINGYUN.Abp.Identity.AspNetCore.Session;
public class AbpIdentitySessionAuthenticationService : AuthenticationService
{
protected IdentitySessionSignInOptions SessionSignInOptions { get; }
protected IIdentitySessionManager IdentitySessionManager { get; }
public AbpIdentitySessionAuthenticationService(
IAuthenticationSchemeProvider schemes,
IAuthenticationHandlerProvider handlers,
IClaimsTransformation transform,
IOptions<AuthenticationOptions> options,
IIdentitySessionManager identitySessionManager,
IOptions<IdentitySessionSignInOptions> sessionSignInOptions) : base(schemes, handlers, transform, options)
{
SessionSignInOptions = sessionSignInOptions.Value;
IdentitySessionManager = identitySessionManager;
}
public async override Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties)
{
await base.SignInAsync(context, scheme, principal, properties);
if (SessionSignInOptions.SignInSessionEnabled &&
!scheme.IsNullOrWhiteSpace() &&
SessionSignInOptions.AuthenticationSchemes.Contains(scheme))
{
// Save the user session.
await IdentitySessionManager.SaveSessionAsync(principal);
}
}
public async override Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
{
if (SessionSignInOptions.SignOutSessionEnabled &&
!scheme.IsNullOrWhiteSpace() &&
SessionSignInOptions.AuthenticationSchemes.Contains(scheme))
{
var sessionId = context.User?.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
// Revoke the user session.
await IdentitySessionManager.RevokeSessionAsync(sessionId);
}
}
await base.SignOutAsync(context, scheme, properties);
}
}

67
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/README.EN.md

@ -1,67 +0,0 @@
# LINGYUN.Abp.Identity.AspNetCore.Session
User session login extension module, mainly handling login/logout events provided by *AspNetCore.Identity* to manage sessions.
Due to module responsibility separation principle, please do not confuse with *LINGYUN.Abp.Identity.Session.AspNetCore* module.
## Configuration Usage
```csharp
[DependsOn(typeof(AbpIdentityAspNetCoreSessionModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## Features
* Extends AbpIdentityAspNetCoreModule module
* Provides session management functionality in AspNetCore environment
* Custom authentication service implementation
* Integrates with AspNetCore.Identity login/logout events
## Service Implementation
* AbpIdentitySessionAuthenticationService - Custom authentication service
* Handles user login/logout events
* Manages user session state
* Integrates with Identity session system
## Basic Usage
1. Configure authentication service
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient<IAuthenticationService, AbpIdentitySessionAuthenticationService>();
}
```
2. Use authentication service
```csharp
public class YourService
{
private readonly IAuthenticationService _authenticationService;
public YourService(IAuthenticationService authenticationService)
{
_authenticationService = authenticationService;
}
public async Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
{
await _authenticationService.SignInAsync(context, scheme, principal, properties);
}
public async Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
{
await _authenticationService.SignOutAsync(context, scheme, properties);
}
}
```
## More Information
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity)
* [ASP.NET Core Identity Documentation](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity)

67
aspnet-core/modules/identity/LINGYUN.Abp.Identity.AspNetCore.Session/README.md

@ -1,67 +0,0 @@
# LINGYUN.Abp.Identity.AspNetCore.Session
用户会话登录扩展模块,主要处理 *AspNetCore.Identity* 提供的登录/登出事件来管理会话
出于模块职责分离原则, 请勿与 *LINGYUN.Abp.Identity.Session.AspNetCore* 模块混淆
## 配置使用
```csharp
[DependsOn(typeof(AbpIdentityAspNetCoreSessionModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## 功能特性
* 扩展AbpIdentityAspNetCoreModule模块
* 提供AspNetCore环境下的会话管理功能
* 自定义身份认证服务实现
* 集成AspNetCore.Identity的登录/登出事件
## 服务实现
* AbpIdentitySessionAuthenticationService - 自定义身份认证服务
* 处理用户登录/登出事件
* 管理用户会话状态
* 与Identity会话系统集成
## 基本用法
1. 配置身份认证服务
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient<IAuthenticationService, AbpIdentitySessionAuthenticationService>();
}
```
2. 使用身份认证服务
```csharp
public class YourService
{
private readonly IAuthenticationService _authenticationService;
public YourService(IAuthenticationService authenticationService)
{
_authenticationService = authenticationService;
}
public async Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
{
await _authenticationService.SignInAsync(context, scheme, principal, properties);
}
public async Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
{
await _authenticationService.SignOutAsync(context, scheme, properties);
}
}
```
## 更多信息
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity)
* [ASP.NET Core Identity文档](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity)

11
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IIdentitySessionManager.cs

@ -18,6 +18,17 @@ public interface IIdentitySessionManager
ClaimsPrincipal claimsPrincipal,
CancellationToken cancellationToken = default);
/// <summary>
/// 保存会话
/// </summary>
/// <param name="clientId">客户端Id</param>
/// <param name="claimsPrincipal">用户身份主体</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task SaveSessionAsync(
string? clientId,
ClaimsPrincipal claimsPrincipal,
CancellationToken cancellationToken = default);
/// <summary>
/// 撤销用户会话
/// </summary>
/// <param name="sessionId">会话id</param>

38
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IdentitySessionClaimsPrincipalContributor.cs

@ -1,38 +0,0 @@
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
public class IdentitySessionClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
public virtual Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
var claimsIdentity = context.ClaimsPrincipal.Identities.First();
if (claimsIdentity.HasClaim(x => x.Type == AbpClaimTypes.SessionId))
{
return Task.CompletedTask;
}
var sessionId = claimsIdentity.FindSessionId();
if (!sessionId.IsNullOrWhiteSpace())
{
claimsIdentity.AddOrReplace(new Claim(AbpClaimTypes.SessionId, sessionId));
context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
return Task.CompletedTask;
}
var userId = claimsIdentity.FindUserId();
if (userId.HasValue)
{
var sessionInfoProvider = context.GetRequiredService<ISessionInfoProvider>();
sessionId = sessionInfoProvider.SessionId ?? Guid.NewGuid().ToString("N");
claimsIdentity.AddOrReplace(new Claim(AbpClaimTypes.SessionId, sessionId));
context.ClaimsPrincipal.AddIdentityIfNotContains(claimsIdentity);
}
return Task.CompletedTask;
}
}

19
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IdentitySessionManager.cs

@ -34,6 +34,17 @@ public class IdentitySessionManager : DomainService, IIdentitySessionManager
public async virtual Task SaveSessionAsync(
ClaimsPrincipal claimsPrincipal,
CancellationToken cancellationToken = default)
{
var clientId = claimsPrincipal.FindClientId();
await SaveSessionAsync(clientId, claimsPrincipal, cancellationToken);
}
[DisableAuditing]
public async virtual Task SaveSessionAsync(
string? clientId,
ClaimsPrincipal claimsPrincipal,
CancellationToken cancellationToken = default)
{
if (claimsPrincipal != null)
{
@ -59,9 +70,7 @@ public class IdentitySessionManager : DomainService, IIdentitySessionManager
var clientIpAddress = deviceInfo.ClientIpAddress;
var userName = claimsPrincipal.FindFirstValue(AbpClaimTypes.UserName);
var clientId = claimsPrincipal.FindClientId();
Logger.LogDebug($"Save user session for user: {userId}, session: {sessionId}");
Logger.LogDebug("Save user session for user: {userId}, session: {sessionId}", userId, sessionId);
await IdentitySessionStore.CreateAsync(
sessionId,
@ -77,7 +86,7 @@ public class IdentitySessionManager : DomainService, IIdentitySessionManager
tenantId,
cancellationToken);
Logger.LogDebug($"Remove dynamic claims cache for user: {userId}");
Logger.LogDebug("Remove dynamic claims cache for user: {userId}", userId);
await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(userId.Value, tenantId);
@ -102,7 +111,7 @@ public class IdentitySessionManager : DomainService, IIdentitySessionManager
string sessionId,
CancellationToken cancellationToken = default)
{
Logger.LogDebug($"Revoke user session for: {sessionId}");
Logger.LogDebug("Revoke user session for: {sessionId}", sessionId);
await IdentitySessionStore.RevokeAsync(sessionId, cancellationToken: cancellationToken);
}
}

31
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/Session/IdentitySessionSignInOptions.cs

@ -1,31 +0,0 @@
using System.Collections.Generic;
namespace LINGYUN.Abp.Identity.Session;
/// <summary>
/// 用于会话管理的配置
/// </summary>
public class IdentitySessionSignInOptions
{
/// <summary>
/// 用于处理的身份认证方案
/// </summary>
public List<string> AuthenticationSchemes { get; set; }
/// <summary>
/// 是否启用SignInManager登录会话
/// 默认: false
/// </summary>
public bool SignInSessionEnabled { get; set; }
/// <summary>
/// 是否启用SignInManager登出会话
/// 默认: false
/// </summary>
public bool SignOutSessionEnabled { get; set; }
public IdentitySessionSignInOptions()
{
AuthenticationSchemes = new List<string>
{
"Identity.Application"
};
}
}

3
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/FodyWeavers.xml

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

30
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/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>

12
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpIdentitySessionAspNetCoreModule.cs

@ -1,12 +0,0 @@
using LINGYUN.Abp.IP.Location;
using Volo.Abp.AspNetCore;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
[DependsOn(typeof(AbpAspNetCoreModule))]
[DependsOn(typeof(AbpIPLocationModule))]
[DependsOn(typeof(AbpIdentitySessionModule))]
public class AbpIdentitySessionAspNetCoreModule : AbpModule
{
}

22
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpSessionApplicationBuilderExtensions.cs

@ -1,22 +0,0 @@
using Microsoft.AspNetCore.Builder;
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
public static class AbpSessionApplicationBuilderExtensions
{
/// <summary>
/// 会话管理中间件
/// </summary>
/// <remarks>
/// 建议顺序:<br />
/// <seealso cref="AuthAppBuilderExtensions.UseAuthentication(IApplicationBuilder)"/><br />
/// <seealso cref="AbpSessionApplicationBuilderExtensions.UseAbpSession(IApplicationBuilder)"/><br />
/// <seealso cref="AbpApplicationBuilderExtensions.UseDynamicClaims(IApplicationBuilder)"/><br />
/// <seealso cref="AuthorizationAppBuilderExtensions.UseAuthorization(IApplicationBuilder)"/><br />
/// </remarks>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseAbpSession(this IApplicationBuilder app)
{
return app.UseMiddleware<AbpSessionMiddleware>();
}
}

42
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/LINGYUN/Abp/Identity/Session/AspNetCore/AbpSessionMiddleware.cs

@ -1,42 +0,0 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Middleware;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Security.Claims;
using Volo.Abp.Tracing;
namespace LINGYUN.Abp.Identity.Session.AspNetCore;
public class AbpSessionMiddleware : AbpMiddlewareBase, ITransientDependency
{
private readonly ISessionInfoProvider _sessionInfoProvider;
private readonly ICorrelationIdProvider _correlationIdProvider;
public AbpSessionMiddleware(
ISessionInfoProvider sessionInfoProvider,
ICorrelationIdProvider correlationIdProvider)
{
_sessionInfoProvider = sessionInfoProvider;
_correlationIdProvider = correlationIdProvider;
}
public override Task InvokeAsync(HttpContext context, RequestDelegate next)
{
var sessionId = _correlationIdProvider.Get() ?? Guid.NewGuid().ToString("N");
if (context.User.Identity?.IsAuthenticated == true)
{
if (context.RequestServices.GetRequiredService<IOptions<AbpClaimsPrincipalFactoryOptions>>().Value.IsDynamicClaimsEnabled)
{
// 在处理动态声明前保留全局会话用于验证
sessionId = context.User.FindSessionId();
}
}
using (_sessionInfoProvider.Change(sessionId))
{
return next(context);
}
}
}

97
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/README.EN.md

@ -1,97 +0,0 @@
# LINGYUN.Abp.Identity.Session.AspNetCore
Identity service user session extension module.
## Interface Description
### AbpSessionMiddleware extracts *sessionId* from user token in the request pipeline as a global session identifier, which can be used to log out sessions
> Note: When anonymous users access, the request *CorrelationId* is used as the identifier;
When *CorrelationId* does not exist, use random *Guid.NewGuid()*.
### HttpContextDeviceInfoProvider extracts device identification from request parameters
> Due to module responsibility separation principle, please do not confuse with *LINGYUN.Abp.Identity.AspNetCore.Session* module
### HttpContextDeviceInfoProvider is used to handle session IP address location parsing
> IsParseIpLocation will parse the geographical location of session IP when enabled
> IgnoreProvinces are provinces that need to be ignored when parsing geographical locations, usually China's municipalities
> LocationParser customizes the geographical location data that needs to be processed
## Features
* Provides session management functionality in AspNetCore environment
* Supports extracting device identification information from requests
* Supports IP geolocation parsing
* Depends on AbpAspNetCoreModule, AbpIP2RegionModule, and AbpIdentitySessionModule
## Configuration Options
### AbpIdentitySessionAspNetCoreOptions
```json
{
"Identity": {
"Session": {
"AspNetCore": {
"IsParseIpLocation": false, // Whether to parse IP geographic information, default: false
"IgnoreProvinces": [ // Provinces to ignore, default includes China's municipalities
"Beijing",
"Shanghai",
"Tianjin",
"Chongqing"
]
}
}
}
}
```
## Basic Usage
1. Configure IP geolocation parsing
```csharp
Configure<AbpIdentitySessionAspNetCoreOptions>(options =>
{
options.IsParseIpLocation = true; // Enable IP geolocation parsing
options.IgnoreProvinces.Add("Hong Kong"); // Add provinces to ignore
options.LocationParser = (locationInfo) =>
{
// Custom geolocation parsing logic
return $"{locationInfo.Country}{locationInfo.Province}{locationInfo.City}";
};
});
```
2. Use device information provider
```csharp
public class YourService
{
private readonly IDeviceInfoProvider _deviceInfoProvider;
public YourService(IDeviceInfoProvider deviceInfoProvider)
{
_deviceInfoProvider = deviceInfoProvider;
}
public async Task<DeviceInfo> GetDeviceInfoAsync()
{
return await _deviceInfoProvider.GetDeviceInfoAsync();
}
}
```
## Configuration Usage
```csharp
[DependsOn(typeof(AbpIdentitySessionAspNetCoreModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## More Information
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity)
* [ABP AspNetCore Documentation](https://docs.abp.io/en/abp/latest/AspNetCore)

98
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session.AspNetCore/README.md

@ -1,98 +0,0 @@
# LINGYUN.Abp.Identity.Session.AspNetCore
身份服务用户会话扩展模块
## 接口描述
### AbpSessionMiddleware 在请求管道中从用户令牌提取 *sessionId* 作为全局会话标识, 可用于注销会话
> 注意: 当匿名用户访问时, 以请求 *CorrelationId* 作为标识;
当 *CorrelationId* 不存在时, 使用随机 *Guid.NewGuid()*.
### HttpContextDeviceInfoProvider 从请求参数中提取设备标识
> 出于模块职责分离原则, 请勿与 *LINGYUN.Abp.Identity.AspNetCore.Session* 模块混淆
### HttpContextDeviceInfoProvider 用于处理会话IP的地址位置解析
> IsParseIpLocation 启用后将对会话IP进行地理位置解析
> IgnoreProvinces 解析地理位置时需要忽略的省份,通常情况下中国的直辖市需要
> LocationParser 自定义需要处理的地理位置数据
## 功能特性
* 提供AspNetCore环境下的会话管理功能
* 支持从请求中提取设备标识信息
* 支持IP地理位置解析功能
* 依赖AbpAspNetCoreModule、AbpIP2RegionModule和AbpIdentitySessionModule模块
## 配置项
### AbpIdentitySessionAspNetCoreOptions
```json
{
"Identity": {
"Session": {
"AspNetCore": {
"IsParseIpLocation": false, // 是否解析IP地理信息,默认:false
"IgnoreProvinces": [ // 不做处理的省份,默认包含中国直辖市
"北京",
"上海",
"天津",
"重庆"
]
}
}
}
}
```
## 基本用法
1. 配置IP地理位置解析
```csharp
Configure<AbpIdentitySessionAspNetCoreOptions>(options =>
{
options.IsParseIpLocation = true; // 启用IP地理位置解析
options.IgnoreProvinces.Add("香港"); // 添加需要忽略的省份
options.LocationParser = (locationInfo) =>
{
// 自定义地理位置解析逻辑
return $"{locationInfo.Country}{locationInfo.Province}{locationInfo.City}";
};
});
```
2. 使用设备信息提供者
```csharp
public class YourService
{
private readonly IDeviceInfoProvider _deviceInfoProvider;
public YourService(IDeviceInfoProvider deviceInfoProvider)
{
_deviceInfoProvider = deviceInfoProvider;
}
public async Task<DeviceInfo> GetDeviceInfoAsync()
{
return await _deviceInfoProvider.GetDeviceInfoAsync();
}
}
```
## 配置使用
```csharp
[DependsOn(typeof(AbpIdentitySessionAspNetCoreModule))]
public class YouProjectModule : AbpModule
{
// other
}
```
## 更多信息
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity)
* [ABP AspNetCore文档](https://docs.abp.io/en/abp/latest/AspNetCore)

14
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN/Abp/Identity/Session/DefaultIdentitySessionChecker.cs

@ -69,11 +69,11 @@ public class DefaultIdentitySessionChecker : IIdentitySessionChecker, ITransient
// Implementation https://github.com/abpio/abp-commercial-docs/blob/dev/en/modules/identity/session-management.md#how-it-works
var lastAccressedTime = identitySessionCacheItem.LastAccessed;
var lastAccessedTime = identitySessionCacheItem.LastAccessed;
var accressedTime = Clock.Now;
if (lastAccressedTime.HasValue &&
lastAccressedTime.Value < accressedTime.Subtract(SessionCheckOptions.KeepAccessTimeSpan))
if (lastAccessedTime.HasValue &&
lastAccessedTime.Value < accressedTime.Subtract(SessionCheckOptions.KeepAccessTimeSpan))
{
// 更新缓存中的访问地址以及客户端Ip地址
identitySessionCacheItem.LastAccessed = accressedTime;
@ -89,15 +89,15 @@ public class DefaultIdentitySessionChecker : IIdentitySessionChecker, ITransient
// identitySessionCacheItem.ExpiraIn = (expirainTime.Value - timestamp) * 1000;
//}
Logger.LogDebug($"Refresh the user access info in the cache from {sessionId}.");
Logger.LogDebug("Refresh the user access info in the cache from {sessionId}.", sessionId);
await IdentitySessionCache.RefreshAsync(sessionId, identitySessionCacheItem, cancellationToken);
}
// 避免某些场景频繁去刷新持久化设施
if (lastAccressedTime.HasValue &&
lastAccressedTime.Value < accressedTime.Subtract(SessionCheckOptions.SessionSyncTimeSpan))
if (lastAccessedTime.HasValue &&
lastAccessedTime.Value < accressedTime.Subtract(SessionCheckOptions.SessionSyncTimeSpan))
{
Logger.LogDebug($"Publishes the cache synchronization user session event from {sessionId}.");
Logger.LogDebug("Publishes the cache synchronization user session event from {sessionId}.", sessionId);
// 发布事件, 使持久化设施从缓存同步
var eventData = new IdentitySessionChangeAccessedEvent(
identitySessionCacheItem.SessionId,

1
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN/Abp/Identity/Session/DefaultSessionInfoProvider.cs

@ -7,6 +7,7 @@ using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.Identity.Session;
[Dependency(ServiceLifetime.Singleton, TryRegister = true)]
[Obsolete("The ISessionInfoProvider has been deprecated. Please use ICurrentUser.FindSessionId() instead.")]
public class DefaultSessionInfoProvider : ISessionInfoProvider
{
private readonly AsyncLocal<string?> _currentSessionId = new AsyncLocal<string?>();

2
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Session/LINGYUN/Abp/Identity/Session/ISessionInfoProvider.cs

@ -1,6 +1,8 @@
using System;
namespace LINGYUN.Abp.Identity.Session;
[Obsolete("The ISessionInfoProvider has been deprecated. Please use ICurrentUser.FindSessionId() instead.")]
public interface ISessionInfoProvider
{
string? SessionId { get; }

3
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/FodyWeavers.xml

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

30
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/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>

22
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN.Abp.IdentityServer.Session.csproj

@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>LINGYUN.Abp.IdentityServer.Session</AssemblyName>
<PackageId>LINGYUN.Abp.IdentityServer.Session</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\identity\LINGYUN.Abp.Identity.Domain\LINGYUN.Abp.Identity.Domain.csproj" />
<ProjectReference Include="..\..\identity\LINGYUN.Abp.Identity.Session\LINGYUN.Abp.Identity.Session.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.IdentityServer.Domain\LINGYUN.Abp.IdentityServer.Domain.csproj" />
</ItemGroup>
</Project>

42
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN/Abp/IdentityServer/Session/AbpIdentityServerSessionModule.cs

@ -1,42 +0,0 @@
using IdentityServer4.Validation;
using LINGYUN.Abp.Identity;
using LINGYUN.Abp.Identity.Session;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.IdentityServer;
using Volo.Abp.Modularity;
using Volo.Abp.Security.Claims;
namespace LINGYUN.Abp.IdentityServer.Session;
[DependsOn(
typeof(AbpIdentityServerDomainModule),
typeof(AbpIdentityDomainModule),
typeof(AbpIdentitySessionModule))]
public class AbpIdentityServerSessionModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpIdentityServerEventOptions>(options =>
{
options.EventServiceHandlers.Add<AbpIdentitySessionEventServiceHandler>();
});
Configure<AbpClaimsServiceOptions>(options =>
{
options.RequestedClaims.Add(AbpClaimTypes.SessionId);
});
Configure<IdentitySessionSignInOptions>(options =>
{
// UserLoginSuccessEvent由IdentityServer发布, 无需显式保存会话
options.SignInSessionEnabled = false;
// UserLoginSuccessEvent由用户发布, 需要显式注销会话
options.SignOutSessionEnabled = true;
});
// 默认UserinfoEndpoint仅解密token
// 启用此模块需要验证会话有效性
context.Services.Replace(ServiceDescriptor.Transient<IUserInfoRequestValidator, AbpIdentitySessionUserInfoRequestValidator>());
}
}

102
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/LINGYUN/Abp/IdentityServer/Session/AbpIdentitySessionEventServiceHandler.cs

@ -1,102 +0,0 @@
using IdentityServer4.Events;
using LINGYUN.Abp.Identity.Session;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
using Volo.Abp.Uow;
namespace LINGYUN.Abp.IdentityServer.Session;
/// <summary>
/// 持久化用户会话
/// </summary>
public class AbpIdentitySessionEventServiceHandler : IAbpIdentityServerEventServiceHandler, ITransientDependency
{
protected ICurrentTenant CurrentTenant { get; }
protected ISessionInfoProvider SessionInfoProvider { get; }
protected IIdentitySessionManager IdentitySessionManager { get; }
protected ICurrentPrincipalAccessor CurrentPrincipalAccessor { get; }
public AbpIdentitySessionEventServiceHandler(
ICurrentTenant currentTenant,
ISessionInfoProvider sessionInfoProvider,
IIdentitySessionManager identitySessionManager,
ICurrentPrincipalAccessor currentPrincipalAccessor)
{
CurrentTenant = currentTenant;
SessionInfoProvider = sessionInfoProvider;
IdentitySessionManager = identitySessionManager;
CurrentPrincipalAccessor = currentPrincipalAccessor;
}
public virtual bool CanRaiseEventType(EventTypes evtType)
{
return evtType == EventTypes.Success;
}
[UnitOfWork]
public virtual Task RaiseAsync(Event evt)
{
if (evt is UserLoginSuccessEvent loginEvent)
{
// 用户登录事件
return RaiseUserLoginSuccessEventAsync(loginEvent);
}
if (evt is UserLogoutSuccessEvent logoutEvent)
{
// 用户退出事件
return RaiseUserLogoutSuccessEventAsync(logoutEvent);
}
if (evt is TokenRevokedSuccessEvent revokeEvent)
{
// 撤销令牌事件
return RaiseTokenRevokedSuccessEventAsync(revokeEvent);
}
return Task.CompletedTask;
}
protected async virtual Task RaiseUserLoginSuccessEventAsync(UserLoginSuccessEvent loginEvent)
{
var subjectId = loginEvent.SubjectId;
var sessionId = SessionInfoProvider.SessionId;
if (!sessionId.IsNullOrWhiteSpace() &&
Guid.TryParse(subjectId, out var userId))
{
var claimsIdentity = new ClaimsIdentity();
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.UserId, userId.ToString()));
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.SessionId, sessionId));
if (!loginEvent.ClientId.IsNullOrWhiteSpace())
{
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.ClientId, loginEvent.ClientId));
}
if (CurrentTenant.IsAvailable)
{
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.TenantId, CurrentTenant.Id!.Value.ToString()));
}
var claimsPrincipal = new ClaimsPrincipal(claimsIdentity);
using (CurrentPrincipalAccessor.Change(claimsPrincipal))
{
await IdentitySessionManager.SaveSessionAsync(claimsPrincipal);
}
}
}
protected async virtual Task RaiseUserLogoutSuccessEventAsync(UserLogoutSuccessEvent logoutEvent)
{
var sessionId = SessionInfoProvider.SessionId;
if (!sessionId.IsNullOrWhiteSpace())
{
await IdentitySessionManager.RevokeSessionAsync(sessionId);
}
}
protected async virtual Task RaiseTokenRevokedSuccessEventAsync(TokenRevokedSuccessEvent revokeEvent)
{
var sessionId = SessionInfoProvider.SessionId;
if (!sessionId.IsNullOrWhiteSpace())
{
await IdentitySessionManager.RevokeSessionAsync(sessionId);
}
}
}

77
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/README.EN.md

@ -1,77 +0,0 @@
# LINGYUN.Abp.IdentityServer.Session
IdentityServer session management module that provides user session management and validation functionality.
## Features
* Session Validation
* `AbpIdentitySessionUserInfoRequestValidator` - User Info Request Validator
* Validates user session status
* Validates access token validity
* Validates user active status
* Supports OpenID Connect standard
* Session Event Handling
* `AbpIdentitySessionEventServiceHandler` - Session Event Handler
* Handles user login success events
* Saves session information
* Supports multi-tenancy
* Records client identifier
* Handles user logout success events
* Revokes session
* Handles token revocation success events
* Revokes session
* Configuration Options
* Session Claims Configuration
* Add SessionId claim
* Session Login Configuration
* Disable explicit session saving
* Enable explicit session logout
## Module Reference
```csharp
[DependsOn(
typeof(AbpIdentityServerSessionModule)
)]
public class YourModule : AbpModule
{
// ...
}
```
## Dependencies
* `AbpIdentityServerDomainModule` - ABP IdentityServer Domain Module
* `AbpIdentityDomainModule` - ABP Identity Domain Module
* `AbpIdentitySessionModule` - ABP Identity Session Module
## Configuration and Usage
### Configure Session Options
```csharp
Configure<IdentitySessionSignInOptions>(options =>
{
// UserLoginSuccessEvent is published by IdentityServer, no need for explicit session saving
options.SignInSessionEnabled = false;
// UserLoginSuccessEvent is published by user, requires explicit session logout
options.SignOutSessionEnabled = true;
});
```
### Configure Claims Options
```csharp
Configure<AbpClaimsServiceOptions>(options =>
{
options.RequestedClaims.Add(AbpClaimTypes.SessionId);
});
```
Related Documentation:
* [IdentityServer4 Documentation](https://identityserver4.readthedocs.io/)
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Modules/Identity)
[查看中文文档](README.md)

77
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Session/README.md

@ -1,77 +0,0 @@
# LINGYUN.Abp.IdentityServer.Session
IdentityServer会话管理模块,提供用户会话管理和验证功能。
## 功能特性
* 会话验证
* `AbpIdentitySessionUserInfoRequestValidator` - 用户信息请求验证器
* 验证用户会话状态
* 验证访问令牌有效性
* 验证用户活动状态
* 支持OpenID Connect标准
* 会话事件处理
* `AbpIdentitySessionEventServiceHandler` - 会话事件处理器
* 处理用户登录成功事件
* 保存会话信息
* 支持多租户
* 记录客户端标识
* 处理用户登出成功事件
* 撤销会话
* 处理令牌撤销成功事件
* 撤销会话
* 配置选项
* 会话声明配置
* 添加SessionId声明
* 会话登录配置
* 禁用显式保存会话
* 启用显式注销会话
## 模块引用
```csharp
[DependsOn(
typeof(AbpIdentityServerSessionModule)
)]
public class YourModule : AbpModule
{
// ...
}
```
## 依赖模块
* `AbpIdentityServerDomainModule` - ABP IdentityServer领域模块
* `AbpIdentityDomainModule` - ABP Identity领域模块
* `AbpIdentitySessionModule` - ABP Identity会话模块
## 配置使用
### 配置会话选项
```csharp
Configure<IdentitySessionSignInOptions>(options =>
{
// UserLoginSuccessEvent由IdentityServer发布, 无需显式保存会话
options.SignInSessionEnabled = false;
// UserLoginSuccessEvent由用户发布, 需要显式注销会话
options.SignOutSessionEnabled = true;
});
```
### 配置声明选项
```csharp
Configure<AbpClaimsServiceOptions>(options =>
{
options.RequestedClaims.Add(AbpClaimTypes.SessionId);
});
```
相关文档:
* [IdentityServer4文档](https://identityserver4.readthedocs.io/)
* [ABP Identity文档](https://docs.abp.io/en/abp/latest/Modules/Identity)
[查看英文文档](README.EN.md)

3
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/FodyWeavers.xml

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

30
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/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>

25
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>LINGYUN.Abp.OpenIddict.AspNetCore.Session</AssemblyName>
<PackageId>LINGYUN.Abp.OpenIddict.AspNetCore.Session</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.OpenIddict.AspNetCore" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\identity\LINGYUN.Abp.Identity.Domain\LINGYUN.Abp.Identity.Domain.csproj" />
<ProjectReference Include="..\..\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
</ItemGroup>
</Project>

54
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/AbpOpenIddictAspNetCoreSessionModule.cs

@ -1,54 +0,0 @@
using LINGYUN.Abp.Identity;
using LINGYUN.Abp.Identity.Session;
using LINGYUN.Abp.Identity.Session.AspNetCore;
using Microsoft.Extensions.DependencyInjection;
using OpenIddict.Server;
using OpenIddict.Validation;
using Volo.Abp.Modularity;
using static OpenIddict.Abstractions.OpenIddictConstants;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
[DependsOn(
typeof(AbpIdentityDomainModule),
typeof(AbpIdentitySessionAspNetCoreModule)
)]
public class AbpOpenIddictAspNetCoreSessionModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<OpenIddictServerBuilder>(builder =>
{
builder.AddEventHandler(ProcessSignOutIdentitySession.Descriptor);
builder.AddEventHandler(ProcessSignInIdentitySession.Descriptor);
builder.AddEventHandler(RevocationIdentitySession.Descriptor);
builder.AddEventHandler(ServerValidationTokenCheckIdentitySession.Descriptor);
// builder.AddEventHandler(UserInfoIdentitySession.Descriptor);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<IdentitySessionSignInOptions>(options =>
{
options.SignInSessionEnabled = true;
options.SignOutSessionEnabled = true;
});
Configure<AbpOpenIddictAspNetCoreSessionOptions>(options =>
{
options.PersistentSessionGrantTypes.Add(GrantTypes.Password);
options.ValidationSessionEndpointTypes.Add(OpenIddictServerEndpointType.Token);
options.ValidationSessionEndpointTypes.Add(OpenIddictServerEndpointType.UserInfo);
options.ValidationSessionEndpointTypes.Add(OpenIddictServerEndpointType.Introspection);
options.ValidationSessionEndpointTypes.Add(OpenIddictServerEndpointType.Revocation);
});
context.Services.Add(ValidationTokenCheckIdentitySession.Descriptor.ServiceDescriptor);
Configure<OpenIddictValidationOptions>(options =>
{
options.Handlers.Add(ValidationTokenCheckIdentitySession.Descriptor);
});
}
}

14
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/AbpOpenIddictAspNetCoreSessionOptions.cs

@ -1,14 +0,0 @@
using OpenIddict.Server;
using System.Collections.Generic;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
public class AbpOpenIddictAspNetCoreSessionOptions
{
public List<string> PersistentSessionGrantTypes { get; set; }
public List<OpenIddictServerEndpointType> ValidationSessionEndpointTypes { get; set; }
public AbpOpenIddictAspNetCoreSessionOptions()
{
PersistentSessionGrantTypes = new List<string>();
ValidationSessionEndpointTypes = new List<OpenIddictServerEndpointType>();
}
}

56
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/ProcessSignInIdentitySession.cs

@ -1,56 +0,0 @@
using LINGYUN.Abp.Identity.Session;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using OpenIddict.Server;
using System;
using System.Security.Principal;
using System.Threading.Tasks;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
/// <summary>
/// 登录成功持久化用户会话
/// </summary>
public class ProcessSignInIdentitySession : IOpenIddictServerHandler<OpenIddictServerEvents.ProcessSignInContext>
{
public ILogger<ProcessSignInIdentitySession> Logger { protected get; set; }
protected IIdentitySessionManager IdentitySessionManager { get; }
protected AbpOpenIddictAspNetCoreSessionOptions AbpOpenIddictAspNetCoreSessionOptions { get; }
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.ProcessSignInContext>()
.AddFilter<OpenIddictServerHandlerFilters.RequireAccessTokenGenerated>()
.UseScopedHandler<ProcessSignInIdentitySession>()
.SetOrder(OpenIddictServerHandlers.PrepareAccessTokenPrincipal.Descriptor.Order + 1_000)
.SetType(OpenIddictServerHandlerType.Custom)
.Build();
public ProcessSignInIdentitySession(
IIdentitySessionManager identitySessionManager,
IOptions<AbpOpenIddictAspNetCoreSessionOptions> abpOpenIddictAspNetCoreSessionOptions)
{
IdentitySessionManager = identitySessionManager;
AbpOpenIddictAspNetCoreSessionOptions = abpOpenIddictAspNetCoreSessionOptions.Value;
Logger = NullLogger<ProcessSignInIdentitySession>.Instance;
}
public async virtual ValueTask HandleAsync(OpenIddictServerEvents.ProcessSignInContext context)
{
if (!context.Request.GrantType.IsNullOrWhiteSpace() &&
AbpOpenIddictAspNetCoreSessionOptions.PersistentSessionGrantTypes.Contains(context.Request.GrantType) &&
context.Principal != null)
{
Logger.LogInformation("Saving session for grant type: {grantType}", context.Request.GrantType);
await IdentitySessionManager.SaveSessionAsync(context.Principal, context.CancellationToken);
Logger.LogInformation("Session saved successfully: {sessionId}", context.Principal.FindSessionId());
}
else
{
Logger.LogDebug("Skipping session save for grant type: {grantType}", context.Request.GrantType);
}
}
}

49
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/UserinfoIdentitySession.cs

@ -1,49 +0,0 @@
using LINGYUN.Abp.Identity.Session;
using OpenIddict.Server;
using System;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.MultiTenancy;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Server.OpenIddictServerHandlers.UserInfo;
namespace LINGYUN.Abp.OpenIddict.AspNetCore.Session;
/// <summary>
/// UserInfoEndpoint 检查用户会话
/// </summary>
[Obsolete("UserInfoIdentitySession is outdated, please use the CheckIdentitySessionOnServerValidationToken")]
public class UserInfoIdentitySession : IOpenIddictServerHandler<OpenIddictServerEvents.HandleUserInfoRequestContext>
{
protected ICurrentTenant CurrentTenant { get; }
protected IIdentitySessionChecker IdentitySessionChecker { get; }
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.HandleUserInfoRequestContext>()
.AddFilter<OpenIddictServerHandlerFilters.RequireUserInfoRequest>()
.UseScopedHandler<UserInfoIdentitySession>()
.SetOrder(ValidateUserInfoRequest.Descriptor.Order + 2_000)
.SetType(OpenIddictServerHandlerType.Custom)
.Build();
public UserInfoIdentitySession(
ICurrentTenant currentTenant,
IIdentitySessionChecker identitySessionChecker)
{
CurrentTenant = currentTenant;
IdentitySessionChecker = identitySessionChecker;
}
public async virtual ValueTask HandleAsync(OpenIddictServerEvents.HandleUserInfoRequestContext context)
{
var tenantId = context.AccessTokenPrincipal.FindTenantId();
using (CurrentTenant.Change(tenantId))
{
if (!await IdentitySessionChecker.ValidateSessionAsync(context.AccessTokenPrincipal))
{
// Errors.InvalidToken ---> 401
// Errors.ExpiredToken ---> 400
context.Reject(Errors.InvalidToken, "The user session has expired.");
}
}
}
}

76
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/README.EN.md

@ -1,76 +0,0 @@
# LINGYUN.Abp.OpenIddict.AspNetCore.Session
[![ABP version](https://img.shields.io/badge/dynamic/xml?style=flat-square&color=yellow&label=abp&query=%2F%2FProject%2FPropertyGroup%2FAbpVersion&url=https%3A%2F%2Fraw.githubusercontent.com%2Fcolinin%2Fabp-next-admin%2Fmaster%2Faspnet-core%2Fmodules%2FopenIddict%2FLINGYUN.Abp.OpenIddict.AspNetCore.Session%2FLINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj)](https://abp.io)
[![NuGet](https://img.shields.io/nuget/v/LINGYUN.Abp.OpenIddict.AspNetCore.Session.svg?style=flat-square)](https://www.nuget.org/packages/LINGYUN.Abp.OpenIddict.AspNetCore.Session)
## Introduction
`LINGYUN.Abp.OpenIddict.AspNetCore.Session` is a session management extension module for OpenIddict, providing functionality for user session persistence, validation, and revocation.
[简体中文](./README.md)
## Features
* User Session Management
* Automatic session persistence on login
* Automatic session termination on logout
* Automatic session termination on token revocation
* UserInfo endpoint session validation
* Multi-tenancy Support
* Session management supports multi-tenant scenarios
* Tenant-isolated session storage
* Configurable Session Persistence
* Support for configuring grant types that require session persistence
* Default support for password grant type
## Installation
```bash
dotnet add package LINGYUN.Abp.OpenIddict.AspNetCore.Session
```
## Usage
1. Add `[DependsOn(typeof(AbpOpenIddictAspNetCoreSessionModule))]` to your module class.
2. Configure session options:
```csharp
Configure<IdentitySessionSignInOptions>(options =>
{
options.SignInSessionEnabled = true; // Enable login session
options.SignOutSessionEnabled = true; // Enable logout session
});
Configure<AbpOpenIddictAspNetCoreSessionOptions>(options =>
{
// Configure grant types that require session persistence
options.PersistentSessionGrantTypes.Add(GrantTypes.Password);
options.PersistentSessionGrantTypes.Add("custom_grant_type");
});
```
## Workflow
1. User Login
* When a user successfully logs in through configured grant types
* System automatically creates and persists session information
2. Session Validation
* When user accesses the UserInfo endpoint
* System automatically validates if the session is valid
* Returns appropriate error if session has expired or is invalid
3. Session Termination
* Automatically terminates session on user logout
* Automatically terminates related sessions on token revocation
* Supports session management for multiple concurrent logins
## Notes
* Session persistence only applies to configured grant types
* Session validation automatically switches tenant context in multi-tenant environments
* Token revocation will terminate related user sessions
* UserInfo endpoint session validation is mandatory, invalid sessions will result in request rejection

76
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/README.md

@ -1,76 +0,0 @@
# LINGYUN.Abp.OpenIddict.AspNetCore.Session
[![ABP version](https://img.shields.io/badge/dynamic/xml?style=flat-square&color=yellow&label=abp&query=%2F%2FProject%2FPropertyGroup%2FAbpVersion&url=https%3A%2F%2Fraw.githubusercontent.com%2Fcolinin%2Fabp-next-admin%2Fmaster%2Faspnet-core%2Fmodules%2FopenIddict%2FLINGYUN.Abp.OpenIddict.AspNetCore.Session%2FLINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj)](https://abp.io)
[![NuGet](https://img.shields.io/nuget/v/LINGYUN.Abp.OpenIddict.AspNetCore.Session.svg?style=flat-square)](https://www.nuget.org/packages/LINGYUN.Abp.OpenIddict.AspNetCore.Session)
## 简介
`LINGYUN.Abp.OpenIddict.AspNetCore.Session` 是 OpenIddict 的会话管理扩展模块,提供了用户会话的持久化、验证和撤销功能。
[English](./README.EN.md)
## 功能特性
* 用户会话管理
* 登录时自动持久化会话
* 登出时自动终止会话
* 令牌撤销时自动终止会话
* UserInfo 端点会话验证
* 多租户支持
* 会话管理支持多租户场景
* 租户隔离的会话存储
* 可配置的会话持久化
* 支持配置需要持久化会话的授权类型
* 默认支持密码授权类型
## 安装
```bash
dotnet add package LINGYUN.Abp.OpenIddict.AspNetCore.Session
```
## 使用
1. 添加 `[DependsOn(typeof(AbpOpenIddictAspNetCoreSessionModule))]` 到你的模块类。
2. 配置会话选项:
```csharp
Configure<IdentitySessionSignInOptions>(options =>
{
options.SignInSessionEnabled = true; // 启用登录会话
options.SignOutSessionEnabled = true; // 启用登出会话
});
Configure<AbpOpenIddictAspNetCoreSessionOptions>(options =>
{
// 配置需要持久化会话的授权类型
options.PersistentSessionGrantTypes.Add(GrantTypes.Password);
options.PersistentSessionGrantTypes.Add("custom_grant_type");
});
```
## 工作流程
1. 用户登录
* 当用户通过配置的授权类型登录成功时
* 系统自动创建并持久化会话信息
2. 会话验证
* 当用户访问 UserInfo 端点时
* 系统自动验证会话是否有效
* 如果会话已过期或无效,返回相应的错误
3. 会话终止
* 用户主动登出时自动终止会话
* 令牌撤销时自动终止相关会话
* 支持多终端同时登录的会话管理
## 注意事项
* 会话持久化仅对配置的授权类型生效
* 会话验证在多租户环境中会自动切换租户上下文
* 令牌撤销会同时终止相关的用户会话
* UserInfo 端点的会话验证是强制的,无效会话将导致请求被拒绝

1
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateRenderingEngine.cs

@ -14,6 +14,7 @@ public class ScribanTemplateRenderingEngine : TemplateRenderingEngineBase, ITran
{
public const string EngineName = "Scriban";
public override string Name => EngineName;
public override bool IsSandboxed => true;
public ScribanTemplateRenderingEngine(
ITemplateDefinitionManager templateDefinitionManager,

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

@ -16,6 +16,7 @@ global using LINGYUN.Abp.AspNetCore.MultiTenancy;
global using LINGYUN.Abp.AspNetCore.Mvc.Idempotent.Wrapper;
global using LINGYUN.Abp.AspNetCore.Mvc.UI.MultiTenancy;
global using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
global using LINGYUN.Abp.AspNetCore.Session;
global using LINGYUN.Abp.Auditing;
global using LINGYUN.Abp.AuditLogging.EntityFrameworkCore;
global using LINGYUN.Abp.AuditLogging.IP.Location;
@ -37,6 +38,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.Dapr.Client;
global using LINGYUN.Abp.Data.DbMigrator;
global using LINGYUN.Abp.DataProtectionManagement;
@ -64,14 +66,11 @@ global using LINGYUN.Abp.Http.Client.Wrapper;
global using LINGYUN.Abp.Idempotent;
global using LINGYUN.Abp.Identity;
global using LINGYUN.Abp.Identity.AspNetCore;
global using LINGYUN.Abp.Identity.AspNetCore.Session;
global using LINGYUN.Abp.Identity.EntityFrameworkCore;
global using LINGYUN.Abp.Identity.Jobs;
global using LINGYUN.Abp.Identity.Notifications;
global using LINGYUN.Abp.Identity.OrganizaztionUnits;
global using LINGYUN.Abp.Identity.QrCode;
global using LINGYUN.Abp.Identity.Session;
global using LINGYUN.Abp.Identity.Session.AspNetCore;
global using LINGYUN.Abp.Identity.WeChat;
global using LINGYUN.Abp.Identity.WeChat.Work;
global using LINGYUN.Abp.IdGenerator;
@ -95,7 +94,6 @@ global using LINGYUN.Abp.Notifications.WeChat.MiniProgram;
global using LINGYUN.Abp.Notifications.WeChat.Work;
global using LINGYUN.Abp.OpenApi.Authorization;
global using LINGYUN.Abp.OpenIddict;
global using LINGYUN.Abp.OpenIddict.AspNetCore.Session;
global using LINGYUN.Abp.OpenIddict.LinkUser;
global using LINGYUN.Abp.OpenIddict.Permissions;
global using LINGYUN.Abp.OpenIddict.Portal;
@ -172,6 +170,7 @@ global using OpenIddict.Server;
global using OpenIddict.Server.AspNetCore;
global using OpenIddict.Validation.AspNetCore;
global using Quartz;
global using Serilog;
global using StackExchange.Redis;
global using Swashbuckle.AspNetCore.SwaggerGen;
global using System.Security.Cryptography;
@ -205,11 +204,13 @@ global using Volo.Abp.Http.Client.IdentityModel.Web;
global using Volo.Abp.Identity.Localization;
global using Volo.Abp.Identity.Web;
global using Volo.Abp.Imaging;
global using Volo.Abp.IO;
global using Volo.Abp.Json;
global using Volo.Abp.Json.SystemTextJson;
global using Volo.Abp.Localization;
global using Volo.Abp.MailKit;
global using Volo.Abp.Modularity;
global using Volo.Abp.Modularity.PlugIns;
global using Volo.Abp.MultiTenancy;
global using Volo.Abp.OpenIddict;
global using Volo.Abp.OpenIddict.EntityFrameworkCore;

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

@ -76,6 +76,7 @@
<ProjectReference Include="..\..\framework\cloud-tencent\LINGYUN.Abp.Tencent.SettingManagement\LINGYUN.Abp.Tencent.SettingManagement.csproj" />
<ProjectReference Include="..\..\framework\cloud-tencent\LINGYUN.Abp.Tencent\LINGYUN.Abp.Tencent.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.AspNetCore.Session\LINGYUN.Abp.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -189,7 +190,6 @@
<ProjectReference Include="..\..\modules\gdpr\LINGYUN.Abp.Gdpr.Web\LINGYUN.Abp.Gdpr.Web.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Application.Contracts\LINGYUN.Abp.Identity.Application.Contracts.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Application\LINGYUN.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.AspNetCore.Session\LINGYUN.Abp.Identity.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.AspNetCore\LINGYUN.Abp.Identity.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Domain.Shared\LINGYUN.Abp.Identity.Domain.Shared.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Domain\LINGYUN.Abp.Identity.Domain.csproj" />
@ -197,14 +197,12 @@
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.HttpApi\LINGYUN.Abp.Identity.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Notifications\LINGYUN.Abp.Identity.Notifications.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.OrganizaztionUnits\LINGYUN.Abp.Identity.OrganizaztionUnits.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Session.AspNetCore\LINGYUN.Abp.Identity.Session.AspNetCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.Application.Contracts\LINGYUN.Abp.LocalizationManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.Application\LINGYUN.Abp.LocalizationManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.Domain.Shared\LINGYUN.Abp.LocalizationManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.Domain\LINGYUN.Abp.LocalizationManagement.Domain.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.HttpApi\LINGYUN.Abp.LocalizationManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.AspNetCore.Session\LINGYUN.Abp.OpenIddict.AspNetCore.Session.csproj" />
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.QrCode\LINGYUN.Abp.OpenIddict.QrCode.csproj" />
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Jobs\LINGYUN.Platform.Jobs.csproj" />
<ProjectReference Include="..\..\modules\realtime-message\LINGYUN.Abp.IM.SignalR\LINGYUN.Abp.IM.SignalR.csproj" />

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

@ -243,17 +243,6 @@ public partial class MicroServiceApplicationsSingleModule
options.DisableTransportSecurityRequirement = true;
});
Configure<AbpOpenIddictAspNetCoreSessionOptions>(options =>
{
options.PersistentSessionGrantTypes.Add(SmsTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(PortalTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(LinkUserTokenExtensionGrantConsts.GrantType);
options.PersistentSessionGrantTypes.Add(WeChatTokenExtensionGrantConsts.OfficialGrantType);
options.PersistentSessionGrantTypes.Add(WeChatTokenExtensionGrantConsts.MiniProgramGrantType);
options.PersistentSessionGrantTypes.Add(AbpWeChatWorkGlobalConsts.GrantType);
options.PersistentSessionGrantTypes.Add(QrCodeLoginProviderConsts.GrantType);
});
Configure<OpenIddictServerOptions>(options =>
{
var lifetime = configuration.GetSection("OpenIddict:Lifetime");
@ -863,7 +852,7 @@ public partial class MicroServiceApplicationsSingleModule
options.ExposeIntegrationServices = true;
});
Configure<AbpIdentitySessionAspNetCoreOptions>(options =>
Configure<AbpAspNetCoreSessionOptions>(options =>
{
// abp 9.0版本可存储登录IP地域, 开启IP解析
options.IsParseIpLocation = true;

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save