Skip to content
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

Support POST for authorization code request flow #1874

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sylvain-costanzo
Copy link

Closes gh-1811

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 13, 2025
@sylvain-costanzo
Copy link
Author

The removal of the oidc scope matcher now allow OAuth2AuthorizationEndpointFilter to send POST /authorize request without the openid scope to the converters.

But I see two issues with this development:

1- The default converter OAuth2AuthorizationCodeRequestAuthenticationConverter still need the oidc scope to be used, but removing this condition will mess things up with the consent request, who, in the default implementation and in the demo-authorizationserver sample, is also a POST without the openid scope (and without the response_type parameter, who make this converter throw an error).

Tackling this issue seems a bit out of scope for this PR so I didn't touch anything, and it can be surely be solved with some custom converters.

2- Another minor issue I see is that the oauth2 specification is saying that a /authorize request (GET or POST) is supposed to have the parameters in the query string,

The client constructs the request URI by adding the following parameters to the query component of the authorization endpoint URI using the "application/x-www-form-urlencoded" format

contradicting the OIDC spec saying that POST requests must use the body

If using the HTTP POST method, the request parameters are serialized using Form Serialization, per Section 13.2.

So this way of getting the request parameters may have to be updated, but again it can be solved with a custom converter, so it also felt out of scope of this PR.

Considering these 2 issues, I am not sure the PR is answering the "Support POST for authorization code request flow", and I would like your opinion on this

@sylvain-costanzo
Copy link
Author

Rewording my thoughts, I don't think these issues are completely out of scope, but they need significant refactor with more regression risks than the small change here.
The original goal of gh-1811 was to allow a POST /authorize without scope parameter to be sent to the converters, and this PR allows it.

@sylvain-costanzo sylvain-costanzo marked this pull request as ready for review January 16, 2025 18:24
@jgrandja jgrandja self-assigned this Jan 16, 2025
@jgrandja jgrandja added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 16, 2025
@jgrandja jgrandja changed the title Remove the openid scope matcher in OAuth2AuthorizationEndpointFilter Support POST for authorization code request flow Jan 16, 2025
String scope = request.getParameter(OAuth2ParameterNames.SCOPE);
return StringUtils.hasText(scope) && scope.contains(OidcScopes.OPENID);
};
RequestMatcher responseTypeParameterMatcher = (
Copy link
Collaborator

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 remove openidScopeMatcher here as well as in OAuth2AuthorizationCodeRequestAuthenticationConverter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Support POST for authorization code request flow
3 participants