-
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
Cannot override cache for Nimbus(Reactive)JwtDecoder in (Reactive)OidcIdTokenDecoderFactory #14673
Comments
Thanks, @afiluba, for the idea and the offer. I think the concern is that the cache factory would only apply for certain algorithm settings, which could be confusing. For example, a cache isn't needed when That said, I think another implementation of |
Hi, I looked a little bit into that and it looks for me that I need to introduce an AbstractTokenDecoderFactory, otherwise there will be a lot of duplicated code as the only method I want to customize is I do not know if I'm not going to far... I also noticed that currently I'll try to introduce a PR to further discuss this if You agree with my general idea. |
My second thought about this...Isn't Looking at already supported customizations they are provided as Does it change the perspective and explains why |
…derFactory, OidcIdTokenDecoderFactory Closes spring-projectsgh-14673
I can suggest a solution:
|
Yes, @afiluba, I was thinking about that as well. Since |
@CrazyParanoid, @afiluba, I think at that point, you should create your own For example: @Bean
JwtDecoderFactory<ClientRegistration> jwtDecoderFactory() {
return (client) -> {
String jwkSetUri = client.getProviderDetails().getJwkSetUri();
NimbusJwtDecoder decoder = NimbusJwtDecoder.withJwkSetUri(jwkSetUri).cache(new MyCache()).build();
decoder.setJwtValidator(new DelegatingOAuth2TokenValidator<>(
JwtValidators.createDefault(), new OidcIdTokenValidator(client)));
decoder.setClaimTypeConverter(
new ClaimTypeConverter(OidcIdTokenDecoderFactory.createDefaultClaimTypeConverters()));
return decoder;
}
} In this way, it's much clearer that you are in charge of setting up the entire |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Expected Behavior
It should be possible to customize cache in NimbusJwtDecoder created by OidcIdTokenDecoderFactory.
NimbusJwtDecoder currently supports spring cache as possible implementation.
If only OidcIdTokenDecoderFactory exposed possibility to set cache on NimbusJwtDecoder builder...
Current Behavior
OidcIdTokenDecoderFactory does not expose possibility to pass cache implementation to NimbusJwtDecoder builder.
That leads to use DefaultJWKSetCache with hardcoded lifespan and refresh time.
Context
I would like to have more control over the frequency of jwkset endpoint pooling.
I'm aware that I can create my own JwtDecoderFactory implementation but for me it looks like it would suit others too and fits into design.
I can try to prepare a PR if the idea is accepted.
The text was updated successfully, but these errors were encountered: