Get "kid" field from JWT header
Issue #21
resolved
Hi Brian,
thanks for your great library!
How can I retrieve the "kid" header from a JWT?
Thanks! Marco
Comments (3)
-
repo owner -
repo owner - edited description
- marked as task
-
repo owner - changed status to resolved
resolving as it was just a question (that hopefully was answered) and there's no work to do
- Log in to comment
The getKeyIdHeaderValue() on JsonWebSignature (and JsonWebEncryption) will give you the kid value.
You might also want to consider using JwtConsumer[Builder] with maybe a HttpsJwksVerificationKeyResolver or JwksVerificationKeyResolver, which use the kid to select from key(s) for verification. But they do a lot of the work for you.
https://bitbucket.org/b_c/jose4j/wiki/JWT%20Examples#markdown-header-using-an-https-jwks-endpoint
https://bitbucket.org/b_c/jose4j/wiki/JWT%20Examples#markdown-header-using-jwks