Merge pull request #13843 from roc916/openiddict

fix `User.IsActive` and `IsLockedOut` is invalid when authorization
pull/13851/head
maliming 3 years ago committed by GitHub
commit 511d880fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -73,4 +73,24 @@ public abstract class AbpOpenIdDictControllerBase : AbpController
return false;
}
protected virtual async Task<bool> PreSignInCheckAsync(IdentityUser user)
{
if (!user.IsActive)
{
return false;
}
if (!await SignInManager.CanSignInAsync(user))
{
return false;
}
if (await UserManager.IsLockedOutAsync(user))
{
return false;
}
return true;
}
}

@ -33,7 +33,7 @@ public partial class TokenController
}
// Ensure the user is still allowed to sign in.
if (!await SignInManager.CanSignInAsync(user))
if (!await PreSignInCheckAsync(user))
{
return Forbid(
authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,

@ -33,7 +33,7 @@ public partial class TokenController
}
// Ensure the user is still allowed to sign in.
if (!await SignInManager.CanSignInAsync(user))
if (!await PreSignInCheckAsync(user))
{
return Forbid(
authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,

@ -33,7 +33,7 @@ public partial class TokenController
}
// Ensure the user is still allowed to sign in.
if (!await SignInManager.CanSignInAsync(user))
if (!await PreSignInCheckAsync(user))
{
return Forbid(
authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,

Loading…
Cancel
Save