JJWT 0.13
Last reviewed Oct 24, 2026
Prompt Details
Prompt Composition
2prompts
- Java 25113 lines · 2.8K tokens
- JJWT 0.1357 lines · 2.8K tokens
Total170 lines · 5.7K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 201
- 208
- 209
- 214
- 294
- 295
- 297
- 323
- 327
- 331
- 338
- 347
- 354
- 362
- 367
- 378
- 427
- 470
- 471
- 494
- 502
- 522
- 532
- 611
- 613
- 653
- 681
- 732
- 770
- 772
- 776
- 789
- 807
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
Prompt Preview
Apply these rules to JJWT 0.13 on the JVM. This pack includes Java 25. JJWT supplies JOSE and JWT processing; the application still owns the token profile, OAuth/OIDC transaction, local session, and resource authorization.
Parser policy and token verification
- Build a dedicated immutable
JwtParserfor each token purpose and trusted issuer policy, then reuse it with thread-safe key locators. Keep parser and issuance builders out of shared request state; never weaken a shared parser to handle one exceptional token. - Select the typed parse method for the expected format:
parseSignedClaimsfor signed JWT claims,parseSignedContentfor signed bytes, or the corresponding encrypted method for an explicit JWE profile. Genericparse,isSigned, header decoding, and shape checks do not establish the application's expected token type. - Keep
unsecured()andunsecuredDecompression()disabled for authentication and authorization inputs. Do not recover from a verification failure by reparsing an unsecured token, dropping its signature, or using claims exposed byExpiredJwtException. - Restrict
sig()to the actual permitted algorithms: for example,.sig().clear().add(Jwts.SIG.RS256).and()for an RS256 profile. Adding one algorithm without clearing the default collection does not create an allowlist. Clearenc()andkey()when the parser does not accept JWE. - Use
verifyWith(SecretKey)for the profile's HMAC key orverifyWith(PublicKey)for asymmetric verification. Replace ambiguous deprecated string/bytesetSigningKeyusage with typed keys; never