default-channel-pattern

command
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: BSD-3-Clause Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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/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"}

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