Skip to content

Identity and audit routes

Reference routes for exposing identity and audit through the gateway (which the plat5 CLI’s plat5 routes generate scaffolds for every kind). Concept: access.

These are ordinary service definitions. The control plane adds no hidden routes to them at apply: drop a route by removing it, move one by editing its path, or change what it requires by editing its permissions.

One scope block per kind, with upstream_prefix: /nodes/{K.id}, so most routes need no upstream. A route whose upstream isn’t the prefix plus its path names it. Each verb carries its own permissions. Shown for organization (/orgs/{organization}) and project under it (/projects/{project}), cut short:

services/identity.yml
identity:
url: http://identity:3000
scopes:
organization:
upstream_prefix: /nodes/{organization.id}
routes:
- path: /
methods:
GET: { permissions: organization:read }
PATCH: { permissions: organization:write }
DELETE: { permissions: organization:delete }
- path: /restore
allow_deleted: true
methods:
POST: { permissions: organization:delete }
- path: /projects
upstream: /nodes/{organization.id}/children/project
methods:
GET: { permissions: any_member }
POST: { permissions: project:create }
- path: /membership
upstream: /nodes/{organization.id}/memberships/{member.id}
methods:
GET: { permissions: any_member }
- path: /membership
upstream: /nodes/{organization.id}/members/{member.id}
methods:
DELETE: { permissions: any_member }
# …
user:
routes:
- path: /orgs
upstream: /roots/organization
methods: [POST]
- path: /user
upstream: /users/{user.id}
methods: [GET, PATCH, DELETE]
# …
services/audit.yml
audit:
url: http://audit:3002
scopes:
organization:
upstream_prefix: /nodes/{organization.id}
routes:
- path: /audit-events
methods:
GET: { permissions: audit:read }
# … one block per kind
user:
routes:
- path: /user/audit-events
upstream: /users/{user.id}/audit-events
methods: [GET]

The generator sets no rate_limit or audit, so the defaults apply.

For a kind K with parent P. <p> is K’s permission prefix (K’s name, or its list_permission without <sep>read when it ends in <sep>read). <sep> is the generator’s permission_separator (: by default, _ for Topaz, configurable via routes.permission_separator in plat5.local.yml or --permission-separator). <collection> is the literal in K’s path (/projects for /projects/{project}). Paths are relative to the scope’s node.

Tenancy, tree, members, service accounts, invites, security policy, and user routes work in every authorization configuration (roles only, authorizer + roles, and authorizer without roles):

Scope Path Methods and permissions Upstream on identity
K / GET <p>:read; PATCH <p>:write; DELETE <p>:delete /nodes/{K.id}
K /restore POST <p>:delete, with allow_deleted: true /nodes/{K.id}/restore
P, for a K that isn’t a root <collection> GET any_member, filtered; POST <p>:create /nodes/{P.id}/children/K
K, a root /membership DELETE any_member (leave the tree) /nodes/{K.id}/members/{member.id}
K, a root /membership/keys GET, POST any_member (user_credential: true) /nodes/{K.id}/members/{member.id}/keys
K, a root /membership/keys/{key_id} PATCH, DELETE any_member (user_credential: true) /nodes/{K.id}/members/{member.id}/keys/{key_id}
K /service-accounts GET <p>:bindings:read; POST <p>:bindings:write /nodes/{K.id}/service-accounts
K /service-accounts/{service_account_id} GET <p>:bindings:read; PATCH, DELETE <p>:bindings:write /nodes/{K.id}/service-accounts/{service_account_id}
K /service-accounts/{service_account_id}/keys GET, POST <p>:bindings:write /nodes/{K.id}/service-accounts/{service_account_id}/keys
K /service-accounts/{service_account_id}/keys/{key_id} PATCH, DELETE <p>:bindings:write /nodes/{K.id}/service-accounts/{service_account_id}/keys/{key_id}
K, a root /invites GET, POST <p>:bindings:write /nodes/{K.id}/invites
K, a root /invites/{invite_id} DELETE <p>:bindings:write /nodes/{K.id}/invites/{invite_id}
K, a root /security-policy GET <p>:bindings:read; PATCH <p>:bindings:write /nodes/{K.id}/security-policy
K, a root /members GET <p>:bindings:read /nodes/{K.id}/members
K, a root /members/{member_id} GET any_member; DELETE <p>:bindings:write /nodes/{K.id}/members/{member_id}
K, a root /members/{member_id}/status PATCH <p>:bindings:write /nodes/{K.id}/members/{member_id}/status
K, a root /members/{member_id}/keys GET <p>:bindings:read /nodes/{K.id}/members/{member_id}/keys
K, a root /members/{member_id}/keys/{key_id} DELETE <p>:bindings:write /nodes/{K.id}/members/{member_id}/keys/{key_id}
user, for a root K <collection> POST /roots/K
user /user GET, PATCH, DELETE /users/{user.id}
user /user/nodes GET /users/{user.id}/nodes
user /user/keys GET, POST /users/{user.id}/keys
user /user/keys/{key_id} PATCH, DELETE /users/{user.id}/keys/{key_id}
user /user/invites/redeem POST /users/{user.id}/invites/redeem

Role & binding routes (when roles is configured)

Section titled “Role & binding routes (when roles is configured)”

These routes work whenever roles is configured (roles only or authorizer + roles), and return 404 on identity when authorizer is used without roles:

Scope Path Methods and permissions Upstream on identity
K /membership GET any_member /nodes/{K.id}/memberships/{member.id}
K /bindings GET <p>:bindings:read; POST <p>:bindings:write /nodes/{K.id}/bindings
K /bindings/{binding_id} PATCH, DELETE <p>:bindings:write /nodes/{K.id}/bindings/{binding_id}
K /roles GET any_member /nodes/{K.id}/roles
K, a root /roles/{role_id} GET any_member /nodes/{K.id}/roles/{role_id}
K, a root /groups GET <p>:bindings:read; POST <p>:bindings:write /nodes/{K.id}/groups
K, a root /groups/{group_id} GET <p>:bindings:read; PATCH, DELETE <p>:bindings:write /nodes/{K.id}/groups/{group_id}
K, a root /groups/{group_id}/members GET <p>:bindings:read; POST <p>:bindings:write /nodes/{K.id}/groups/{group_id}/members
K, a root /groups/{group_id}/members/{member_id} DELETE <p>:bindings:write /nodes/{K.id}/groups/{group_id}/members/{member_id}

Custom role & permission catalog routes (roles-only mode)

Section titled “Custom role & permission catalog routes (roles-only mode)”

These routes require built-in RBAC without authorizer and return 404 whenever authorizer is configured (with or without roles):

Scope Path Methods and permissions Upstream on identity
K, a root /roles POST <p>:bindings:write /nodes/{K.id}/roles
K, a root /roles/{role_id} PATCH, DELETE <p>:bindings:write /nodes/{K.id}/roles/{role_id}
K, a root /permissions GET <p>:bindings:read /nodes/{K.id}/permissions

Adding a member to a root by IdP subject (POST /nodes/{root_id}/members) and managing root rate-limit tiers (GET/PATCH /nodes/{root_id}/rate-limit-tier) aren’t generated: they suit an operator plane or internal billing/provisioning service more than a customer. A deployment that wants them at the gateway adds the routes with the permissions it chooses. What each upstream does: identity’s API.

Shown for organization and project:

Public route Permissions
POST /orgs user route
GET, PATCH, DELETE /orgs/{organization} organization:read, :write, :delete
GET /orgs/{organization}/projects any_member, filtered by project:read
POST /orgs/{organization}/projects project:create
GET /orgs/{organization}/projects/{project} project:read
POST /orgs/{organization}/projects/{project}/restore project:delete
GET /orgs/{organization}/projects/{project}/membership any_member
DELETE /orgs/{organization}/membership any_member: leave the org
GET, POST /orgs/{organization}/invites organization:bindings:write
GET /user/nodes?kind=organization user route: the org switcher
Scope Path Methods and permissions Upstream on audit
K /audit-events GET audit:read /nodes/{K.id}/audit-events
user /user/audit-events GET /users/{user.id}/audit-events

A node’s events include everything below it (reference/api/audit.md).

Permission Checked at Allows
<p>:read The node Getting the node; also the kind’s list_permission by default
<p>:create The parent Creating one under the parent
<p>:write The node Changing the display name
<p>:delete The node Deleting and restoring
<p>:bindings:read / :write The node Listing or changing who has access here, service accounts and their keys included. On a root, also listing and removing members, managing groups, custom roles, security policy, and invites to join
audit:read The node or an ancestor Reading audit for the node and below

These are a starting point, not rules. The files can rename them, change them or drop routes. Identity’s code depends on no permission name: lists use each kind’s list_permission (lists). Roles grant them like any permission; * grants all.

Common gotcha: The default starting plat5.yml gives the member role only <p>:read (not <p>:bindings:read), so calling GET /<roots>/{root}/members, GET …/bindings, or GET …/groups as a member returns 403. Either add <p>:bindings:read to the role in plat5.yml or change the route’s permissions in services/identity.yml.

Whoever holds <p>:bindings:write can create a service account with any role bindable there, and bind themselves any role: it’s as strong as the strongest role (who may assign).