Parameters
See plugin common configurations for configuration options available to all plugins.
Credentials
The following are plugin attributes available for configurations on credentials.
key
vaild vaule:
non-empty
A unique key that identifies the credential for a consumer.
secret
vaild vaule:
non-empty
Shared key used to sign and verify the JWT when the algorithm is symmetric. Required when using
HS256,HS384, orHS512as the algorithm.The secret is encrypted with AES before being stored in etcd. You can also store it in an environment variable and reference it using the
env://prefix, or in a secret manager such as HashiCorp Vault's KV secrets engine, and reference it using thesecret://prefix. For more information, see secrets.public_key
RSA or ECDSA public key. Required if the
algorithmisRS256,ES256,RS384,RS512,ES256,ES384,ES512,PS256,PS384,PS512, orEdDSA.algorithm
vaild vaule:
HS256,HS384,HS512,RS256,RS384,RS512,ES256,ES384,ES512,PS256,PS384,PS512,EdDSAAlgorithm used to sign and verify the token. The
algvalue in the JWT header must exactly match this configured value; a mismatch is rejected with401 Unauthorized.exp
vaild vaule:
greater than or equal to 1
Expiry time of the token in seconds.
If you are not using APISIX to sign the JWT, this parameter is ignored and you should specify the expiration in the payload when signing the JWT.
base64_secret
Set to true if the secret is base64 encoded.
lifetime_grace_period
vaild vaule:
greater than or equal to 0
Grace period in seconds. Used to account for clock skew between the server generating the JWT and the server validating the JWT.
Routes or Services
The following are plugin attributes available for configurations on routes or services.
header
The header to get the token from.
query
The query string to get the token from. Lower priority than header.
cookie
The cookie to get the token from. Lower priority than query.
hide_credentials
If true, do not pass the header, query, or cookie with JWT to upstream services.
anonymous_consumer
Anonymous consumer name. If configured, allow anonymous users to bypass the authentication. See Rate Limit with Anonymous Consumer for more details.
claims_to_verify
vaild vaule:
combination of
expandnbfClaims used to verify that the token is within its allowed time window.
A nonempty list makes every listed claim required. A token missing a configured claim is rejected.
When this option is unset or empty,
expandnbfare validated whenever they are present, but neither claim is required.These validation rules were introduced in API7 Enterprise 3.9.14 and 3.10.1, and in APISIX 3.17.0.
key_claim_name
The claim in the JWT payload that identifies the associated secret, such as
iss.store_in_ctx
If true, store JWT payload in the request context variable
ctx.jwt_auth_payload. This allows plugins executed afterjwt-authon the same request to retrieve and use the payload information. For instance, to retrieve the key in the payload, you can usectx.jwt_auth_payload.key.Supported in APISIX and from Enterprise 3.8.9.
realm
Realm in the
WWW-Authenticateresponse header returned with a401 Unauthorizedresponse due to authentication failure. For example:If
realmis set tojwt-auth, the 401 response will include the following header:WWW-Authenticate: Bearer realm="jwt-auth"If
realmis not configured, the 401 response will include the following header:WWW-Authenticate: Bearer realm="jwt"
This parameter is available in API7 Enterprise version 3.9.2 and later, and in Apache APISIX version 3.15.0 and later.