Browse Source
Merge pull request #1127 from ksdaylight/fix/lifetime-of-CookieAuthenticationHandler
fix: The lifetime of AbpCookieAuthenticationHandler
pull/1149/head
yx lin
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
4 additions and
1 deletions
-
aspnet-core/services/LY.AIO.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs
|
|
|
@ -858,7 +858,10 @@ public partial class MicroServiceApplicationsSingleModule |
|
|
|
options.AutoValidate = false; |
|
|
|
}); |
|
|
|
|
|
|
|
services.Replace<CookieAuthenticationHandler, AbpCookieAuthenticationHandler>(ServiceLifetime.Scoped); |
|
|
|
var originalDescriptor = services.FirstOrDefault(d => d.ServiceType == typeof(CookieAuthenticationHandler)); |
|
|
|
var originalLifetime = originalDescriptor?.Lifetime ?? ServiceLifetime.Transient; // 默认用 Transient
|
|
|
|
|
|
|
|
services.Replace<CookieAuthenticationHandler, AbpCookieAuthenticationHandler>(originalLifetime); |
|
|
|
|
|
|
|
services.AddAuthentication() |
|
|
|
.AddAbpJwtBearer(options => |
|
|
|
|