Token endpoint and locked account
See original GitHub issueHi I have a problem with token endpoint. I created custom controller action for token endpoint like in readme. I made few changes for account locking system:
// IF PASSWORD NOT CORRECT
if (!await _userManager.CheckPasswordAsync(user, request.Password))
{
if (_userManager.SupportsUserLockout)
{
await _userManager.AccessFailedAsync(user);
}
var failedAttempts = await _userManager.GetAccessFailedCountAsync(user);
var passwordInvalid = new ErrorViewModel()
{
Error = "Invalid grant",
ErrorDescription = String.Format("Password incorrect! {0} z 5 attempts.", failedAttempts )
};
return Json(passwordInvalid);
}
// IF ACCOUNT LOCKED
if (!await _userManager.IsLockedOutAsync(user))
{
var lockoutEndTime = await _userManager.GetLockoutEndDateAsync(user);
var accountLocked = new ErrorViewModel()
{
Error = "Invalid grant",
ErrorDescription = "Account locked! Wait " + lockoutEndTime.Value.Minute + "minutes."
};
return Json(accountLocked);
}
Unless user reach limit of attempts all is fine, but when user account is locked server not hit my action. I’m getting 400 (Bad Request), but it’s not my response:
{
error:"invalid_grant"
error_description:"Account locked out."
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Revoke all refresh tokens when account locked?
Scenario: a user enters his password incorrectly x times, so his account is locked for y minutes. Should I revoke all his refresh...
Read more >Azure AD not invalidating access/refresh token if the user is ...
The access token/refresh token will available in token's lifetime . Log out the web application and block the account won't revoke the token...
Read more >Token Best Practices
Lists best practices when using tokens in authentication and ... That's controlled by the scope parameter sent in the login request (either using...
Read more >What's the token expiration for Universal Login?
I can see that the universal login is based on lock, as it loads the lock script: ... Just call the token endpoint...
Read more >Post-Authorization token endpoint
The token endpoint URL is normally obtained from the initial unauthenticated call described at Bootstrapping OAuth2.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, I’m sold, let’s remove the internal check. I’ll work on that in the next few days.
Fixed by https://github.com/openiddict/openiddict-core/issues/220.