Aller au contenu

Docker

Ce contenu n’est pas encore disponible dans votre langue.

Run stubIdP as a container using the provided Dockerfile or a pre-built image. The server listens on port 8484.

Terminal window
docker run --rm \
-p 8484:8484 \
-e STUBIDP_CLIENT_ID=web-app \
-e STUBIDP_CLIENT_SECRET=web-app-secret \
-e STUBIDP_REDIRECT_URI=http://localhost:8080/callback \
cerberauth/stubidp

Discovery URL: http://localhost:8484/.well-known/openid-configuration

  1. Clone the repository and build the image:

    Terminal window
    git clone https://github.com/cerberauth/stubidp.git
    cd stubidp
    docker build -t stubidp .
  2. Run the container:

    Terminal window
    docker run --rm \
    -p 8484:8484 \
    -e STUBIDP_REDIRECT_URI=http://localhost:8080/callback \
    stubidp

    STUBIDP_CLIENT_ID and STUBIDP_CLIENT_SECRET are optional. When omitted, a human-readable ID and a secure random secret are generated and printed in the startup log.

Add stubIdP as a service alongside your application:

services:
idp:
image: cerberauth/stubidp
ports:
- '8484:8484'
environment:
STUBIDP_CLIENT_ID: web-app
STUBIDP_CLIENT_SECRET: web-app-secret
STUBIDP_REDIRECT_URI: http://localhost:8080/callback
app:
build: .
ports:
- '8080:8080'
environment:
STUBIDP_ISSUER: http://idp:8484
STUBIDP_CLIENT_ID: web-app
STUBIDP_CLIENT_SECRET: web-app-secret
depends_on:
- idp

All configuration options are available as environment variables:

VariableDescription
STUBIDP_CLIENT_IDOAuth 2.0 client ID (auto-generated if omitted)
STUBIDP_CLIENT_SECRETOAuth 2.0 client secret (auto-generated if omitted)
STUBIDP_REDIRECT_URIAllowed redirect URI
STUBIDP_ISSUEROverride the issuer URL (defaults to http://localhost:8484)
STUBIDP_PORTHTTP port to listen on (default: 8484)
STUBIDP_DATABASE_DIALECTsqlite or postgres (default: in-memory)
STUBIDP_DATABASE_URLConnection string for SQLite or PostgreSQL

By default stubIdP uses an in-memory store that is wiped on restart. To persist sessions and tokens across restarts, mount a volume and use SQLite:

Terminal window
docker run --rm \
-p 8484:8484 \
-v $(pwd)/data:/data \
-e STUBIDP_REDIRECT_URI=http://localhost:8080/callback \
-e STUBIDP_DATABASE_DIALECT=sqlite \
-e STUBIDP_DATABASE_URL=/data/stubidp.db \
cerberauth/stubidp