Skip to main content

Module jwt_auth

Module jwt_auth 

Source
Expand description

JWT authentication plugin (jwt-auth).

Validates HMAC-signed JWTs (HS256/HS384/HS512) taken from a configurable header, enforcing expiry, and exposes the verified claims to downstream nodes via context.message. Invalid or missing tokens are rejected with a 401 error routed through the node’s error port.

Two modes, usable together:

  • inline secret (secret set): every token is verified with one shared secret and algorithm, exactly as before.
  • consumer mode (use_consumers: true): the token’s key claim identifies a consumer; the token is then verified with that consumer’s jwt-auth: {key, secret, algorithm} credential and, on success, the consumer’s identity is attached to the request.

Structs§

JwtAuthPlugin
Authenticates requests by verifying a JWT signature and expiry (exp).

Functions§

parse_algorithm 🔒
Parses a supported HMAC algorithm name, defaulting to HS256 when absent.