-
Notifications
You must be signed in to change notification settings - Fork 6k
Conditionally resolve bearer token from request parameters #10340
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
Conversation
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.
Greetings, @pneuschwander! Great start to this PR, thanks for working on it!
I was thinking I wouldn't have too many comments, but because of the number of tests (wonderful problem to have), I found a few extra things for you to think about. Sorry about the flood of comments! (It's not an indication that there's anything wrong.) See below comments inline, including a fairly lengthy discussion on a suggestion I have.
Lastly, would you mind adding // gh-10326
above each new unit test that is added in this PR?
Thanks!
...g/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java
Outdated
Show resolved
Hide resolved
...g/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java
Outdated
Show resolved
Hide resolved
...java/org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolver.java
Show resolved
Hide resolved
...g/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java
Outdated
Show resolved
Hide resolved
.../org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java
Outdated
Show resolved
Hide resolved
...org/springframework/security/oauth2/server/resource/web/DefaultBearerTokenResolverTests.java
Outdated
Show resolved
Hide resolved
...ecurity/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java
Outdated
Show resolved
Hide resolved
...ecurity/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java
Outdated
Show resolved
Hide resolved
...ecurity/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java
Outdated
Show resolved
Hide resolved
...ecurity/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverterTests.java
Outdated
Show resolved
Hide resolved
7a8cfb3
to
29aaa1d
Compare
@sjohnr Thank you for your feedback. I modified the PR accordingly. Could you please review the changes and let me know whether there is more that should be done before we can merge? 🙂 |
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.
Thanks for the changes, @pneuschwander. I have one additional comment below for discussion.
...ork/security/oauth2/server/resource/web/server/ServerBearerTokenAuthenticationConverter.java
Outdated
Show resolved
Hide resolved
29aaa1d
to
8b97353
Compare
Before this commit, the DefaultBearerTokenResolver unconditionally resolved the request parameters to check whether multiple tokens are present in the request and reject those requests as invalid. This commit changes this behaviour to resolve the request parameters only if parameter token is supported for the specific request according to spec (RFC 6750). Closes spring-projectsgh-10326
8b97353
to
156f71f
Compare
Thanks @pneuschwander, this is now in main. Also, congrats on your first contribution! |
What this pull request changes
Before this commit, the
DefaultBearerTokenResolver
unconditionallyresolved the request parameters to check whether multiple tokens
are present in the request and reject those requests as invalid.
This commit changes this behaviour to resolve the request parameters
only if parameter token is supported for the specific request
according to spec (RFC 6750).
Why this change is proposed
gh-10326 describes the impact of resolving the request parameters for large requests.
Resolving the request parameters conditionally as proposed by this pull request should solve the issue.
Notes
As this is my first contribution, please double check and feel free to provide feedback.
Closes gh-10326