Skip to content

Token exchange

Xratu does not hold passwords. You authenticate to your own identity provider, present the token it issued, and receive an Xratu token in return. This page is what the exchange verifies before it issues one, and what the issued token carries.

The exchange

flowchart LR
  subgraph YOU["YOU"]
    direction TB
    IDP["Your identity provider"]
    CL["CLI"]
    IDP -->|"external token"| CL
  end
  subgraph CP["CONTROL PLANE"]
    direction TB
    EX{{"Exchange endpoint<br/>issuer, audience,<br/>domain allowlist"}}
    TI[("Trusted issuers")]
    MP[("Principal and group<br/>mappings")]
    EX -.-> TI
    EX -.-> MP
  end
  CL -->|"external token"| EX
  EX -->|"Xratu token, with a TTL"| CL

Your password stays between you and your identity provider, and the control plane sees only the token it issued. The exchange reads two records to turn that token into an Xratu identity.

The exchange is refused with cloud token exchange is disabled where external tokens are not trusted, so the capability is either on and verifying or off and saying so.

What is verified

An external token is accepted only when it verifies against the configured issuers and audiences. A token that does not verify is refused with cloud_token_invalid_or_unverified. Where a domain allowlist is set and the token's email falls outside it, the refusal is email_domain_not_allowed.

The exchange also refuses a token that resolves to the system actor, or one that resolves in any mode other than an external token, with unable to resolve actor from external token. An Xratu token cannot be presented to the exchange to mint another.

What the issued token carries

The issued token names the actor, the provider it came from, and the claims carried forward from the external token:

email, sub, iss, groups

Its lifetime is what the caller asked for, with a floor of 300 seconds. There is a floor rather than a ceiling because a very short token costs an exchange per call.

The response gives the token, its type, the resolved actor and the provider, so the identity the platform resolved is visible to the caller that asked for it:

{
  "access_token": "<token>",
  "token_type": "bearer",
  "actor_id": "<actor>",
  "provider": "<provider>"
}

Renewal is another exchange

A token carries no refresh capability. A new token is obtained by exchanging again, which keeps the identity provider in the loop for every issuance rather than only the first.

Groups travel with the identity

Groups arrive in the external token's claims and are combined with any groups the mapping layer resolves. The union is what authorisation evaluates against. See Principal and group mapping resolution for the mapping, and RBAC evaluation for what the groups then grant.