2.7 KiB
2.7 KiB
Runbook - Keycloak OIDC (Wave 2 Track 1)
Scope
This runbook covers the enterprise identity baseline introduced in Wave 2 Track 1:
- Keycloak-backed OIDC login
- signed application bearer tokens
- controlled fallback to local login
It is for QA and enterprise-like environments, not the default demo flow.
Modes
Local / demo
OIDC_ENABLED=0ALLOW_LEGACY_HEADER_AUTH=1
Use this when:
- running local demos
- using seeded local users
- preserving existing Stage 1-4 scripts
QA transition
OIDC_ENABLED=1ALLOW_LEGACY_HEADER_AUTH=1
Use this when:
- validating OIDC without breaking old header-based scripts
- checking dual-mode compatibility before cutover
Enterprise pilot
OIDC_ENABLED=1ALLOW_LEGACY_HEADER_AUTH=0
Use this when:
- OIDC is the primary login path
- bearer-token validation is enforced end-to-end
Required configuration
APP_TOKEN_SECRETAPP_TOKEN_TTL_SECONDS(default3600)OIDC_ENABLEDOIDC_PROVIDER=keycloakOIDC_ISSUER_URLOIDC_CLIENT_IDOIDC_CLIENT_SECRETOIDC_REDIRECT_URIOIDC_SCOPES(defaultopenid profile email)OIDC_ROLE_CLAIM(defaultgroups)OIDC_ROLE_MAP_JSONALLOW_LEGACY_HEADER_AUTH
Default role map:
{
"kc_admin": "admin",
"kc_supervisor": "supervisor",
"kc_operator": "operator",
"kc_analyst": "analyst"
}
Keycloak client settings
Recommended client type:
- confidential client
- standard authorization code flow enabled
- PKCE enabled
Redirect URI:
https://<gateway-host>/proxy/auth/auth/oidc/callback
Web origins:
https://<gateway-host>
Validation flow
- Apply migrations:
python scripts/migrate_core_db.py
- Start the stack with Track 1 env vars.
- Check OIDC endpoints:
python scripts/oidc_smoke.py --base-url http://<gateway-host> --require-enabled
- Open:
http://<gateway-host>/operator
- Click
Корпоративный вход. - Complete Keycloak login.
- Confirm the operator UI receives a session and continues using bearer auth.
Failure handling
OIDC health fails
- verify
OIDC_ISSUER_URL - verify Keycloak realm is reachable from the auth-service
- verify TLS and reverse proxy settings
Login returns 403
- verify user groups in Keycloak
- verify
OIDC_ROLE_MAP_JSON - verify
OIDC_ROLE_CLAIMmatches the actual claim in the ID token
Existing scripts stop working
- in QA only, temporarily set
ALLOW_LEGACY_HEADER_AUTH=1 - in enterprise pilot, do not revert silently; update the script/client to bearer auth or use documented break-glass local login only
Break-glass local access
Local /auth/login remains available in Track 1 for:
- local development
- demo mode
- break-glass admin access
It is not the primary path in enterprise mode.