Skip to content
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

JWT Header #445

Closed
SanthaNarayana opened this issue Mar 15, 2019 · 3 comments
Closed

JWT Header #445

SanthaNarayana opened this issue Mar 15, 2019 · 3 comments

Comments

@SanthaNarayana
Copy link

I have JWT and i need to verify whether Header has valid Cert Chain and the public cert is registered at our end. if any issue then i need to raise exception. If everything good then only verify signature
I am using RSA, asymmetric keys

  • Currently is there any way i will get my JWT header with out parsing. so i will do above check and these all satisfy then i will go for verifying signature
    or
    is there any way i can throw exception from resolveSigningKey method in SigningKeyResolver.
    I am seeing the issue added support for throwing custom exceptions in SigningKeyResolver #191. This said added support but i did not found where it is so.

Currently i am having this code to parse. in resolveSigningKey method, i am doing these checks before sending public cert . But need the better way to throw exceptions when header does not have proper cert chain.
Claims claims = Jwts.parser() .setSigningKeyResolver(signingKeyResolver) .parseClaimsJws(token) .getBody();``

Your help is appreciated.

@SanthaNarayana
Copy link
Author

Hi All,

May i know the update? is it right way to post the message as issue... Please let us know. Thank you

@SanthaNarayana
Copy link
Author

For the alternate approach i am getting header
int i = jws.lastIndexOf('.') String withoutSignature = jws.substring(0, i+1); Jwt<Header,Claims> untrusted = Jwts.parser().parseClaimsJwt(withoutSignature);
mentioned in #67

@lhazlewood
Copy link
Contributor

@SanthaNarayana using the SigningKeyResolver is definitely the correct way to do this - you got it! :) Don't use the approach in #67 - it's not nearly as secure as using the SigningKeyResolver.

As an aside, please ask further usability questions using StackOverflow with the jjwt tag. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants