Sign inSign up

qlik/simple-oidc-provider

By qlik

Updated about 5 years ago

Simple OIDC provider for local-development of OpenID compatible applications

Image
8

500K+

qlik/simple-oidc-provider repository overview

simple-oidc-provider

Simple OIDC provider using https://github.com/panva/node-oidc-provider and heavily based on the examples from https://github.com/panva/node-oidc-provider-example

Usage:
docker run --rm -d -p 9000:9000 \
  -e "REDIRECTS=https://myapp/login/callback" \
  qlik/simple-oidc-provider
  • OpenID Configuration endpoint:
http://localhost:9000/.well-known/openid-configuration
Configuration
Default

The default configuration is the following:

  • The service will run on port 9000
  • A client with client_id foo and client_secret bar with allowed redirect http://localhost:9055/v1/authenticate/callback will be created
  • The following scope to claims mappings will be configured
    • openid: sub
    • email: email, email_verified
    • profile: name
Environment Variables

The simplest configuration can be accomplished using environment variables

VariableDescriptionDefault
REDIRECTSA comma separated string of the allowed callback urlshttp://localhost:9055/v1/authenticate/callback
PORTA value for the port to run the server on9000
PATH_PREFIXA value for the prefix to add for forms to POST to (e.g. "/oidc" will make the login form post to "/oidc/interaction/*")""
IDP_NAMEA value for the name/url of the IDPhttp://simple-oidc-provider
CONFIG_FILEA path to the configuration file (values overrides)
USERS_FILEA path to the custom users file

The rest of the configuration will be from the default configuration

Configuration File

A configuration file can be specified by setting the CONFIG_FILE environment variable to the path to the file. This configuration will be merged with the default config so that any none specified values will take on the default value.

Format
{
  "idp_name": "http://simple-oidc-provider",
  "port": 9000,
  "client_config": [
    {
      "client_id": "foo",
      "client_secret": "bar",
      "redirect_uris": [
        "http://localhost:9055/v1/authenticate/callback"
        ]
    }
  ],
  "claim_mapping": {
    "openid": [ "sub" ],
    "email": [ "email", "email_verified" ],
    "profile": [ "name", "nickname" ]
  }
}
Users
Users File

A users file can be specified by setting the USERS_FILE environment variable to the path to the file. The file must be formatted as a JSON array of objects representing users. The user objects must have an id property. The remaining fields consist of the claims which may be returned based on the scopes requested during the OIDC flow. The mapping of the claims to scopes is controlled by the configuration field claim_mapping.

Default

The default users are the following

[
  {
    id: 'SIMPLE_OIDC_USER_HARLEY',
    email: '[email protected]',
    email_verified: true,
    name: 'Harley Kiffe',
    nickname: 'harley',
    password: 'Password1!',
    groups: ['Everyone', 'Sales']
  },
  {
    id: 'SIMPLE_OIDC_USER_BARB',
    email: '[email protected]',
    email_verified: true,
    name: 'Barb Stovin',
    nickname: 'barb',
    password: 'Password1!',
    groups: ['Everyone', 'Support']
  },
  {
    id: 'SIMPLE_OIDC_USER_QUINN',
    email: '[email protected]',
    email_verified: true,
    name: 'Quinn Leeming',
    nickname: 'quinn',
    password: 'Password1!',
    groups: ['Everyone', 'Accounting']
  },
  {
    id: 'SIMPLE_OIDC_USER_SIM',
    email: '[email protected]',
    email_verified: true,
    name: 'Sim Cleaton',
    nickname: 'sim',
    password: 'Password1!',
    groups: ['Everyone', 'Accounting']
  },
  {
    id: 'SIMPLE_OIDC_USER_PHILLIE',
    email: '[email protected]',
    email_verified: true,
    name: 'Phillie Smeed',
    nickname: 'phillie',
    password: 'Password1!',
    groups: ['Everyone', 'Marketing', 'Sales']
  },
  {
    id: 'SIMPLE_OIDC_USER_PETA',
    email: '[email protected]',
    email_verified: true,
    name: 'Peta Sammon',
    nickname: 'peta',
    password: 'Password1!',
    groups: ['Everyone', 'Engineering']
  },
  {
    id: 'SIMPLE_OIDC_USER_MARNE',
    email: '[email protected]',
    email_verified: true,
    name: 'Marne Probetts',
    nickname: 'marne',
    password: 'Password1!',
    groups: ['Everyone', 'Marketing']
  },
  {
    id: 'SIMPLE_OIDC_USER_SIBYLLA',
    email: '[email protected]',
    email_verified: true,
    name: 'Sibylla Meadows',
    nickname: 'sibylla',
    password: 'Password1!',
    groups: ['Everyone', 'Accounting']
  },
  {
    id: 'SIMPLE_OIDC_USER_EVAN',
    email: '[email protected]',
    email_verified: true,
    name: 'Evan Highman',
    nickname: 'evan',
    password: 'Password1!',
    groups: ['Everyone', 'Engineering']
  },
  {
    id: 'SIMPLE_OIDC_USER_FRANKLIN',
    email: '[email protected]',
    email_verified: true,
    name: 'Franklin Glamart',
    nickname: 'franklin',
    password: 'Password1!',
    groups: ['Everyone', 'Sales']
  }
]
Deploy simple-oidc-provider to Heroku
Prerequisites

You will need the following:

Setup heroku CLI locally

The Heroku Command Line Interface (CLI) makes it easy to create and manage your Heroku apps directly from the terminal. Please follow this link for more information:

https://devcenter.heroku.com/articles/heroku-cli

Create a heroku app

You must first create an app in heroku.

  • Create the app and get its name:
export APP_NAME=$(heroku apps:create --json | jq -r '.name')
Configure container
  • Set trusted redirect URLs, these are comma separated.
heroku config:set REDIRECTS=https://myApp/login/callback --app $APP_NAME
Push simple-oidc-provider docker image to Heroku
  • Pull image from docker hub:
docker pull qlik/simple-oidc-provider
  • Login to heroku registry
heroku container:login
  • Tag image to be deployed to heroku
docker tag qlik/simple-oidc-provider:latest registry.heroku.com/$APP_NAME/web
  • Push the docker image to heroku, it will start automatically
docker push registry.heroku.com/$APP_NAME/web
  • Release the image for deployment:
heroku container:release web --app $APP_NAME
Get your deployment info
  • Get the discovery url:
echo https://$APP_NAME.herokuapp.com/.well-known/openid-configuration

Tag summary

Content type

Image

Digest

Size

51.4 MB

Last updated

about 5 years ago

docker pull qlik/simple-oidc-provider