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

OAuth2TokenEndpointConfigurer custom AuthenticationProvider #437

Closed
jymot opened this issue Sep 9, 2021 · 1 comment
Closed

OAuth2TokenEndpointConfigurer custom AuthenticationProvider #437

jymot opened this issue Sep 9, 2021 · 1 comment
Assignees
Labels
status: duplicate A duplicate of another issue

Comments

@jymot
Copy link

jymot commented Sep 9, 2021

Expected Behavior
I want to add a custom AuthenticationProviderthrough the authenticationProvider method of OAuth2TokenEndpointConfigurer, and I want to keep the AuthenticationProvider provided by default.

Current Behavior
If I add a new AuthenticationProvider I cannot keep the defaultAuthenticationProvider, because I see the following code from OAuth2TokenEndpointConfigurer

	<B extends HttpSecurityBuilder<B>> void init(B builder) {
		ProviderSettings providerSettings = OAuth2ConfigurerUtils.getProviderSettings(builder);
		this.requestMatcher = new AntPathRequestMatcher(
				providerSettings.getTokenEndpoint(), HttpMethod.POST.name());

		List<AuthenticationProvider> authenticationProviders =
				!this.authenticationProviders.isEmpty() ?
						this.authenticationProviders :
						createDefaultAuthenticationProviders(builder);
		authenticationProviders.forEach(authenticationProvider ->
				builder.authenticationProvider(postProcess(authenticationProvider)));
	}

If this.authenticationProviders is not empty, then the default AuthenticationProvider will not be created.

If I want to achieve my goal, I must manually add the default AuthenticationProvider and my custom implementation together. I think this design is not very flexible.

Context
Is it possible to change the private <B extends HttpSecurityBuilder<B>> List<AuthenticationProvider> createDefaultAuthenticationProviders(B builder) method to public, or add a new method to add the default AuthenticationProviders

@jymot jymot added the type: enhancement A general enhancement label Sep 9, 2021
@jgrandja
Copy link
Collaborator

Closing as duplicate of #417

@jgrandja jgrandja self-assigned this Sep 21, 2021
@jgrandja jgrandja added status: duplicate A duplicate of another issue and removed type: enhancement A general enhancement labels Sep 21, 2021
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
Projects
None yet
Development

No branches or pull requests

2 participants