-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support POST for authorization code request flow #1874
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
Closed
sylvain-costanzo
wants to merge
4
commits into
spring-projects:main
from
sylvain-costanzo:support-post-for-authorization-code-flow
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1df3e76
Remove the openid scope matcher in OAuth2AuthorizationEndpointFilter
sylvain-costanzo 40c8b22
Remove the openid scope matcher in OAuth2AuthorizationCodeRequestAuth…
sylvain-costanzo a8d0772
Disctinct Authorize matcher and Consent matcher in OAuth2Authorizatio…
sylvain-costanzo bc6b470
Disctinct Authorize matcher and Consent matcher in OAuth2Authorizatio…
sylvain-costanzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
responseTypeParameterMatcher
should not be removed as it will break the Authorization Consent flow. Only removeopenidScopeMatcher
here as well as inOAuth2AuthorizationCodeRequestAuthenticationConverter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
OAuth2AuthorizationEndpointFilter
, removing the openid scope and letting the response_type would result of a matcher like this:which is the same as (GET or POST) that's why I removed the response_type matcher.
I can add it back if you prefer it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the openid scope matcher from the converter
OAuth2AuthorizationCodeRequestAuthenticationConverter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we still need the
response_type
parameter in the matching because it's the difference between an Authorization Request or Authorization Consent Request.However, I think we need to adjust the matching as follows:
Authorization Request
(GET or POST) and response_type
Authorization Consent Request
POST and !response_type
This should be applied to
OAuth2AuthorizationEndpointFilter
and bothOAuth2AuthorizationCodeRequestAuthenticationConverter
andOAuth2AuthorizationConsentAuthenticationConverter
to be consistent.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the
response_type
matcher to the GET request inOAuth2AuthorizationEndpointFilter
will make the server return a 404 if a GET /authorize request is performed without the requiredresponse_type
parameter, instead of a 400.Specifically it is breaking the test
OAuth2AuthorizationEndpointFilterTests.doFilterWhenAuthorizationRequestMissingResponseTypeThenInvalidRequestError()
so I don't think adding this matcher inOAuth2AuthorizationEndpointFilter
is a good solution.For the same reason, adding these matcher rules to
OAuth2AuthorizationCodeRequestAuthenticationConverter
will make the request not enter the converter and prevent the server to return a 400 (it is breaking the same test).This highlight the fact that a POST /authorize request without the
response_type
parameter will be treated as a consent request, so maybe we could add a condition inOAuth2AuthorizationConsentAuthenticationConverter
to check if the user is authenticated?A way to solve all this could be to create a new converter after
OAuth2AuthorizationCodeRequestAuthenticationConverter
andOAuth2AuthorizationConsentAuthenticationConverter
to catch this missing parameter, so we can use the matcher in the converters?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the matching rules stated in the previous comment need to be adjusted as follows:
Authorization Request
GET or (POST and response_type)
Authorization Consent Request
POST and !response_type
I tried this on my end and all tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a distinction between the Authorize matcher and the Consent matcher in
OAuth2AuthorizationEndpointFilter
.A previous commit updated
OAuth2AuthorizationCodeRequestAuthenticationConverter
.Nothing to do for
OAuth2AuthorizationConsentAuthenticationConverter
It should be fine now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sylvain-costanzo I will get to this next week. I'm trying to wrap up a priority task by end of this week.