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
parent
commit
7764dec330
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      aspnet-core/services/LY.AIO.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs

5
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 =>

Loading…
Cancel
Save