Package org.apache.juneau.rest.server.auth.jwt
package org.apache.juneau.rest.server.auth.jwt
JWT bearer-token validation backed by
com.nimbusds:nimbus-jose-jwt.
This is the optional companion to BearerTokenGuard in
juneau-rest-server. Adding this module to a service's classpath lets the bearer guard
delegate to JwtTokenValidator for full JWT validation
(signature, iss, aud, exp, nbf) without bringing the
nimbus library into the core juneau-rest-server jar.
Containment
The nimbus-jose-jwt dependency is declared in provided scope on this module's
POM. Consumers that want JWT validation must add nimbus-jose-jwt themselves at the
version of their choice. This way:
- The core
juneau-rest-serverjar stays JWT-free. - Services that never use JWT pay zero classpath cost.
- Services that DO use JWT pick their own nimbus version (security upgrades, CVE patches) without waiting for a Juneau release.
Security defaults
JwtTokenValidator ships with secure defaults:
alg: noneis permanently rejected — there is no opt-in.HS256is rejected unless explicitly allowlisted viaalgorithms(...). Mixing HMAC and asymmetric keys in the same validator is intentionally prevented.iss,aud,exp,nbfare mandatory by default. A token missing any of these is rejected.- Clock-skew tolerance defaults to
60sand is capped at300sby the builder. - JWKS keys are cached for 5 minutes. Cache continues to serve stale keys when the JWKS endpoint is unreachable, logging a warning, so a transient network blip doesn't take down auth for the whole service.
See Also:
- Since:
- 10.0.0
-
ClassesClassDescription
TokenValidatorthat validates signed JWTs against a JWKS-backed key source.Builder class forJwtTokenValidator.