package
0.0.0-20230502073429-587acefb9ced
Repository: https://github.com/ayh20/flogo-components.git
Documentation: pkg.go.dev

# README

JWT Utilities

This activity allows you to create or validate a JWT token

See the activity_test.go for examples of the required parameters

Installation

Navigate to your Flogo app directory and enter the following command

flogo install github.com/ayh20/flogo-components/activity/jwt

Schema

Inputs and Outputs:

{
  "inputs":[
    {
      "name": "token",
      "type": "string"
    },
    {
      "name": "header",
      "type": "string"
    },
    {
      "name": "payload",
      "type": "string"
    },
    {
      "name": "secret",
      "type": "string"
    },
    {
      "name": "mode",
      "required": true,
      "type": "string",
      "allowed" : ["Verify", "Sign", "Decrypt"]
    },
    {
      "name": "algorithm",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "name": "token",
      "type": "string"
    },
     {
      "name": "valid",
      "type": "bool"
    }
  ]
}

Settings Mode

SettingDescription
modeVerify or Sign

Settings Verify

SettingDescription
algorithmThe algorithm name ie HS256, ES512, RS256 etc
secretThe encryption key (HS*) or public key
tokenThe token to be validated

Settings Sign

SettingDescription
algorithmThe algorithm name ie HS256, ES512, RS256 etc
secretThe encryption key (HS*) or private key (PEM)
headerThe json header (used to validate the request)
payloadThe claims string

Outputs

OutputDescription
validBool result for Verify operation
tokenThe token string for Sign operations

Configuration Examples

Simple

Configure a task to verify or create a JWT:

# Functions

NewActivity creates a new AppActivity.

# Structs

JWT is an Activity that works with JWT Tokens It can create, verify and decrypt JWT tokens inputs : {input1, input2, datatype, comparemode} outputs: result (bool).