Sign JWT with Principal IDv3.16+

Sign an outgoing JWT in a request header using the authenticated Principal’s ID as the subject. This example assumes a Consumer is already authenticated before Datakit runs. This example contains the following nodes:

  1. The node GET_PRINCIPAL retrieves the currently authenticated Principal object.
  2. The node BUILD_CLAIMS uses jq to extract the Principal’s id and build a sub claim.
  3. The node SIGN_JWT signs a new JWT using an HMAC secret stored in Vault.
  4. The node BUILD_HEADER injects the signed token into an X-Consumer-JWT request header sent to the upstream service.

Prerequisites

Set up the plugin

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!