Browse Source

fix: The lifetime of AbpCookieAuthenticationHandler needs to be configured as Transient, otherwise the extraction of the cookie named Identity.External will fail

pull/1127/head
ksdaylight 1 year ago
parent
commit
37e05cf964
  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; 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() services.AddAuthentication()
.AddAbpJwtBearer(options => .AddAbpJwtBearer(options =>

Loading…
Cancel
Save