Skip to content

Authentication Architecture

This document explains the authentication architecture in Omnia, covering both dashboard access and agent endpoint security.

Omnia has two distinct authentication layers that serve different purposes:

graph TB
subgraph "Dashboard Authentication"
U[User] -->|Browser| D[Dashboard]
D -->|OAuth/Proxy/Anonymous| IDP[Identity Provider]
D -->|API Key| API[Operator API]
end
subgraph "Agent Authentication"
C[Client App] -->|JWT| AG[Agent Gateway]
AG -->|Istio| A[Agent Pod]
end
D -->|Manage| AR[AgentRuntimes]
D -->|Manage| PP[PromptPacks]

The dashboard is a web UI for managing Omnia resources. It supports multiple authentication modes:

ModeUse CaseSecurity Level
AnonymousDevelopment, demosNone
ProxyBehind OAuth2 Proxy, Authelia, etc.Delegated
OAuthDirect IdP integrationFull
BuiltinLocal user databaseFull
API KeysProgrammatic accessToken-based

Agent endpoints are protected separately using Istio’s JWT validation. This allows:

  • Different authentication for dashboard vs agents
  • Service-to-service authentication for agent clients
  • Fine-grained access control per agent

The simplest mode with no authentication. All users are treated as anonymous viewers.

OMNIA_AUTH_MODE=anonymous

When to use:

  • Local development
  • Demonstrations
  • Air-gapped environments with network-level security

Limitations:

  • No user identity
  • No audit trail
  • Single role for all users

Delegates authentication to a reverse proxy that handles OAuth/OIDC and passes user info via headers.

sequenceDiagram
participant U as User
participant P as OAuth2 Proxy
participant D as Dashboard
participant IDP as Identity Provider
U->>P: Access dashboard
P->>IDP: Redirect to login
IDP-->>P: Auth code
P->>IDP: Exchange for tokens
P->>D: Forward request + headers
Note right of P: X-Forwarded-User<br/>X-Forwarded-Email<br/>X-Forwarded-Groups
D->>D: Create session from headers
D-->>U: Dashboard UI

When to use:

  • Kubernetes with ingress controller
  • Existing OAuth2 Proxy deployment
  • Centralized authentication gateway
  • Multiple applications behind same proxy

Benefits:

  • Single sign-on across applications
  • Proxy handles token management
  • No secrets in dashboard

Direct integration with identity providers using OAuth 2.0 / OpenID Connect.

sequenceDiagram
participant U as User
participant D as Dashboard
participant IDP as Identity Provider
U->>D: Access dashboard
D->>D: Generate PKCE
D->>U: Redirect to IdP
U->>IDP: Authenticate
IDP->>D: Callback with code
D->>IDP: Exchange code + PKCE
IDP-->>D: Access + ID tokens
D->>D: Create session
D-->>U: Dashboard UI

When to use:

  • Standalone deployment
  • No existing proxy infrastructure
  • Need SSO logout
  • Need automatic token refresh

Supported providers:

  • Generic OIDC (any compliant provider)
  • Google
  • GitHub (OAuth 2.0)
  • Azure AD / Entra ID
  • Okta

Self-contained authentication with a local user database. No external identity provider required.

sequenceDiagram
participant U as User
participant D as Dashboard
participant DB as User Database
U->>D: Login (username + password)
D->>DB: Verify credentials
DB-->>D: User record + password hash
D->>D: Verify bcrypt hash
D->>D: Create session
D-->>U: Dashboard UI

When to use:

  • Small teams without an identity provider
  • Air-gapped environments
  • Quick proof-of-concept deployments
  • Development and testing

Features:

  • Username/email + password login
  • User signup (configurable)
  • Password reset via email tokens
  • Email verification (optional)
  • Account lockout after failed attempts
  • Admin user seeding on first run

Storage backends:

  • SQLite (default) - Zero dependencies, single file
  • PostgreSQL - For multi-instance production deployments

Security:

  • Bcrypt password hashing (12 rounds)
  • Secure token generation (SHA-256)
  • Account lockout protection
  • Encrypted session cookies

API keys provide programmatic access to the dashboard API without browser-based authentication.

sequenceDiagram
participant S as Script/CI
participant D as Dashboard API
S->>D: Request + API Key header
Note right of S: Authorization: Bearer omnia_sk_...
D->>D: Validate key
D->>D: Apply key permissions
D-->>S: API response

When to use:

  • CI/CD pipelines
  • Automation scripts
  • Service integrations
  • Monitoring tools

Features:

  • Scoped permissions
  • Expiration dates
  • Usage tracking
  • Multiple keys per user

All authentication modes map to the same RBAC system:

graph LR
subgraph "Authentication"
A[Anonymous]
P[Proxy Headers]
O[OAuth Claims]
B[Builtin Users]
K[API Key]
end
subgraph "Role Resolution"
G[Groups] --> R[Role Mapping]
R --> Admin
R --> Editor
R --> Viewer
end
A --> Viewer
P --> G
O --> G
B --> |Direct Role| R
K --> |Inherits| G
PermissionViewerEditorAdmin
View agents, prompts, toolsYesYesYes
View metrics and logsYesYesYes
Scale agentsNoYesYes
Deploy new agentsNoYesYes
Modify configurationsNoYesYes
Manage API keysOwnOwnAll
Manage usersNoNoYes

Groups from identity providers are mapped to roles:

Terminal window
# Users in these groups get admin role
OMNIA_AUTH_ROLE_ADMIN_GROUPS=omnia-admins,platform-admins
# Users in these groups get editor role
OMNIA_AUTH_ROLE_EDITOR_GROUPS=omnia-editors,developers
# Everyone else gets viewer role (default)

The first matching group wins, checked in order: admin, editor, then viewer.

Agent endpoints use JWT-based authentication via Istio’s RequestAuthentication and AuthorizationPolicy.

graph LR
C[Client] -->|JWT| IG[Istio Gateway]
IG -->|Validate| JWKS[JWKS Endpoint]
IG -->|Forward| A[Agent Pod]
subgraph "Istio Sidecar"
RA[RequestAuthentication]
AP[AuthorizationPolicy]
end
  1. Client obtains JWT from identity provider
  2. Client connects to agent with Authorization: Bearer <token>
  3. Istio validates JWT signature using JWKS
  4. Istio checks issuer, audience, and expiration
  5. If valid, request is forwarded to agent
  6. Claims can be extracted to headers for agent use

Agent authentication is separate because:

  1. Different clients - Dashboard serves humans, agents serve applications
  2. Different tokens - Browser sessions vs service tokens
  3. Different lifetimes - Short sessions vs long-lived API access
  4. Different providers - May use different IdPs for internal vs external

Dashboard sessions use encrypted cookies via iron-session:

graph LR
subgraph "Session Cookie"
UID[User ID]
UN[Username]
R[Role]
G[Groups]
T[OAuth Tokens]
E[Expiry]
end
S[Session Secret] -->|Encrypts| Cookie
Cookie -->|Contains| UID
Cookie -->|Contains| UN
Cookie -->|Contains| R
Cookie -->|Contains| G
Cookie -->|Contains| T
Cookie -->|Contains| E
  • Encrypted - Cookie contents are AES-encrypted
  • Server-side secret - Cannot be forged without secret
  • HTTP-only - Not accessible to JavaScript
  • Secure - Only sent over HTTPS (in production)
  • SameSite - Protected against CSRF

In OAuth mode, tokens are automatically refreshed:

  1. Dashboard checks token expiry before API calls
  2. If expiring soon (< 5 minutes), refresh is attempted
  3. New tokens are stored in session
  4. If refresh fails, user is redirected to login
  • Set OMNIA_SESSION_SECRET to a strong 32+ character secret
  • Use HTTPS for all dashboard access
  • Enable OAuth or proxy mode (never anonymous in production)
  • Configure role mapping to match your organization
  • Set appropriate session TTL
  • Enable API key expiration
  • Use network policies to restrict dashboard access
graph TB
subgraph "Network Layer"
FW[Firewall/WAF]
NP[Network Policies]
end
subgraph "Transport Layer"
TLS[TLS Termination]
MTLS[mTLS - Istio]
end
subgraph "Application Layer"
AUTH[Authentication]
RBAC[Authorization]
AUDIT[Audit Logging]
end
FW --> TLS
NP --> TLS
TLS --> AUTH
MTLS --> AUTH
AUTH --> RBAC
RBAC --> AUDIT
SecretStorageRotation
Session secretK8s Secret / envOn restart
OAuth client secretK8s Secret / file mountProvider-dependent
API keysFile store (encrypted)User-controlled
JWT signing keysJWKS endpointProvider-controlled

Different deployments have different requirements:

  • Enterprises need proxy integration with existing SSO
  • Startups want simple OAuth setup
  • Developers need quick anonymous access

Supporting all modes allows Omnia to fit into any environment.

Alternatives considered:

ApproachProsCons
JWT in localStorageStatelessXSS vulnerable, can’t revoke
JWT in cookieStatelessCan’t revoke, size limits
Encrypted session cookieSecure, revocable, simpleServer-side state
Redis sessionsScalable, revocableInfrastructure overhead

Encrypted cookies provide the best balance of security and simplicity for a dashboard.

PKCE (Proof Key for Code Exchange) prevents authorization code interception attacks:

  1. Dashboard generates random code_verifier
  2. Dashboard sends hash (code_challenge) to IdP
  3. After redirect, dashboard proves it initiated the request
  4. Even if code is intercepted, attacker can’t exchange it

PKCE is mandatory for public clients and recommended for all OAuth flows.