Skip to content

SignatureException could include the header and claims #969

@mnylensc

Description

@mnylensc

Is your feature request related to a problem? Please describe.
If JwtParser#parseSignedClaims call results into SignatureException, it's not possible to parse the JWS header or claims from the exception. This would be useful for collecting metrics per key id and audit logging, when you could log the already parsed header and claims.

Describe the solution you'd like
Similar to ExpiredJwtException#getHeader() and #getClaims(), SignatureException could also have those methods.

I realize the methods are missing probably because this could be quite dangerous if used wrong, but maybe the methods could be named with dangerously prefix to signify the inherent danger in using the return values...?

Describe alternatives you've considered
Decoding the JWS parts myself, but this seems like a waste, when the work to parse the token has already been done by JJWT.

Additional context
JJWT version 0.12.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions