Adapted from RPC-based plugins in Go by Eli Bendersky and go-plugin examples 🚀
This repo contains Funnel Plugin development using the go-plugin
package from HashiCorp.
In this setup, the Plugin handles all user authentication, with the Server having no "knowledge" or record of user credentials/tokens (e.g. example-users.csv
).
➜ git clone https://github.com/ohsu-comp-bio/funnel-plugins
➜ cd funnle-plugins
➜ make
Building ./server...OK
➜ ./server
Listening on http://localhost:8080
In another terminal, send the request using of the examples below —
Required Inputs ⚙️
Input | Sent in... | Example |
---|---|---|
User | Authorization Header | Authorization: Bearer Alyssa P. Hacker |
Task | Request Body | @example-tasks/hello-world.json |
Example Users ⚙️
All "Authorized" users may be found in the "User Database" — example-users.csv
:
- Alyssa P. Hacker, a Lisp hacker
- Ben Bitdiddle
- Cy D. Fect, a "reformed C programmer"
- Eva Lu Ator
- Lem E. Tweakit
- Louis Reasoner, a loose reasoner
Here the use of a simple text file to contain users is to show how a plugin can be written and integrated into Funnel — real world use cases might involve more complex mechanisms for tracking users (e.g OAuth)...
Here we send a request to authenticate a user named 'Alyssa P. Hacker' who is an Authorized
user:
➜ curl --header "Authorization: Bearer Alyssa P. Hacker" \
--data @example-tasks/hello-world.json \
http://localhost:8080
Response: {Alyssa P. Hacker <Alyssa's Secret>} ✅
Here's an example of attempting to authenticate a user named 'Foo', representing an Unauthorized
user:
➜ curl --header "Authorization: Bearer Foo" \
--data @example-tasks/hello-world.json \
http://localhost:8080
Error: User Foo not found ❌
- Add steps/docs for writing additional custom plugins to integrate with Funnel...
- Add sequence diagram of Server/Plugin interactions
- Add real world use case example/docs