JwtConfig

class JwtConfig

Configuration for the jwt strategy factory.

Configures JWT bearer-token authentication. decoder and keySource are required; other settings have defaults. Leave identityMapper unset to get the default Jwt identity, or set it to map verified tokens to your own domain identity. Roles always come from rolesMapper and land on io.github.mzlnk.javalin.security.authentication.Authentication.roles. Builds a JwtVerification and JwtAuthenticator for the returned strategy, and selects a BearerChallengeUnauthorizedHandler when bearerChallenge is true. Does not configure authorization rules — set those via security.rules.

Properties

Link copied to clipboard

When non-empty, requires the token's aud claim to contain at least one of these values.

Link copied to clipboard

When true, failed or absent authentication includes a WWW-Authenticate: Bearer header with the 401 response.

Link copied to clipboard

Maximum acceptable clock skew in seconds for exp and nbf validation.

Link copied to clipboard

The JwtDecoder used to verify and decode bearer tokens. Required.

Link copied to clipboard

Handler for access denied to an authenticated caller.

Link copied to clipboard
Link copied to clipboard

When set, requires the token's iss claim to match this value.

Link copied to clipboard

Where verification keys come from (local public key, PEM, HMAC secret, or JWKS). Required.

Link copied to clipboard

Realm attribute included in the WWW-Authenticate header when bearerChallenge is true.

Link copied to clipboard

Maps a verified DecodedJwt to the caller's io.javalin.security.RouteRoles.

Link copied to clipboard

Locates the raw token in the incoming request.