Skip to content

Conversation

@octopusthu
Copy link
Contributor

  1. According to authenticationDetailsSource of OAuth2TokenEndpointFilter should be customizable #431 , make the authenticationDetailsSource field of OAuth2TokenEndpointFilter customizable by making it non-final and adding a setter.
  2. Add two tests to OAuth2TokenEndpointFilterTests, following the same way that authenticationConverter, authenticationSuccessHandler and authenticationFailureHandler are tested.
  3. Modify OAuth2TokenEndpointConfigurer to let authenticationDetailsSource customizable through the configurer.
  4. In OAuth2ClientCredentialsGrantTests, mock authenticationDetailsSource the same way that authenticationConverter, authenticationSuccessHandler and authenticationFailureHandler are mocked.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 3, 2021
@sjohnr
Copy link
Contributor

sjohnr commented Oct 5, 2021

Hi @octopusthu, is this PR ready for review? Or are you still working on it?

@octopusthu octopusthu marked this pull request as ready for review October 6, 2021 04:00
@octopusthu
Copy link
Contributor Author

Hi @sjohnr , yes the PR is ready for review :)

@sjohnr sjohnr self-assigned this Oct 21, 2021
Copy link
Contributor

@sjohnr sjohnr left a 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;
Copy link
Contributor

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);
Copy link
Contributor

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.

@sjohnr sjohnr added status: duplicate A duplicate of another issue type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 25, 2021
@octopusthu
Copy link
Contributor Author

Thanks for the review @sjohnr ! The requested changes have been made and the commits squashed. Now the PR is ready for another review :)

sjohnr pushed a commit that referenced this pull request Nov 3, 2021
@sjohnr
Copy link
Contributor

sjohnr commented Nov 3, 2021

Thanks @octopusthu, this is now in main in c9954af! I added a very small polish commit.

@sjohnr sjohnr closed this Nov 3, 2021
@octopusthu octopusthu deleted the gh-431 branch November 3, 2021 06:57
@jgrandja jgrandja added this to the 0.2.1 milestone Nov 3, 2021
jgrandja added a commit that referenced this pull request Nov 3, 2021
doba16 pushed a commit to doba16/spring-authorization-server that referenced this pull request Apr 21, 2023
doba16 pushed a commit to doba16/spring-authorization-server that referenced this pull request Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: duplicate A duplicate of another issue type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

authenticationDetailsSource of OAuth2TokenEndpointFilter should be customizable

4 participants