JWT Generate - Advanced Use Case

The JWT Generate Snap allows users to issue limited scope tokens for internal users.

In the example pipeline below:



Download this Pipeline

Note:

You need to create, as described in Configuring JWT Accounts to use for this sample. Use the attached jwt-keystore.jks file to create one.

(The keystore was created using keytool for demo purposes. It contains one symmetric key with alias: jwt password: jwtpasswd)

jwt-keystore.jks

  1. The pipeline makes a REST Post to an internal endpoint with internal user credentials. The REST endpoint responds with JSON data associated with that user.
  2. A Mapper Snap is used to map fields that we want to embed in the token (user, dept, age in this example).




  3. JWT Generate Snap generates an access token that embeds this information in the token (using dept as "audience", "user" as the subject and "age" in custom metadata field).




  4. A Mapper is used to isolate the access token from the output document and return that access token.


  5. See the JWT Validate Snap documentation to see the output when this token is validated and decoded back.
To successfully reuse pipelines:
  1. Download and import the pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide pipeline parameters as applicable.