Skip to content

External identity exchange

The exchange turns an identity your provider issued into an identity Xratu recognises. It is where an external principal becomes an actor that role bindings can name.

flowchart TB
  P["Identity provider"] -->|"you obtain a token"| T["External token"]
  T -->|"POST /v1/auth/exchange"| CP["Control plane"]
  CP --> V["Verify issuer<br/>and audience"]
  V --> D["Check email domain"]
  D --> M["Apply principal<br/>and group mappings"]
  M --> X["Xratu token<br/>actor and groups fixed"]
xratu auth exchange --provider gcp --external-token "${TOKEN}" --set-token --set-actor
{
  "status_code": 200,
  "body": {
    "access_token": "...",
    "token_type": "bearer",
    "actor_id": "user:alice@acme.example",
    "provider": "gcp"
  }
}

What the issued token carries

Claim Value
sub The resolved actor, after principal mapping
provider gcp, aws, azure or oidc
claims.email, claims.sub, claims.iss The external claims the actor was resolved from
claims.groups The effective groups, after group mapping
exp Now plus the requested lifetime, with a floor of 300 seconds

The actor and the groups are fixed at exchange time. Later requests read them from this token, so a directory group added afterwards, or a mapping created afterwards, reaches Xratu at the next exchange. Exchanging again is how a change in your provider becomes a change in what you can do.

provider is inferred from the token's issuer when the flag is omitted.

What the exchange establishes

Established By
That the caller holds a credential your provider issued Issuer and audience verification
Which actor the request runs as Claim derivation, then principal mappings
Which groups the request carries Claim extraction, then group mappings
What the actor may do Role bindings, read per request

A freshly exchanged actor holds organization.create and nothing else until a binding names it. Creating an organization writes that first binding. See Actors and RBAC.

Conditions the control plane applies

Condition Refusal
Cloud token trust is enabled 403 cloud token exchange is disabled
The token verifies as an external one and yields an actor 403 unable to resolve actor from external token
The email domain is within the configured set email_domain_not_allowed

Trust, allowed issuers, allowed audiences, and allowed email domains are control-plane state. On a finalized deployment they are locked. See The authentication model.

Provider tokens used directly

While cloud token trust is enabled and the issuer is allowed, a provider token is also accepted as a bearer on an ordinary request. It is verified the same way, and the same mapping layers apply, so a workload authenticates with the identity its platform already gives it.

A bearer is checked as an Xratu token first, and considered as an external one after that.