The client is expected to send an Authorization or Proxy-Authorization header
with the following:
credentials := "hmac" params
params := keyId "," algorithm ", " headers ", " signature
keyId := "username" "=" plain-string
algorithm := "algorithm" "=" DQUOTE (hmac-sha224|hmac-sha256|hmac-sha384|hmac-sha512) DQUOTE
headers := "headers" "=" plain-string
signature := "signature" "=" plain-string
plain-string = DQUOTE *( %x20-21 / %x23-5B / %x5D-7E ) DQUOTE
The following table describes the signature authentication parameters:
|
Parameter
|
Description
|
username
|
Username of the credential
|
algorithm
|
Digital signature algorithm used to create the signature
|
headers
|
List of HTTP header names, separated by a single space character, used to sign the request
|
signature
|
Base64-encoded digital signature generated by the client
|
To generate the string that is signed with a key, the client
must take the values of each HTTP header specified by headers in
the order they appear.
-
If the header name is not request-line or @request-target, append the lowercase header name followed with an ASCII colon : and an ASCII space.
-
If the header name is request-line, append the HTTP request line (in ASCII format). We recommend using @request-target instead of request-line.
-
If the header name is @request-target, append the lowercase request method, followed by a ASCII space and the request URI including any query strings. Otherwise append the header value.
-
If value isn’t the last value, then append an ASCII newline \n. The string must not include a trailing ASCII newline.
The HMAC Auth plugin supports the following hash algorithms:
- HMAC-SHA224 v3.14+
- HMAC-SHA256
- HMAC-SHA384
- HMAC-SHA512
HMAC-SHA1 is also supported, but it is disabled by default, and is not available if running Kong Gateway in FIPS mode.
We recommend using a different algorithm if possible.