Skip to content

Actor resolution and whoami

Every request's identity comes from one function, run once at the edge, reading one header. whoami returns what that function decided. This page is the resolution path and how to read its answer, which is the fastest way to explain an authorisation result you did not expect.

Identity comes from the token alone

The resolver takes the authorization header and nothing else. A caller cannot assert who it is through any other header: the actor id parameter is discarded before it is read, so a request's identity is whatever its token proves.

Three modes

flowchart TB
  A["Bearer token present?"]
  B["mode: none<br/>no identity, no rejection"]
  C["Verifies as an Xratu token?"]
  D["mode: token"]
  E["Verifies as an external token?"]
  F["mode: cloud-token"]
  G["Rejected, with a reason"]
  A -->|"no"| B
  A -->|"yes"| C
  C -->|"yes"| D
  C -->|"no"| E
  E -->|"yes"| F
  E -->|"no"| G

What the resolver reads

flowchart LR
  subgraph RQ["REQUEST"]
    direction TB
    H["authorization header"]
    X["any other identity header<br/>discarded"]
  end
  subgraph CP["CONTROL PLANE"]
    direction TB
    RS{{"Actor resolver<br/>middleware"}}
    XK[("Xratu token verification")]
    EK[("Trusted external issuers")]
    MP[("Principal and group mappings")]
    RS -.-> XK
    RS -.-> EK
    RS -.-> MP
  end
  AC["Actor, groups, mode<br/>on the request"]
  H --> RS
  RS --> AC

The resolver has one input from the request and three records behind it. The actor every later step uses is its output, so a request is whoever its token proves it to be.

An absent token is mode: none rather than a rejection. The request continues unauthenticated, and authorisation refuses it later if the action needs a role. A token that is present and fails to verify is a rejection, and the middleware answers 401 immediately.

What each mode resolves

token is an Xratu-issued token, verified against the deployment's signing secret. Its subject is the actor. Where the subject is system, the context is marked a system principal. A token whose kind is service_account is checked against the issued-token record on every request, so it can be stopped before it expires.

cloud-token is an external token, verified against the allowed issuers and audiences. The actor id is derived from the claims and then replaced by a principal mapping where one matches; groups from the claims are combined with mapped groups. See Principal and group mapping resolution.

The rejection reasons

Reason Mode Means
token_invalid_or_unverified token The token did not verify against the signing secret
token_revoked_or_expired token A service account token whose record is no longer active
token_validation_error token The revocation check could not be completed
cloud_token_invalid_or_unverified cloud-token The external token did not verify against an allowed issuer and audience
email_domain_not_allowed cloud-token A domain allowlist is set and the token's email is outside it

The reason travels in the 401 body alongside the mode, so the answer names both what was attempted and why it failed.

whoami returns the resolved identity

whoami reports the actor and the auth context the request is carrying:

actor_id              the resolved actor
auth_context          mode, provider, issuer, subject, groups, claims
request_context_actor the actor the middleware put on the request
request_context_auth  the context the middleware put on the request

Reading it answers the three questions behind most authorisation surprises: who the platform thinks you are, which mode resolved you, and which groups you are carrying. A 403 on an action you expected to hold is usually an empty or unexpected group list here, rather than a missing binding.

See RBAC evaluation for what those groups then grant.