Workload identity
Agents, and services that ask for transaction tokens, prove who they are with their platform's own SPIFFE identity, so no key or secret is registered for them or handed to them.
Available, with limitsAPIRFC 7523, OAuth SPIFFE Client Authentication (draft)
Workload identity lets an agent sign in to your realm with the identity its platform already gives it. Where each workload has a SPIFFE identity, for example under SPIRE, the workload sends that identity’s signed token, its JWT-SVID, in place of a key. You trust the platform once, and register no key and hand out no secret per workload.
Who may use it today: agents’ clients, and the clients of services that ask for transaction tokens. Any other app or service’s client can’t authenticate with an SVID yet: give it a key instead (Client authentication).
A SPIFFE ID names one workload, such as spiffe://prod.example.com/ns/agents/sa/invoice-agent. Its first part,
prod.example.com, is the trust domain: the platform that vouches for it.
Before you begin
Section titled “Before you begin”- Who can do it: a realm administrator (a group holding
RealmOwner);RealmViewercan read the settings but not change them. - Where: today this is set through the API (Call the API shows how to get
$CVYUH_SESSION). - First: the agent is registered (AI agents), or the service’s client has
issuesTxnTokens; and your platform issues JWT-SVIDs with ajti(under SPIRE,-jwtSVIDIncludeJTIon the workload entry).
How it works
Section titled “How it works”The agent fetches an SVID from its platform, addressed to the realm’s issuer, and sends it as its client assertion
with its client_id:
curl https://foobar.cvyuh.com/oauth2/token \ -H "DPoP: <proof>" \ -d grant_type=client_credentials \ -d scope=invoices:read \ -d client_id=invoice-agent-client \ -d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-spiffe \ -d client_assertion=eyJhbGciOiJFUzI1NiIsImtpZCI6InByb2QtMSJ9.eyJzdWIiOi….…The SVID’s claims:
{ "sub": "spiffe://prod.example.com/ns/agents/sa/invoice-agent", "aud": ["https://foobar.cvyuh.com/oauth2"], "iat": <unix time>, "exp": <unix time, at most 300 seconds later>, "jti": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"}An agent’s client is held to fapi2 by default, so the request also carries a
DPoP proof.
Set it up
Section titled “Set it up”Name the trust domains the realm trusts in its spiffeTrustDomains (on oauth2Settings), then give the agent’s
client assertionTrust: spiffe and the one spiffeId it answers for. Each call sends your session as
$CVYUH_SESSION (Call the API):
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings \ -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \ -H "Content-Type: application/json" \ -d '{ "spiffeTrustDomains": { "prod.example.com": { "bundleEndpoint": "https://spiffe.prod.example.com/bundle" } } }'
curl -X POST "https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client?id=invoice-agent-client" \ -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \ -H "Content-Type: application/json" \ -d '{ "status": "active", "tokenEndpointAuthMethod": "private_key_jwt", "assertionTrust": "spiffe", "spiffeId": "spiffe://prod.example.com/ns/agents/sa/invoice-agent", "grantTypes": ["client_credentials"], "scopes": ["invoices:read"], "allowedResources": ["https://app.example.com/api"], "defaultAudience": "https://app.example.com/api" }'Then link the client to its agent, as in AI agents.
Limits and defaults
Section titled “Limits and defaults”| Setting or limit | Default | Range |
|---|---|---|
| SPIFFE IDs per client | One | One |
An SVID’s life (clientAssertionMaxLifetimeSecs, plus clockSkewSecs) | 300 seconds, plus 60 | As the realm’s client assertions |
Signing algorithms (tokenEndpointAuthSigningAlgs) | ES256, RS256; ES256 alone for an agent’s fapi2 client | The realm’s list |
| Uses of one SVID | Once, by its jti | Once |
Trust domains (spiffeTrustDomains) | None | As many as you name |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
Every SVID is refused invalid_client | The client is neither an agent’s nor one with issuesTxnTokens | Link the client to its agent, or give a plain service a key |
| The first SVID works and later ones are refused | Your platform reissues the same SVID, or SVIDs carry no jti | Have each fetch return a fresh SVID with a unique jti |
| An SVID is refused after a key change at your platform | The realm still holds the trust domain’s old keys inline | Use a bundleEndpoint, or update jwks |
An SVID signed RS256 is refused for an agent | The agent’s client is fapi2, which takes ES256 or PS256 | Sign with ES256 |
Audit record
Section titled “Audit record”Each token request is a TOKEN_ISSUED record, issued or refused, keyed by the agent the token is about or, for a
refusal, by the client that asked. Changes to spiffeTrustDomains and to the client are in the change history:
Audit → Config in the dashboard.
Good to know
Section titled “Good to know”- One workload per client. The agent’s client names one SPIFFE ID, and only an SVID for exactly that ID authenticates it.
- Only trust domains the realm names. Each one’s keys come inline, or from its bundle endpoint, which must be
httpsand is fetched over the public internet. An SVID from any other trust domain, or signed by a key outside the bundle, is refusedinvalid_client. - Only the algorithms the realm accepts. The SVID is signed with an algorithm in the realm’s
tokenEndpointAuthSigningAlgs. An agent’s client isfapi2by default, which narrows that list to ES256 and PS256, so by default an SVID must be signed ES256. - Each SVID is used once. An SVID must carry a
jti, and the same one is refused the second time, as every client assertion is. One without ajtiis refused. Under SPIRE, register the agent’s workload entry with-jwtSVIDIncludeJTI: each SVID then carries a uniquejti, and every fetch returns a fresh one. - It must be addressed to the realm alone: its
audis the issuer, or a list holding only the issuer. Itsexpmust lie no further ahead than the realm allows a client assertion:clientAssertionMaxLifetimeSecs, 300 seconds by default, plus the realm’s clock skew (clockSkewSecs, 60). Aniatornbf, if present, must not be in the future. - Only as
jwt-spiffe. The same SVID sent as an ordinaryjwt-bearerassertion is refusedinvalid_client. - From there it’s any agent’s client: the agent must be active, and its tokens follow its security profile, DPoP included.
- A workload that asks for transaction tokens may use it too, with no agent: an app with
issuesTxnTokens. Its transaction tokens name it by its SPIFFE ID (req_wl). See Transaction tokens. - It registers no key. A client under
spiffetrust has nojwksorjwksUri: its SVID is its one credential, and a client written with a key beside it is refused. - Dynamic registration doesn’t offer it: a registered client is never an agent’s.
Coming next
Section titled “Coming next”A workload signs in with its Kubernetes service-account token, checked by its cluster, in place of an SVID.
Reference
Section titled “Reference”Settings
Section titled “Settings”| Where | Setting | What it does |
|---|---|---|
| Realm | spiffeTrustDomains | The trust domains whose SVIDs are trusted, each by its keys (jwks) or its https bundleEndpoint, one or the other |
| Realm | tokenEndpointAuthSigningAlgs | The algorithms an SVID may be signed with (ES256, RS256 by default). A fapi2 client uses only the ES256 and PS256 among them |
| Client | tokenEndpointAuthMethod private_key_jwt, and agent naming its agent | The client is an agent’s, and authenticates by a signed assertion |
| Client | assertionTrust spiffe, spiffeId | The agent’s, or the transaction-token workload’s, client is authenticated by the SVID of this one SPIFFE ID, and registers no key |
Errors
Section titled “Errors”invalid_client (401): the SVID doesn’t verify under its trust domain’s keys, names another SPIFFE ID, isn’t
addressed to the realm, has expired or lives too long, has no jti or was used before; or it was sent as
jwt-bearer.
Related
Section titled “Related”- AI agents: the agents that sign in this way.
- Client authentication: every way a client proves itself.
- Transaction tokens: what a workload trades its token for.
- DPoP: binding an agent’s tokens to its key.