RBAC Permission Matrix
Complete reference for STOA's role-based access control β roles, scopes, permissions, and tenant isolation.
Rolesβ
STOA defines 4 roles, managed in Keycloak as realm roles:
| Role | Scope | Description |
|---|---|---|
cpi-admin | Platform | Full access to all tenants, all operations |
tenant-admin | Tenant | Full access to own tenant only |
devops | Tenant | Deploy, promote, and manage within own tenant |
viewer | Tenant | Read-only access to own tenant |
Role Hierarchyβ
cpi-admin (platform-wide)
βββ tenant-admin (tenant-scoped)
βββ devops (deploy-scoped)
βββ viewer (read-only)
Higher roles inherit all permissions of lower roles. A cpi-admin can do everything a viewer can, plus more.
OAuth Scopesβ
The gateway maps roles to OAuth scopes for token-based authorization:
| Scope | Description | Roles |
|---|---|---|
stoa:read | Read-only access | viewer, devops, tenant-admin, cpi-admin |
stoa:write | Create, update, delete | devops, tenant-admin, cpi-admin |
stoa:admin | Platform administration | cpi-admin |
Permission Matrixβ
API Managementβ
| Permission | viewer | devops | tenant-admin | cpi-admin |
|---|---|---|---|---|
| List APIs | Read | Read | Read | Read (all tenants) |
| View API details | Read | Read | Read | Read (all tenants) |
| Create API | β | Create | Create | Create (any tenant) |
| Update API | β | Update | Update | Update (any tenant) |
| Delete API | β | β | Delete | Delete (any tenant) |
| Deploy API | β | Deploy | Deploy | Deploy (any tenant) |
| Promote API | β | Promote | Promote | Promote (any tenant) |
Subscription Managementβ
| Permission | viewer | devops | tenant-admin | cpi-admin |
|---|---|---|---|---|
| List subscriptions | Read | Read | Read | Read (all tenants) |
| Create subscription | β | Create | Create | Create |
| Approve subscription | β | β | Approve | Approve |
| Suspend subscription | β | β | Suspend | Suspend |
| Revoke subscription | β | β | Revoke | Revoke |
| Rotate API key | β | Rotate | Rotate | Rotate |
Consumer Managementβ
| Permission | viewer | devops | tenant-admin | cpi-admin |
|---|---|---|---|---|
| List consumers | Read | Read | Read | Read (all tenants) |
| Create consumer | β | β | Create | Create |
| Update consumer | β | β | Update | Update |
| Delete consumer | β | β | Delete | Delete |
| Bulk onboard | β | β | Bulk | Bulk |
Tenant Managementβ
| Permission | viewer | devops | tenant-admin | cpi-admin |
|---|---|---|---|---|
| List tenants | Own only | Own only | Own only | All tenants |
| View tenant details | Own only | Own only | Own only | All tenants |
| Create tenant | β | β | β | Create |
| Update tenant | β | β | β | Update |
| Delete tenant | β | β | β | Delete |
MCP Toolsβ
| Permission | viewer | devops | tenant-admin | cpi-admin |
|---|---|---|---|---|
| List tools | Read | Read | Read | Read |
| Invoke tool | β | Invoke | Invoke | Invoke |
| Register tool (CRD) | β | β | Register | Register |
Platform Administrationβ
| Permission | viewer | devops | tenant-admin | cpi-admin |
|---|---|---|---|---|
| View audit logs | Read | Read | Read | Read (all tenants) |
| Manage users | β | β | Own tenant | All tenants |
| Gateway admin | β | β | β | Full access |
| Override read-only env | β | β | β | Override |
Tenant Isolationβ
Tenant-scoped roles (tenant-admin, devops, viewer) are restricted to their own tenant:
- A
tenant-adminfor tenantacmecannot see tenantglobexresources - API queries automatically filter by the user's
tenant_idclaim - Cross-tenant access attempts return
403 Forbidden
Only cpi-admin can access resources across all tenants.
How Tenant Is Determinedβ
The user's tenant is extracted from the JWT token:
tenantclaim (custom claim in Keycloak) β primary sourcetenant-{id}role (realm role pattern) β fallback- No tenant β only valid for
cpi-admin(platform-wide access)
JWT Claims Structureβ
STOA validates these JWT claims from Keycloak:
{
"sub": "user-uuid-123",
"preferred_username": "john.doe",
"email": "john.doe@acme.example.com",
"tenant": "acme",
"realm_access": {
"roles": ["tenant-admin", "offline_access"]
},
"scope": "openid stoa:read stoa:write",
"aud": ["stoa-mcp", "account"],
"iss": "https://auth.<YOUR_DOMAIN>/realms/stoa",
"exp": 1708000000,
"iat": 1707999000
}
| Claim | Required | Purpose |
|---|---|---|
sub | Yes | User identifier |
exp | Yes | Token expiration |
iat | Yes | Token issued at |
iss | Yes | Token issuer (Keycloak URL) |
aud | Yes | Audience (must include client ID) |
tenant | No | Tenant ID (required for tenant-scoped roles) |
realm_access.roles | Yes | Keycloak realm roles |
scope | No | OAuth scopes (space-separated) |
Persona Examplesβ
Alex β Platform Admin (cpi-admin)β
Alex manages the entire STOA platform. She can:
- Create and configure tenants
- View all subscriptions across tenants
- Access the gateway admin API
- Override read-only production restrictions
- View platform-wide audit logs
Bob β Tenant Admin (tenant-admin)β
Bob manages APIs for the acme tenant. He can:
- Create, edit, and delete APIs in
acme - Approve subscription requests for
acmeAPIs - Manage consumers and their certificates
- View audit logs for
acmeonly - Cannot see resources in other tenants
Carol β DevOps Engineer (devops)β
Carol deploys and promotes APIs for acme. She can:
- Create and update APIs in
acme - Deploy APIs to staging and production
- Rotate API keys for subscriptions
- Cannot delete APIs or approve subscriptions
- Cannot manage consumers
Dave β Viewer (viewer)β
Dave monitors API health for acme. He can:
- Browse the API catalog and documentation
- View subscription details and usage metrics
- Read audit logs for
acme - Cannot create, modify, or delete anything
Relatedβ
- Authentication Guide β Keycloak and OIDC setup
- Environment Management β Environment modes and read-only production
- OAuth Discovery β OAuth 2.1 endpoints
- Multi-Tenant Isolation β Tenant architecture