Skip to content

NimbusJwtDecoder.withSecretKey() does not work with JWT that contains kid #7056

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 Jun 28, 2019 · 0 comments
Closed
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Jun 28, 2019

Related to #7049

Summary

When using NimbusJwtDecoder.withSecretKey() to decode a JWT token that contains a kid the decoding always fails as the provided SecretKey does not match.

Actual Behavior

Signed JWT rejected: Another algorithm expected, or no matching key(s) found is raised, because no match key is found (JWT token contains key, provided secret key not).

Expected Behavior

As I specify the public key to used, the jwt token should be tried to be verified using this key. There is no need to find a matching key.

Version

5.2.0.M2

Sample

SecretKey verificationKey = // ... some key
String token = "someTokenWithKid";
NimbusJwtDecoder decoder = NimbusJwtDecoder.withSecretKey(secretKey).build();
decoder.decode(token);
@jzheaux jzheaux added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: improvement labels Jun 28, 2019
@jzheaux jzheaux added this to the 5.2.0.RC1 milestone Jun 28, 2019
@jzheaux jzheaux self-assigned this Jun 28, 2019
jzheaux added a commit to jzheaux/spring-security that referenced this issue Jun 28, 2019
kostya05983 pushed a commit to kostya05983/spring-security that referenced this issue Aug 26, 2019
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)
Projects
None yet
Development

No branches or pull requests

1 participant