@@ -20591,52 +20591,78 @@ jwt_payload_query([<json_path>[,<output_type>]])
2059120591 compiled with USE_OPENSSL.
2059220592
2059320593jwt_verify(<alg>,<key>)
20594- Performs a signature verification for the JSON Web Token (JWT) given in input
20595- by using the <alg> algorithm and the <key> parameter, which should either
20596- hold a secret, a path to a public key or a path to a public certificate. When
20597- using a public key, it should either be in the PKCS#1 format (for RSA keys,
20598- starting with BEGIN RSA PUBLIC KEY) or SPKI format (Subject Public Key Info,
20599- starting with BEGIN PUBLIC KEY). Certificates should be a regular PEM
20600- certificate (starting with BEGIN CERTIFICATE). If a full-on certificate is
20601- used, it can either be used directly in the converter or passed via a
20602- variable if it was already known by haproxy (previously loaded in a crt-store
20603- for instance).
20604- Returns 1 in case of verification success, 0 in case of verification failure
20605- and a strictly negative value for any other error. Because of all those
20606- non-null error return values, the result of this converter should never be
20607- converted to a boolean. See below for a full list of the possible return
20608- values.
2060920594
20595+ Performs a signature verification for the JSON Web Token (JWT) given in input
20596+ by using the <alg> algorithm and the <key> parameter.
2061020597 For now, only JWS tokens using the Compact Serialization format can be
20611- processed (three dot-separated base64-url encoded strings). All the
20612- algorithms mentioned in section 3.1 of RFC7518 are managed (HS, ES, RS and PS
20613- with the 256, 384 or 512 key sizes, as well as the special "none" case).
20614-
20615- If the used algorithm is of the HMAC family, <key> should be the secret used
20616- in the HMAC signature calculation. Otherwise, <key> should be the path to the
20617- public key or certificate that can be used to validate the token's signature.
20618- All the public keys and certificates that might be used to verify JWTs must
20619- be known during init in order to be added into a dedicated cache so that no
20620- disk access is required during runtime. For this reason, any used public key
20621- must be mentioned explicitly at least once in a jwt_verify call and every
20622- certificate used must be loaded by haproxy (in a crt-store or mentioned
20623- explicitly in a 'jwt_verify' call). Passing a variable as second parameter is
20624- then not advised unless you only use certificates that fill one of those
20625- prerequisites.
20626-
20598+ processed (three dot-separated base64-url encoded strings).
2062720599 This converter only verifies the signature of the token and does not perform
2062820600 a full JWT validation as specified in section 7.2 of RFC7519. We do not
2062920601 ensure that the header and payload contents are fully valid JSONs once
2063020602 decoded for instance, and no checks are performed regarding their respective
2063120603 contents.
2063220604
20605+ - <alg> can be either a string or a variable name (See also "set-var") that
20606+ holds the name of the algorithm used to verify.
20607+
20608+ Algorithms mentioned in section 3.1 of RFC7518 are managed:
20609+
20610+ +--------------+---------------------------------------------------------+
20611+ | "alg" Param | Digital Signature or MAC Algorithm |
20612+ | Value | |
20613+ +--------------+---------------------------------------------------------+
20614+ | HS256 | HMAC using SHA-256 |
20615+ | HS384 | HMAC using SHA-384 |
20616+ | HS512 | HMAC using SHA-512 |
20617+ | RS256 | RSASSA-PKCS1-v1_5 using SHA-256 |
20618+ | RS384 | RSASSA-PKCS1-v1_5 using SHA-384 |
20619+ | RS512 | RSASSA-PKCS1-v1_5 using SHA-512 |
20620+ | ES256 | ECDSA using P-256 and SHA-256 |
20621+ | ES384 | ECDSA using P-384 and SHA-384 |
20622+ | ES512 | ECDSA using P-521 and SHA-512 |
20623+ | PS256 | RSASSA-PSS using SHA-256 and MGF1 with SHA-256 |
20624+ | PS384 | RSASSA-PSS using SHA-384 and MGF1 with SHA-384 |
20625+ | PS512 | RSASSA-PSS using SHA-512 and MGF1 with SHA-512 |
20626+ | none | No digital signature or MAC performed |
20627+ +--------------+---------------------------------------------------------+
20628+
20629+ - <key> can be either a string or a variable name (See also "set-var") that
20630+ holds a secret, a public key path or a certificate path.
20631+
20632+ Secrets are only applicable when using HMAC algorithms.
20633+
20634+ Public keys must be in either the PKCS#1 format (for RSA keys, starting
20635+ with BEGIN RSA PUBLIC KEY) or SPKI format (Subject Public Key Info,
20636+ starting with BEGIN PUBLIC KEY). Public keys must be available during the
20637+ configuration parsing and cannot be updated or loaded at runtime unlike
20638+ certificates.
20639+
20640+ Certificates must be standard PEM certificates (starting with BEGIN
20641+ CERTIFICATE). When using a certificate its path can be passed directly to
20642+ the converter or referenced via a variable. Certificates can be either
20643+ declared in a crt-store, or dynamically loaded via the stats socket.
20644+
20645+ All the public keys and certificates that might be used to verify JWTs must
20646+ be known during init in order to be added into a dedicated cache so that no
20647+ disk access is required during runtime.
20648+
20649+ It is possible to update certificates dynamically and add new certificates
20650+ using the stats socket. See also "set ssl cert" and "new ssl cert" in the
20651+ management guide.
20652+
20653+ Returns 1 in case of verification success, 0 in case of verification failure
20654+ and a strictly negative value for any other error. Because of all those
20655+ non-null error return values, the result of this converter should never be
20656+ converted to a boolean. See below for a full list of the possible return
20657+ values.
20658+
2063320659 The possible return values are the following :
2063420660
2063520661 +----+----------------------------------------------------------------------+
2063620662 | ID | message |
2063720663 +----+----------------------------------------------------------------------+
20638- | 0 | "Verification failure" |
2063920664 | 1 | "Verification success" |
20665+ | 0 | "Verification failure" |
2064020666 | -1 | "Unknown algorithm (not mentioned in RFC7518)" |
2064120667 | -2 | "Unmanaged algorithm" |
2064220668 | -3 | "Invalid token" |
0 commit comments