When a client has been authenticated, the plugin appends the following headers to the request before proxying it to the upstream API/microservice.
Use these headers to identify the Consumer in your code:
-
X-Consumer-ID, the ID of the Consumer on Kong Gateway (if matched)
-
X-Consumer-Custom-ID, the custom_id of the Consumer (if matched and if existing)
-
X-Consumer-Username, the username of the Consumer (if matched and if existing)
-
X-Anonymous-Consumer, set to true if authentication fails, and the anonymous Consumer is set instead.
-
X-Credential-Scope, as returned by the Introspection response (if any)
-
X-Credential-Client-ID, as returned by the Introspection response (if any)
-
X-Credential-Identifier, as returned by the Introspection response (if any)
-
X-Credential-Token-Type, as returned by the Introspection response (if any)
-
X-Credential-Exp, as returned by the Introspection response (if any)
-
X-Credential-Iat, as returned by the Introspection response (if any)
-
X-Credential-Nbf, as returned by the Introspection response (if any)
-
X-Credential-Sub, as returned by the Introspection response (if any)
-
X-Credential-Aud, as returned by the Introspection response (if any)
-
X-Credential-Iss, as returned by the Introspection response (if any)
-
X-Credential-Jti, as returned by the Introspection response (if any)
Additionally, any claims specified in config.custom_claims_forward are also forwarded with the X-Credential- prefix.
Note: If authentication fails, the plugin doesn’t set any X-Credential-* headers.
It appends X-Anonymous-Consumer: true and sets the anonymous Consumer instead.