Security & Auth Flows
CAIPE security is enforced in layers: the BFF owns the browser session, Dynamic Agents validates bearer tokens, AgentGateway is the single MCP Policy Enforcement Point, and OpenFGA handles all relationship-based authorization decisions.
Overview
Controls
| Control | Purpose |
|---|---|
| NextAuth / OIDC | Browser session authentication |
| Keycloak | Identity provider, service accounts, token exchange |
| OpenFGA | Relationship and scope authorization (ReBAC) |
| AgentGateway | MCP route enforcement — jwtAuth + extAuthz |
| Agent Context HMAC | Per-agent tool policy via signed request headers |
| Audit service | Central audit log ingestion and querying |
Flows
| Flow | Where |
|---|---|
| Login and session (OIDC, NextAuth, token refresh) | Auth Flow |
| AgentGateway jwtAuth + extAuthz + MCP proxy | AgentGateway |
| Agent identity HMAC — end to end with OpenFGA checks | Agent Context HMAC |
| RBAC role assignment and permission workflows | RBAC Workflows |
| Enterprise identity federation (Keycloak + external IdP) | Enterprise Identity Federation |
| Slack bot authorization flows | Slack Bot Authorization |
| Service accounts (bot credentials, create/rotate/revoke) | RBAC Architecture — Service Accounts |
RBAC
See the RBAC section for the OpenFGA policy model, role definitions, deployment guidance, and per-component authorization details.