default-channel-pattern

command
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Gateway using Default Channel Pattern

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

Channel Activity

Name Type Description
channel string The channel to put the value on
value string The value to put on channel

JWT

Name Type Description
token string The raw token
key string The key used to sign the token
signingMethod string The signing method used (HMAC, ECDSA, RSA, RSAPSS)
issuer string The 'iss' standard claim to match against
subject string The 'sub' standard claim to match against
audience string The 'aud' standard claim to match against

Installation

  • Install Go

Setup

git clone https://github.com/AiRISTAFlowInc/fs-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"}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL