Skip to content

NimbusJwtDecoderJwkSetUriBuilder should discover supported algorithms #7269

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

Closed
jzheaux opened this issue Aug 16, 2019 · 1 comment
Closed
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Aug 16, 2019

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.

@jzheaux jzheaux changed the title Jwt Decoder should discover supported algorithms NimbusJwtDecoderJwkSetUriBuilder should discover supported algorithms Aug 16, 2019
@jzheaux jzheaux self-assigned this Mar 12, 2020
@jzheaux jzheaux added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue labels Mar 12, 2020
@jzheaux
Copy link
Contributor Author

jzheaux commented Mar 12, 2020

Duplicate of #7160

@jzheaux jzheaux marked this as a duplicate of #7160 Mar 12, 2020
@jzheaux jzheaux closed this as completed Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

1 participant