Related to #6883
When NimbusJwtDecoder#withJwkSetUri is invoked, the builder assumes RS256 if no algorithm is specified.
However, since this is based on the JWK Set, this is something that the builder can discover by querying the JWK Set endpoint.
Nimbus supports a feature like this:
JWKSource<C> jwkSource = new RemoteJWKSet<>(jwkSetURL);
JWSKeySelector<C> jwsKeySelector =
JWSAlgorithmFamilyJWSKeySelector.fromJWKSource(jwkSource);
jwtProcessor.setJWSKeySelector(jwsKeySelector);
If the application doesn't specify an algorithm, it would be nice to enhance the builder to discover the algorithms by hitting the JWK Set endpoint.
This also has the nice outcome that JwtDecoders.fromIssuerLocation would now be applicable for more than just RS256, which is currently not configurable.
Note that it'd be important to hit this endpoint lazily, so that it doesn't slow down startup.
Comment From: jzheaux
Duplicate of https://github.com/spring-projects/spring-security/issues/7160