Browse Source

Make sure `authenticationScheme` implements `IAuthenticationSignOutHandler`.

Related to https://github.com/abpframework/abp/pull/18242
pull/19949/head
maliming 2 years ago
parent
commit
6fd0e567d8
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 12
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs

12
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpDynamicClaimsMiddleware.cs

@ -24,19 +24,15 @@ public class AbpDynamicClaimsMiddleware : AbpMiddlewareBase, ITransientDependenc
if (context.User.Identity?.IsAuthenticated == false)
{
var authenticationSchemeProvider = context.RequestServices.GetRequiredService<IAuthenticationSchemeProvider>();
if (!authenticationType.IsNullOrWhiteSpace())
{
var authenticationSchemeProvider = context.RequestServices.GetRequiredService<IAuthenticationSchemeProvider>();
var scheme = await authenticationSchemeProvider.GetSchemeAsync(authenticationType);
if (scheme != null)
var authenticationScheme = await authenticationSchemeProvider.GetSchemeAsync(authenticationType);
if (authenticationScheme != null && typeof(IAuthenticationSignOutHandler).IsAssignableFrom(authenticationScheme.HandlerType))
{
await context.SignOutAsync(scheme.Name);
await context.SignOutAsync(authenticationScheme.Name);
}
}
else
{
await context.SignOutAsync();
}
}
}
}

Loading…
Cancel
Save