-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Added Support for RFC 8414 OAuth 2.0 Authorization Server Metadata #6765
Conversation
@jzheaux
As you might have noticed, the Lastly, this is not the final change and the javadocs/comments require some more work. Once we agree on a |
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, @rhamedy! I've left some feedback inline - specifically, I'd like to see if we can't reduce a lot of the branching logic here.
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
Hey @jzheaux Thanks for the review. The branching logic did feel a little messy. I have made some changes (please see the recent commit)
Note: Once we are 👍 with the implementation details, then I will do the same for |
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.
@rhamedy, thanks, this cleaned up nicely!
I've left a bit more feedback inline.
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
@jzheaux pushed the recent changes to both Because of our refactoring, the error messages as mentioned above is changed. Not sure if this is going to be an issue in regards to how it affects the users of this feature 🤔 |
...c/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java
Outdated
Show resolved
Hide resolved
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.
@rhamedy this looks great. I've left just a bit more feedback inline.
...st/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTest.java
Outdated
Show resolved
Hide resolved
oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java
Outdated
Show resolved
Hide resolved
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoders.java
Show resolved
Hide resolved
We should be careful about changing error messages, but these changes appear reasonable to me. |
Added support for OAuth 2.0 Authorization Server Metadata as per the RFC 8414 specification. Updated the existing implementation of OpenId to comply with the Compatibility Section of RFC 8414 specification. Fixes: spring-projectsgh-6500
Hi @jzheaux, appreciate the feedback. There is always something new to learn. I have pushed my recent changes. Please let me know if you there is more room for improvement. I have added some javadoc and once feel free to point out areas that are confusing and need further clarification 👍 |
@rwinch @jgrandja Because we initially discussed The contract this PR proposes is:
|
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.
Yes, @rhamedy, this looks about right. Thank you, again!
It looks like there may be some cleanup items that you will still do, regarding error handling, but the contracts look right, which is I think what you were asking for in this review.
Hi @jzheaux, I wanted to pick your brain with regards to unit testing. Now that we have decided to make the added contract For example, the following test was there from before
So we keep the existing test
The 3 test cases would look as follow (refactored assertions) and using separate
If you notice the first line of each of the above 3 test is different and that's because we would like the server to
The switch case for We do the same for all of the existing tests for both |
@rhamedy, it's a good question - addressing all permutations can get pretty hard to keep up with for really not that much benefit. I think the critical logic to verify is
I think these can be tested independently for the most part - I wouldn't imagine there being 3x tests, it'd probably be one (or some) tests to verify the fallback logic and another set of tests confirming the parsing logic against the oauth2 endpoint. |
Hi @jzheaux Please see the recent changes. I have refactored the As far as I have also added |
* @return Map<String, Object> - Configuration Metadata from the given issuer | ||
*/ | ||
private static Map<ProviderType, String> getIssuerConfiguration(String issuer, String... paths) { | ||
Assert.notEmpty(paths, "paths cannot be empty or null."); |
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.
Might have to change that message to paths cannot be null or empty.
The use of |
@rhamedy, this is now merged into I squashed your commits (which is why you see a different commit hash) and then simplifed some of the branching logic that you called out - see the polish commit of 1739ef8 for details. |
Whoa! 😮 That's a massive |
Fixes: gh-6500