Authentication
How people, tools and workloads prove who they are to Rivergate — and how local access is kept to a minimum.
Rivergate is not an identity provider. People sign in through an external OIDC provider; Rivergate decides what they may do. A single local bootstrap administrator exists only to set that up, and for tightly bounded recovery.
| Caller | Credential | Used for |
|---|---|---|
| Person in a browser | OIDC sign-in, then an HttpOnly session cookie | The dashboard |
| Person's tool or script | Personal API token | CLI, SDK, automation |
| Kubernetes workload | Projected ServiceAccount JWT, exchanged for a five-minute token | The Operator |
| Initial setup and recovery | Local bootstrap password | One-time setup, time-limited recovery |
The bootstrap administrator
A new installation has no users. An explicit first-run command creates exactly one local system administrator.
make -C rivergate-deployment bootstrap-admin
- The initial password is generated, written once to an owner-only file, and never printed or logged. No default credential ships anywhere.
- Only an Argon2id verifier is stored, with its parameters recorded for later rehashing.
- The account is flagged
password_change_required. Until the password is changed it holds a restricted setup session and cannot do administrative work. Changing it revokes that session; sign in again afterwards. - Login and password endpoints use generic failure responses, bounded request sizes, rate limiting, CSRF protection and durable audit events.
The bootstrap account is not a user-management system. There is no local registration and no way to add more local users.
OIDC sign-in
Normal sign-in uses OpenID Connect Authorization Code flow with PKCE S256. Rivergate validates the issuer, signature, audience, expiry, nonce, state, browser binding and the exact redirect URI before creating a session.
Configure the provider
A platform administrator saves the provider once, from the dashboard or through the API:
PUT /auth/oidc/provider
{
"issuer": "https://keycloak.example.com/realms/rivergate",
"client_id": "rivergate",
"client_secret": "…",
"redirect_url": "https://rivergate.example.com/auth/oidc/callback"
}
- The client secret is encrypted with a data key wrapped by the root key and is never returned by the API.
GET /auth/oidc/providerreturns non-secret metadata only. - Provider configuration is versioned and every change is audited.
- OIDC sign-in flow state lives in Redis with a short TTL, is single-use, bound to the browser and encrypted. A Redis outage only interrupts sign-in attempts in flight.
Keycloak client settings
- Client authentication on, standard flow on, direct access grants off.
- The redirect URI registered in Keycloak must exactly match the one Rivergate presents.
- PKCE method
S256. - Callback query strings should be redacted from ingress and access logs.
Identity mapping
Each identity is the exact (issuer, subject) pair. Email is mutable display data and is never used to link or grant access — not even a verified email.
- A newly authenticated, unmapped identity has no permissions.
- There is no “first user is admin” rule and no domain-based grant.
- The first OIDC system administrator is granted explicitly by the bootstrap administrator through an audited handoff.
GET /auth/identities
POST /auth/identities/{principal}/system-admin
PUT /auth/identities/{principal}/status # {"status":"disabled"} or "active"
Disabling an identity revokes its Rivergate sessions and API tokens in the same transaction as the audited status change. Re-enabling does not bring them back. Rivergate refuses to disable the last active OIDC system administrator. Changes in your identity provider are not pushed to Rivergate automatically, so disable the identity here when you need revocation to be immediate.
The system administrator role manages identities and platform configuration. It grants no permission to read secret values. Secret access always comes from organization or scoped roles.
Sessions and CSRF
- Session identifiers are opaque and random. PostgreSQL stores only SHA-256 verifiers of the session and CSRF values.
- The session cookie is HttpOnly and
SameSite=Lax, andSecurein production. - Every state-changing browser request must send the value of the
rivergate_csrfcookie in anX-CSRF-Tokenheader. Bearer-token requests do not use CSRF. - Raw OIDC tokens and session values are never stored in PostgreSQL, Redis, logs, URLs or telemetry.
Personal API tokens
CLI and SDK calls use personal API tokens.
- A token belongs to its owner and has no permissions of its own. It inherits the owner's current memberships and policies, so it can never do more than the person can.
- Tokens are random, shown once, stored only as SHA-256 verifiers, and expire within 90 days.
- Issue and revoke operations are audited, and are only allowed from the owning browser session with CSRF validation.
- Removing a membership or policy takes effect on the token's next request.
The step-by-step procedure is in REST API.
Workload tokens
Kubernetes workloads authenticate with a projected ServiceAccount JWT that Rivergate validates directly against an administrator-configured issuer and JWKS. It is exchanged for an opaque token valid for five minutes, returned only after the exchange is audited. See Kubernetes Operator.
Break-glass recovery
After the OIDC handoff, local password login is disabled. It stays off — even if your identity provider is down — until an operator deliberately turns it on from the trusted host.
make -C rivergate recovery-activate # default 15 minutes
make -C rivergate recovery-deactivate
- Activation is an out-of-band CLI action against the Rivergate host and database. It is available only after an OIDC identity holds system-admin access.
- The default window is 15 minutes; you may choose a shorter duration; one hour is the hard maximum. Expiry uses PostgreSQL time and is enforced by every API instance.
- Activation requires a new local password change and revokes earlier local sessions.
- Activation, each recovery login and deactivation are durably audited. A login is audited before a session is issued.
- Login stops automatically at expiry. Deactivation revokes local sessions and API tokens and is allowed after expiry. A new activation is blocked until the previous one is closed.
- The
--operatorlabel on activation is self-reported. Protect access to the operator host and the database. - Recovery grants no authorization bypass: the bootstrap account still has no tenant or secret access.
After a recovery, review the audit log, rotate the bootstrap credential, and confirm OIDC administration is healthy again.