# README

Gateway using Default Channel Pattern

This recipe is a gateway using the default channel pattern which uses JWT.

Channel Activity

NameTypeDescription
channelstringThe channel to put the value on
valuestringThe value to put on channel

JWT

NameTypeDescription
tokenstringThe raw token
keystringThe key used to sign the token
signingMethodstringThe signing method used (HMAC, ECDSA, RSA, RSAPSS)
issuerstringThe 'iss' standard claim to match against
subjectstringThe 'sub' standard claim to match against
audiencestringThe 'aud' standard claim to match against

Installation

  • Install Go

Setup

git clone https://github.com/project-flogo/microgateway
cd microgateway/examples/api/default-http-pattern

Testing

Start the gateway:

go run main.go

Request is successful

Run the following command:

curl --request GET http://localhost:9096/endpoint -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNYXNobGluZyIsImlhdCI6MTU0NDEzMTYxOCwiZXhwIjoxNTc1NjY3NjE4LCJhdWQiOiJ3d3cubWFzaGxpbmcuaW8iLCJzdWIiOiJ0ZW1wdXNlckBtYWlsLmNvbSJ9.wgunWSIJqieRKsmObATT2VEHMMzkKte6amuUlhc1oKs"

You should see:

{"response":"Success!"}

On the server screen, you get 200 response code and log service outputs "Output: Test log message service invoked"

JWT token is invalid

Run the following command:

curl --request GET http://localhost:9096/endpoint -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNYXNobGluZyIsImlhdCI6MTU0NDEzMTYxOCwiZXhwIjoxNTc1NjY3NjE4LCJhdWQiOiJ3d3cubWFzaGxpbmcuaW8iLCJzdWIiOiJ0ZW1wdXNlckBtYWlsLmNvbSJ9.wgunWSIJqieRKsmObATT2VEHMMzkKte6amuUlhc1oK"

You should see:

{"errorMessage":"","validationMessage":"signature is invalid"}