Skip to main content

JWT Verifiers

JWT verifiers allow you to validate, sign, and transform JWT tokens on incoming requests. A verifier can be defined globally and referenced by multiple routes, or configured locally on a specific route.

UI page

You can find all JWT verifiers here

Properties

PropertyTypeDefaultDescription
idstringUnique identifier
namestringDisplay name
descriptionstringDescription
strictbooleantrueIf not strict, requests without a JWT token are allowed through. Useful to enforce token presence
tagsarray of string[]Tags
metadataobject{}Key/value metadata
sourceobjectWhere to find the token in incoming requests (see below)
algoSettingsobjectAlgorithm settings for token validation (see below)
strategyobjectVerification strategy (see below)

Each JWT verifier is configured in three steps:

  1. Location: Where to find the token in incoming requests
  2. Validation: How to validate the token signature
  3. Strategy: What to do with the token (pass-through, re-sign, transform)

Token location

An incoming token can be found in three places:

In a query string parameter

PropertyTypeDescription
typestringInQueryParam
namestringName of the query parameter containing the JWT

In a header

PropertyTypeDescription
typestringInHeader
namestringName of the header containing the JWT
removestringPrefix to remove from the header value (e.g., Bearer - note the trailing space)
PropertyTypeDescription
typestringInCookie
namestringName of the cookie containing the JWT

Token validation

The validation step defines the algorithm used to verify the token signature.

HMAC + SHA

PropertyTypeDescription
typestringHSAlgoSettings
sizenumberSHA size: 256, 384, or 512
secretstringHMAC secret key
base64booleanWhether the secret is base64-encoded

RSA + SHA

PropertyTypeDescription
typestringRSAlgoSettings
sizenumberSHA size: 256, 384, or 512
publicKeystringRSA public key (PEM)
privateKeystringRSA private key (PEM, optional - only needed for signing)

ECDSA + SHA

PropertyTypeDescription
typestringESAlgoSettings
sizenumberSHA size: 256, 384, or 512
publicKeystringECDSA public key (PEM)
privateKeystringECDSA private key (PEM, optional)

RSA from KeyPair

PropertyTypeDescription
typestringRSAKPAlgoSettings
sizenumberSHA size
certIdstringID of the key pair certificate registered in Otoroshi

ECDSA from KeyPair

PropertyTypeDescription
typestringESKPAlgoSettings
sizenumberSHA size
certIdstringID of the key pair certificate registered in Otoroshi

Otoroshi KeyPair from token kid (verification only)

PropertyTypeDescription
typestringKidAlgoSettings
onlyExposedCertsbooleanOnly use key pairs exposed on /.well-known/jwks.json. If disabled, searches all registered key pairs

JWK Set (verification only)

PropertyTypeDescription
typestringJWKSAlgoSettings
urlstringJWKS endpoint URL
timeoutnumberHTTP call timeout (ms)
ttlnumberCache TTL for the keyset (ms)
headersobjectHTTP headers for the JWKS request
ktystringKey type to search for in the JWKS
mtlsConfigobjectCustom TLS settings for JWKS fetching
proxyobjectProxy settings (host, port, principal, password)

Strategy

The strategy defines what happens to the token after validation. Otoroshi supports 4 strategies:

Default JWT token

Adds a default token if none is present in the request.

PropertyTypeDescription
typestringDefaultToken
strictbooleanIf true and a token is already present, the call will fail
defaultValueobjectClaims for the generated token. Supports expression language

Pass-through (verify only)

Verifies the token signature and claim values but does not modify it.

PropertyTypeDescription
typestringPassThrough
verificationSettings.fieldsobjectToken fields to verify (key-value pairs)
verificationSettings.arrayFieldsobjectArray fields to verify (check if value is contained in array)

The verificationSettings.fields values support the following validation expressions:

  • Regex(pattern) - Match against a regex
  • Wildcard(pattern) - Match with wildcards
  • WildcardNot(pattern) - Must not match wildcards
  • Contains(value) - Must contain value
  • ContainsNot(value) - Must not contain value
  • Not(value) - Must not equal value
  • ContainedIn(a, b, c) - Must be one of the listed values
  • NotContainedIn(a, b, c) - Must not be one of the listed values
  • ContainsOneOf(a, b) - Array must contain at least one of the values
  • ContainsNotOneOf(a, b) - Array must not contain any of the values
  • ContainsAll(a, b) - Array must contain all of the values
  • ContainsNotAll(a, b) - Array must not contain all of the values

These fields also support the expression language.

Verify and re-sign

Verifies the token and re-signs it with a different algorithm/key.

PropertyTypeDescription
typestringSign
verificationSettingsobjectSame as pass-through verification
algoSettingsobjectAlgorithm settings for re-signing (same format as token validation)

Verify, re-sign and transform

Verifies the token, re-signs it, and transforms its content.

PropertyTypeDescription
typestringTransform
verificationSettingsobjectSame as pass-through verification
algoSettingsobjectAlgorithm settings for re-signing
transformSettings.locationobjectWhere to place the transformed token
transformSettings.mappingSettings.mapobjectRename token fields (old name -> new name)
transformSettings.mappingSettings.valuesobjectAdd new fields with static or dynamic values
transformSettings.mappingSettings.removearray of stringFields to remove from the token

JSON example

{
"id": "jwt_verifier_auth0",
"name": "Auth0 JWT verifier",
"description": "Verify tokens issued by Auth0",
"strict": true,
"tags": ["auth"],
"metadata": {},
"source": {
"type": "InHeader",
"name": "Authorization",
"remove": "Bearer "
},
"algoSettings": {
"type": "JWKSAlgoSettings",
"url": "https://my-tenant.auth0.com/.well-known/jwks.json",
"timeout": 5000,
"ttl": 3600000,
"headers": {},
"kty": "RSA"
},
"strategy": {
"type": "PassThrough",
"verificationSettings": {
"fields": {
"iss": "https://my-tenant.auth0.com/"
},
"arrayFields": {}
}
}
}

Admin API

GET    /api/verifiers           # List all JWT verifiers
POST /api/verifiers # Create a JWT verifier
GET /api/verifiers/:id # Get a JWT verifier
PUT /api/verifiers/:id # Update a JWT verifier
DELETE /api/verifiers/:id # Delete a JWT verifier
PATCH /api/verifiers/:id # Partially update a JWT verifier
  • Routes - Routes can use JWT verifiers via the JwtVerification plugin
  • Certificates - Key pairs used for token signing/verification
  • Auth Modules - OAuth2/OIDC modules use JWT verifiers for token validation