JwtParser
Thread-safe JWT parser that parses, verifies, and validates JWS and JWE compact tokens.
Obtain an instance via JwtParserBuilder.build after configuring verification keys, decryption keys, and claim validators on the builder. Once built, a JwtParser instance is immutable and safe for concurrent use.
The parser enforces the following lifecycle for each token:
Structural validation — correct number of parts (3 for JWS, 5 for JWE per RFC 7515/7516).
Algorithm resolution — the
alg(andenc) header values are mapped to known algorithms.Signature/decryption — the token is cryptographically verified or decrypted.
Time-claim validation —
expandnbfclaims are checked against the current clock.Custom claim validation — any validators registered on the builder are applied.
See also
Functions
Auto-detects the token type and delegates to parseSigned (3 parts) or parseEncrypted (5 parts).
Parses and validates a JWE compact token, returning the decrypted JwtInstance.Jwe.
Parses and validates a JWS compact token, returning the signed JwtInstance.Jws.