Aller au contenu principal

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:

RoleScopeDescription
cpi-adminPlatformFull access to all tenants, all operations
tenant-adminTenantFull access to own tenant only
devopsTenantDeploy, promote, and manage within own tenant
viewerTenantRead-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:

ScopeDescriptionRoles
stoa:readRead-only accessviewer, devops, tenant-admin, cpi-admin
stoa:writeCreate, update, deletedevops, tenant-admin, cpi-admin
stoa:adminPlatform administrationcpi-admin

Permission Matrix

API Management

Permissionviewerdevopstenant-admincpi-admin
List APIsReadReadReadRead (all tenants)
View API detailsReadReadReadRead (all tenants)
Create APICreateCreateCreate (any tenant)
Update APIUpdateUpdateUpdate (any tenant)
Delete APIDeleteDelete (any tenant)
Deploy APIDeployDeployDeploy (any tenant)
Promote APIPromotePromotePromote (any tenant)

Subscription Management

Permissionviewerdevopstenant-admincpi-admin
List subscriptionsReadReadReadRead (all tenants)
Create subscriptionCreateCreateCreate
Approve subscriptionApproveApprove
Suspend subscriptionSuspendSuspend
Revoke subscriptionRevokeRevoke
Rotate API keyRotateRotateRotate

Consumer Management

Permissionviewerdevopstenant-admincpi-admin
List consumersReadReadReadRead (all tenants)
Create consumerCreateCreate
Update consumerUpdateUpdate
Delete consumerDeleteDelete
Bulk onboardBulkBulk

Tenant Management

Permissionviewerdevopstenant-admincpi-admin
List tenantsOwn onlyOwn onlyOwn onlyAll tenants
View tenant detailsOwn onlyOwn onlyOwn onlyAll tenants
Create tenantCreate
Update tenantUpdate
Delete tenantDelete

MCP Tools

Permissionviewerdevopstenant-admincpi-admin
List toolsReadReadReadRead
Invoke toolInvokeInvokeInvoke
Register tool (CRD)RegisterRegister

Platform Administration

Permissionviewerdevopstenant-admincpi-admin
View audit logsReadReadReadRead (all tenants)
Manage usersOwn tenantAll tenants
Gateway adminFull access
Override read-only envOverride

Tenant Isolation

Tenant-scoped roles (tenant-admin, devops, viewer) are restricted to their own tenant:

  • A tenant-admin for tenant acme cannot see tenant globex resources
  • API queries automatically filter by the user's tenant_id claim
  • 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:

  1. tenant claim (custom claim in Keycloak) — primary source
  2. tenant-{id} role (realm role pattern) — fallback
  3. 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
}
ClaimRequiredPurpose
subYesUser identifier
expYesToken expiration
iatYesToken issued at
issYesToken issuer (Keycloak URL)
audYesAudience (must include client ID)
tenantNoTenant ID (required for tenant-scoped roles)
realm_access.rolesYesKeycloak realm roles
scopeNoOAuth 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 acme APIs
  • Manage consumers and their certificates
  • View audit logs for acme only
  • 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