-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Extract JwtDecoderFactory from JwtClientAssertionAuthenticationProvider #944
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
Comments
With the new The following configuration demonstrates how to add a custom // Customize JwtClientAssertionDecoderFactory
JwtClientAssertionDecoderFactory jwtDecoderFactory = new JwtClientAssertionDecoderFactory();
Function<RegisteredClient, OAuth2TokenValidator<Jwt>> jwtValidatorFactory = (registeredClient) -> {
OAuth2TokenValidator<Jwt> defaultJwtValidator =
JwtClientAssertionDecoderFactory.DEFAULT_JWT_VALIDATOR_FACTORY.apply(registeredClient);
return new DelegatingOAuth2TokenValidator<>(
defaultJwtValidator, // Apply default validators
new JwtClaimValidator<>("custom-claim", "custom-value"::equals)); // Apply custom validator
};
jwtDecoderFactory.setJwtValidatorFactory(jwtValidatorFactory);
// Configure JwtClientAssertionAuthenticationProvider
JwtClientAssertionAuthenticationProvider jwtClientAssertionAuthenticationProvider =
new JwtClientAssertionAuthenticationProvider(registeredClientRepository, authorizationService);
jwtClientAssertionAuthenticationProvider.setJwtDecoderFactory(jwtDecoderFactory); |
Hey @jgrandja, |
Hi @barneag! The reference documentation was updated in gh-945 (linked above). Take a look at Customizing Jwt Client Assertion Validation. I would recommend bookmarking the project page to quickly find links to the latest reference documentation. |
We should extract
JwtClientAssertionDecoderFactory
fromJwtClientAssertionAuthenticationProvider
into an outer class to allow for customization.We also need to introduce
JwtClientAssertionAuthenticationProvider.setJwtDecoderFactory(JwtDecoderFactory<RegisteredClient>)
so an application can configure a customizedJwtClientAssertionDecoderFactory
, or alternatively, supply their own implementation ofJwtDecoderFactory<RegisteredClient>
.The text was updated successfully, but these errors were encountered: