tiny-auth
OAuth 2.0 and OpenID Connect (OIDC) authorization server. Suitable for development and testing.
1.4K
A self-contained OAuth 2.0 and OpenID Connect (OIDC) authorization server. It supports both machine-to-machine and user login flows, issues RS256-signed JWTs, and manages clients and users entirely in memory with optional seeding on startup. It is designed to be lightweight and easy to run locally or in a container, making it well suited for development and testing.
| Description | Path | Method |
|---|---|---|
| Client Credential and Authorization Code token request | /oauth/token | POST |
| Authorization Code Flow initiation | /authorize | GET |
| User authentication (login) | /authenticate | POST |
| JWKS | /.well-known/jwks.json | GET |
| OpenID Connect discovery | /.well-known/openid-configuration | GET |
Requires a Bearer token with the client:read or client:write scope as appropriate. Use the
admin client credentials to obtain a token with those scopes.
| Description | Path | Method |
|---|---|---|
| List clients | /clients | GET |
| Create client | /clients | POST |
| Delete client | /clients/{client_id} | DELETE |
| Update client | /clients/{client_id} | PATCH |
Requires a Bearer token with the user:read or user:write scope as appropriate.
| Description | Path | Method |
|---|---|---|
| List users | /users | GET |
| Create user | /users | POST |
| Delete user | /users/{username} | DELETE |
| Update user | /users/{username} | PATCH |
| Description | Path | Method |
|---|---|---|
| Health check | /actuator/health | GET |
| List metric names | /actuator/metrics | GET |
| Get metric by name | /actuator/metrics/{metric_name} | GET |
The application is configured via CLI flags or environment variables. All flags have a corresponding environment variable name in uppercase with underscores.
| Flag | Environment Variable | Default | Description |
|---|---|---|---|
--log-level | LOG_LEVEL | INFO | Log verbosity level |
--port | PORT | 8080 | Port to listen on |
--hostname | HOSTNAME | http://localhost:8080 | Public-facing base URL of the server |
--admin-client-id | ADMIN_CLIENT_ID | (required) | Admin client ID |
--admin-client-secret | ADMIN_CLIENT_SECRET | (required) | Admin client secret |
--issuer | ISSUER | http://localhost:8080 | Value used in the JWT iss claim |
--seed-file | SEED_FILE | (optional) | Path to a YAML seed file |
A .env file in the working directory is loaded automatically if present.
On startup, an admin client and a corresponding admin user are created automatically using the
--admin-client-id and --admin-client-secret values. The admin client is granted the scopes
client:read, client:write, user:read, and user:write, and its audience is set to
<hostname>/admin. The admin client and user are protected and cannot be deleted via the API.
A seed file can be provided to pre-populate clients and users when the application starts. The file must be in YAML format:
clients:
workflow:
secret: workflow1
scope: some:scope
audience:
- something
users:
ben:
password: ben1
name: Ben
email: [email protected]
picture: https://www.gravatar.com/avatar
permissions:
- client:read
The application serves a small web interface at the following paths:
| Path | Description |
|---|---|
/admin.html | Administration page for managing clients and users |
/login.html | Login page used during the Authorization Code Flow |
RSA key pairs are generated fresh on every startup using a 2048-bit key. All tokens are signed with RS256.
services:
tiny-auth:
container_name: tiny-auth
image: bytepeddlerllc/tiny-auth:latest
environment:
ADMIN_CLIENT_ID: admin
ADMIN_CLIENT_SECRET: 123
HOSTNAME: http://localhost:8080
ISSUER: http://localhost:8080
LOG_LEVEL: debug
SEED_FILE: /tmp/seed.yaml
ports:
- "8080:8080"
configs:
- source: seed_data
target: /tmp/seed.yaml
configs:
seed_data:
content: |
clients:
workflow:
secret: workflow1
scope: some:scope
audience:
- something
users:
ben:
password: ben1
name: Ben
email: [email protected]
picture: https://www.gravatar.com/avatar
permissions:
- client:read
LLMs were used to aid the development of this project in the following areas:
Content type
Image
Digest
sha256:54226cb77…
Size
6.4 MB
Last updated
11 days ago
docker pull bytepeddlerllc/tiny-auth