Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ADR 0005: Authentication & Authorization Model

Context

As Kroki-rs moves towards production deployments, the server needs authentication to prevent unauthorized use. Use cases range from local development (no auth needed) to multi-tenant SaaS (OAuth with per-user rate limits). The design must accommodate this full spectrum without adding complexity for simple deployments.

Decision

Two-Tier Authentication

1. API User Auth (protecting /serve endpoints):

2. Admin Auth (protecting admin dashboard on port 8081):

Dev Mode

When server.auth.enabled = false (the default), all authentication is completely bypassed. This enables fast local debugging without any token management. Rate limiting is also independently toggleable.

Configuration

[server.auth]
enabled = false
api_keys = [
  { key = "prod-key-abc123", label = "production", rate_limit = 100 },
  { key = "demo-key-xyz", label = "demo", rate_limit = 5 },
]
header_name = "X-API-Key"

[server.auth.oauth]
enabled = false
issuer_url = ""
client_id = ""

[server.admin_auth]
enabled = false
password_hash = ""
oauth_admin_emails = []

Consequences