3

OAuth provider mapping functions

 1 year ago
source link: https://gist.github.com/disintegrator/0bd39879c437c4b3abb2779c661a6790
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Blob'o'auth

This is a miniature OAuth provider implemented in Benthos and Bloblang. It is designed to serve a single OAuth client app and will generate JWT access tokens with limited lifetime.

Features

  • Few lines of YAML and Bloblang (fun data transformation and mapping language).
  • Pometheus metrics come free - visit http://localhost:4195/metrics when running this config.
  • Small surface area - it serves one client and uses short-lived JWTs for bearer token-based auth.
  • It can be extended to support scopes by querying a policy service like OPA with a few more lines of code.

Usage

  • Install Benthos by following this guide
  • Clone this gist:
    git clone [email protected]:0bd39879c437c4b3abb2779c661a6790 bloboauth
    
  • Run the config with Benthos
    cd bloboauth
    benthos --env-file ./dotenv --config ./config.yml
    
  • Make an access token request against the running server
    curl \
      --verbose \
      --data 'client_id=sample-client&client_secret=not-enough-coffee&grant_type=client_credentials' \
      --header 'Content-Type: application/x-www-form-urlencoded' \
      http://localhost:3000/oauth/access-token
    
  • If all goes well you should get an access token in the response!

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK