Skip to content

Commit

Permalink
Merge pull request #1127 from ksdaylight/fix/lifetime-of-CookieAuthen…
Browse files Browse the repository at this point in the history
…ticationHandler

fix:  The lifetime of AbpCookieAuthenticationHandler
  • Loading branch information
colinin authored Mar 5, 2025
2 parents 3fc306d + 37e05cf commit 7764dec
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,10 @@ private void ConfigureSecurity(IServiceCollection services, IConfiguration confi
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 =>
Expand Down

0 comments on commit 7764dec

Please sign in to comment.