-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Missing state parameter in Authorization Consent request throws 500 #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@guo-jun-airwallex You are correct, the The assertion check: if (this.consent) {
Assert.hasText(this.state, "state cannot be empty");
} is applied against the Authorization Consent Request NOT the Authorization Request. FYI, the spec does not outline how to implement the Authorization Consent flow as this is left to implementors. The current implementation requires the I'm going to close this as works as designed. |
Hi @jgrandja
When redirectOnError but no redirect uri in authorizationCodeRequestAuthentication However the state in authorizationRequest is recommended, then it throws error when build
Sorry, I still think it is a bug and plz confirm it again, so I want to reopen this issue. |
@guo-jun-airwallex The Authorization Consent flow you're simulating using Postman is not correct. Please review and run the messages sample to understand the Authorization Request -> Authorization Consent flow. FYI, this flow has been working for quite some time now. If you still feel there is a bug, then please review the tests in |
@jgrandja Here is my test:
|
Hi @jgrandja The only one line I modified is commented
It should throw OAuth2AuthorizationCodeRequestAuthenticationException with access denied error code, not IllegalArgumentException |
Hi @jgrandja |
@guo-jun-airwallex Thanks for providing the test as it did reveal a validation check was missing in I'm about to push the fix just in time for today's release. |
Actually the issue I reported before was the same as above one, thankfully the new version finally fixed it. |
Describe the bug
If client not pass state when authorization, it throws 500 error when user click cancel button in consent page.
The error was throwed in OAuth2AuthorizationCodeRequestAuthenticationToken
However click allow it can be redirected to client uri successful.

According to OAuth RFC, state is recommended in authorization endpoint.
So why we need to assert state when require consent?
To Reproduce
Expected behavior
state
should be recommended for client, not only when user allow authorization but also reject.The text was updated successfully, but these errors were encountered: