chronograf/etc/oauth2-server-mock
dependabot[bot] 37d3cbbdf4
chore(deps): bump express in /etc/oauth2-server-mock
Bumps [express](https://github.com/expressjs/express) from 4.17.3 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.3...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-28 01:17:57 +00:00
..
src chore(oauth-mock): remove async from before function 2022-06-06 09:14:49 +02:00
README.md chore: OAuth2 Server mock remove License and package-lock, adjust README 2022-05-09 15:55:38 +02:00
env.sh chore: add Oauth2 mock server 2022-05-09 15:55:37 +02:00
oauth-for-chronograf.sh chore: adjust comment 2022-05-09 15:55:38 +02:00
package.json chore(deps): bump express in /etc/oauth2-server-mock 2024-03-28 01:17:57 +00:00
yarn.lock chore(deps): bump express in /etc/oauth2-server-mock 2024-03-28 01:17:57 +00:00

README.md

oauth2-server-mock

This repository contains a mock OAuth2 Authorization Server with Authorization Code Grant flow and OpenID UserInfo endpoint. It is primarily intended for testing, it always authorizes a pre-configured user that can be changed at runtime.

Install

Prerequisites: node.js 14 or newer

Install required dependencies using your favorite package manager yarn:

yarn

Configure

Modify ./env.sh and run source env.sh to setup initial configuration of the OAuth2 Mock Server.

Start

yarn start

Initial configuration is printed to console as well as the URL where the server is listening for requests.

Chronograf Setup

Chronograf can use this OAuth2 Mock server as a generic OAuth2 authentication provider, several environment variables must be set before starting chronograf. These variables are shown in ./oauth-for-chronograf.sh.

Change OAuth2 redirect or authorized user at runtime

The running OAuth2 Mock server exposes a simple UI that let you change name/email of the authorized user, and a redirect URL after authorization. This page is by default accessible at http://localhost:8087/ .

Alternatively a simple HTTP POST message can be sent to change the config:

curl -X POST http://localhost:8087/config -H 'Content-Type: application/json' -d '{
  "redirect_uri": "http://whatever.you.like/callback",
  "userinfo": { "name": "fred doe", "email": "fred.doe@fake.net" }
}'