JwtParser needs a setVerifyingKey API
See original GitHub issueThe token signature validation requires the caller to specify a signing key. It does not make it obvious that this is a verify operation.
JwtParser setSigningKey(byte[] key);
JwtParser setSigningKey(String base64EncodedKeyBytes);
JwtParser setSigningKey(Key key);
In RsaSignatureValidator, the isValid method does a signature verification if the passed key is an instance of type PublicKey. If passed an instance of type PrivateKey, it signs the data again and compares signature.
But at JWTParser layer, the following APIs will provide a more clear description of the operation:
JwtParser setVerifyingKey(byte[] verifyingKey);
JwtParser setVerifyingKey(String base64EncodedVerifyKeyBytes);
JwtParser setVerifyingKey(PublicKey publicKey);
However setSigningKey keys has to be retained for backward compatibility.
setVerifyingKey can also help scenarios where a token issuer service is different from a token validator, and the private key need not to be shared among them.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
JwtParser (JSON Web Token support for the JVM 0.9.1 API)
Parses the specified compact serialized JWT string based on the builder's current configuration state and returns the resulting unsigned plaintext JWT instance.
Read more >Controlling access to HTTP APIs with JWT authorizers
Unless you require ID tokens for API authorization, we recommend that you configure your routes to require authorization scopes. You can also configure...
Read more >JSON Web Tokens - jwt.io
JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties. The claims in a JWT...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is better self-documenting - I think it’s a good addition. Thanks for the issue!
Just noting that this isn’t as simple as expected: the
SigningKeyResolver
interface, its adapter, and anything else referencing such needs to be refactored. This is a change that’s probably better left for 1.0 (or at least a release after the more urgent 0.10.0 release).