Service accounts¶
A service account is a non-interactive actor that belongs to one workspace. It holds tokens Xratu issues directly, each recorded by id and revocable on its own. It is the identity for pipelines and other unattended callers.
The record¶
{
"status_code": 200,
"body": {
"workspace_uuid": "b91d4f07-2c65-4e13-8a77-05ce9d2b6f38",
"items": [
{
"service_account_id": "9d4c0f6b1a2e47c8b0d5e3f1a7c94b2d",
"name": "ci-publisher",
"description": "CI pipeline that publishes blocks",
"metadata": {},
"disabled": false,
"created_by_actor": "user:alice@acme.example",
"actor_id": "service-account:b91d4f07-2c65-4e13-8a77-05ce9d2b6f38:9d4c0f6b1a2e47c8b0d5e3f1a7c94b2d"
}
],
"limit": 200
}
}
| Field | Source | Constraint |
|---|---|---|
service_account_id |
Generated at creation | Unique |
workspace_uuid |
The workspace you create it in | Fixed at creation |
name |
You choose it | Unique within the workspace |
description, metadata |
You supply them | Free-form |
disabled |
You set it | While true, token issuance is refused |
created_by_actor |
The acting actor | Recorded once |
actor_id |
Composed | service-account:<workspace_uuid>:<service_account_id> |
actor_id is the form that appears in audit records and that role bindings
target. The CLI accepts the account name and resolves it:
Tokens¶
flowchart TB
SA["Service account"] -->|"issue-token"| T["Token + token_id"]
T --> R["Issued-token record"]
R -->|"revoke-token --token-id"| X["Revoked"]
T -->|"ttl elapses"| E["Expired"]
Issuance returns the credential and its id together:
{
"workspace_uuid": "b91d4f07-2c65-4e13-8a77-05ce9d2b6f38",
"service_account_id": "9d4c0f6b1a2e47c8b0d5e3f1a7c94b2d",
"token_id": "4a7e91c05b3d4f6ea8c2701d9b5f83ae",
"access_token": "...",
"token_type": "bearer",
"expires_at_epoch": 1789459200,
"actor_id": "service-account:b91d4f07-...:9d4c0f6b..."
}
| Property | Value |
|---|---|
| Token kind | service_account, carried in the token's claims |
| Requested lifetime | --ttl-seconds, CLI default 86400 |
| Lifetime floor | 300 seconds; a lower request is raised to it |
| Revocation | By token_id, at any time |
| Check on each request | The issued-token record must still be active |
token_id is how the credential is revoked, and it is returned once at
issuance. Record it alongside wherever the token itself is kept.
A request carrying a revoked or expired token resolves to no actor, with a
context of token_revoked_or_expired.
Two credential kinds¶
| Exchanged identity | Service-account token | |
|---|---|---|
| Issued from | A provider token you present | The control plane, on request |
| Actor | Derived from claims | The account's actor_id |
| Recorded by id | Recorded as claims on the issued token | Recorded as an issued-token record |
| Revocable individually | Revoked by ending the provider session | Revoked by token_id |
| Used for | A person at a terminal | Pipelines and unattended callers |
Rights come from bindings¶
A new service account authenticates and holds organization.create, as any
resolved actor does. Everything else follows from a binding on its actor. The
account's own workspace is the usual scope:
What is recorded¶
| Action | Written when |
|---|---|
service_account.create |
The account is created |
service_account.token.issue |
A token is issued, with its id and reason |
service_account.token.revoke |
A token is revoked, with its id and reason |
Issuance and revocation both require rights at the workspace,
service_account.token.issue and service_account.token.revoke.
To create one and rotate its credential, see Create and manage a service account.