-
Notifications
You must be signed in to change notification settings - Fork 1.4k
authenticationDetailsSource of OAuth2TokenEndpointFilter should be customizable #448
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
|
Hi @octopusthu, is this PR ready for review? Or are you still working on it? |
|
Hi @sjohnr , yes the PR is ready for review :) |
sjohnr
left a comment
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 PR @octopusthu. Please see suggestions below. When finished, please squash any new commits and edit the commit message to something like:
Customize authenticationDetailsSource of OAuth2TokenEndpointFilter
Closes gh-431
| */ | ||
| public final class OAuth2TokenEndpointConfigurer extends AbstractOAuth2Configurer { | ||
| private RequestMatcher requestMatcher; | ||
| private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource; |
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.
For now, I think we should leave this out of the configurer, as it doesn't seem like most applications will need to customize this. Instead, if you want to set the filter's authenticationDetailsSource, you can do so by registering an ObjectPostProcessor<OAuth2TokenEndpointFilter>.
As always, we can continue to listen to feedback and if many are looking to customize this, we can revisit adding it into the configurer.
| JWKSet jwkSet = new JWKSet(TestJwks.DEFAULT_RSA_JWK); | ||
| jwkSource = (jwkSelector, securityContext) -> jwkSelector.select(jwkSet); | ||
| jwtCustomizer = mock(OAuth2TokenCustomizer.class); | ||
| authenticationDetailsSource=mock(AuthenticationDetailsSource.class); |
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.
Given the above recommendation, I believe this could be removed from this test.
|
Thanks for the review @sjohnr ! The requested changes have been made and the commits squashed. Now the PR is ready for another review :) |
|
Thanks @octopusthu, this is now in |
authenticationDetailsSourcefield ofOAuth2TokenEndpointFiltercustomizable by making it non-final and adding a setter.OAuth2TokenEndpointFilterTests, following the same way thatauthenticationConverter,authenticationSuccessHandlerandauthenticationFailureHandlerare tested.OAuth2TokenEndpointConfigurerto letauthenticationDetailsSourcecustomizable through the configurer.OAuth2ClientCredentialsGrantTests, mockauthenticationDetailsSourcethe same way thatauthenticationConverter,authenticationSuccessHandlerandauthenticationFailureHandlerare mocked.