mock-oidc¶
mock-oidc is a standalone, container-first mock OIDC/OAuth2 authorization
server for testing only. It mints real, cryptographically-signed tokens for
arbitrary identities, so a test suite can drive a full sign-in against an
unmodified OAuth2/OIDC client with no real identity provider. It is a Go
reimplementation of navikt/mock-oauth2-server,
is DB-less, and boots with zero configuration.
For testing only
mock-oidc signs a token for any identity on request and never validates client secrets. It must never front production traffic; the server logs a "FOR TESTING ONLY" banner on every startup.
30 seconds to a token¶
The server needs no configuration. Run the published container, read discovery
for the zero-config default issuer, and mint an access token:
docker run --rm -p 8080:8080 ghcr.io/meigma/mock-oidc
# Discovery for the "default" issuer (materializes on first touch)
curl -sS http://localhost:8080/default/.well-known/openid-configuration
# => {"issuer":"http://localhost:8080/default", ...}
# client_credentials grant — client secrets are never validated
curl -sS -X POST http://localhost:8080/default/token \
-d grant_type=client_credentials \
-d client_id=test-client \
-d scope=api
# => {"token_type":"Bearer","access_token":"eyJ...","expires_in":3600, ...}
Find your way¶
This site follows the Diátaxis framework. Pick the section that matches what you need right now.
-
Learning the tool — Start with the tutorial, Your first mock sign-in, a guided end-to-end run.
-
Getting a specific task done — The how-to guides are goal-oriented recipes: get tokens for every grant, drive the authorization-code flow, shape token claims, simulate expiry and time, capture and assert requests, use multiple issuers, serve over TLS, run behind a proxy or in Docker, lock down the control plane, migrate from mock-oauth2-server, and verify released artifacts.
-
Looking something up — The reference pages describe the software exactly: Configuration, Tokens and claims, Control plane (
/_mock), CLI, Observability, and the API Reference. -
Understanding why — The explanation pages cover design and rationale: the security model, issuers and advertised identity, parity with mock-oauth2-server, and architecture and distribution.
Support and security¶
- Contributions and issues: CONTRIBUTING.md
- Security reports: SECURITY.md