Skip to content

Latest commit

 

History

History
95 lines (63 loc) · 3.44 KB

README.md

File metadata and controls

95 lines (63 loc) · 3.44 KB

Go Project license Coded with love by ohsu-comp-bio

Overview ⚙️

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).

Quick Start ⚡

1. Start the Server

git clone https://github.com/ohsu-comp-bio/funnel-pluginscd funnle-pluginsmake
Building ./server...OK./server
Listening on http://localhost:8080

2. Send Requests

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)...

Example: Authorized User

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>} ✅

Example: Unauthorized User

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 ❌

Next Steps 🚧

  • 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

Additional Resources 📚