Skip to content
Workforce IdentityMarkdown

Cross-domain chaining

A user's or an agent's authority crosses from one realm or organization to another, keeping who acts for whom, with each side's rules held at its own hop.

AvailableAPIOAuth Identity and Authorization Chaining Across Domains (draft), RFC 8693, RFC 7523

Cross-domain chaining carries a caller’s authority into another domain: a partner, or another of your realms. An app or agent holding a token here trades it for a short chaining grant addressed to the other domain, and presents the grant there for that domain’s own token. The grant carries the chain of who acts for whom, so the other side sees the agent acting for the user, and each domain still applies its own rules at its own hop.

Use it when an agent acting for a user here must call a partner’s API and the partner must see both, or when two realms must pass a caller’s authority across without the user signing in again. The realm plays both sides: it issues grants to the partners you list, and redeems grants from the partners you trust. For a user alone, with only their ID token, use issuing identity assertions instead.

  • Who can do it: a realm administrator (a group holding RealmOwner) lists the partners on each side; RealmViewer can read them. Clients then issue and redeem grants themselves.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION).
  • First: each partner’s issuer name and keys, and an agreement on which side issues and which redeems.

1. The client asks for a grant, by a token exchange that asks for a JWT and names an audience:

Terminal window
curl https://foobar.cvyuh.com/oauth2/token \
-d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \
-d requested_token_type=urn:ietf:params:oauth:token-type:jwt \
-d subject_token=eyJ0eXAiOiJhdCtqd3Qi… \
-d subject_token_type=urn:ietf:params:oauth:token-type:access_token \
-d audience=https://auth.partner.example/ \
-d scope=travel:read \
-d client_id=invoice-agent-client \
-d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer \
-d client_assertion=eyJ…
{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6…",
"issued_token_type": "urn:ietf:params:oauth:token-type:jwt",
"token_type": "N_A", "expires_in": 60 }

The grant is in access_token, as RFC 8693 names the field, though it isn’t an access token here. Without an audience, the same exchange issues an ordinary access token of this realm’s instead: see token exchange.

The grant is signed RS256, with no typ in its header. It names the user (sub), the partner (aud) and the client by its ID at the partner (client_id). It carries the token’s act, principal_type, mode and risk_class as they are, and resource and scope when there are any.

2. The client presents the grant at the other domain, under the JWT bearer grant. Where the other domain is another realm, that is:

Terminal window
curl https://foobar.cvyuh.com/oauth2/token \
-d grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer \
-d assertion=eyJhbGciOiJSUzI1NiIsImtpZCI6… \
-d client_id=partner-invoice-agent \
-d client_assertion_type=… \
-d client_assertion=eyJ…

The answer is a normal token response about the linked user there. The other domain’s chain comes across marked as that domain’s: each hop carries its iss, so a resource here never mistakes another domain’s agent for one of yours. A token with a chain is marked mode delegated.

Set the grants on the realm (PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings) and the client (https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client; see Call the API), then create the objects for each partner:

WhereSettingWhat it does
Realm and clientgrantTypes include token exchange (to issue) or urn:ietf:params:oauth:grant-type:jwt-bearer (to redeem)Off by default. Both need a confidential client
oauth2AssertionAudienceissues includes chaining, and clients names the clientA partner you issue grants to. Its lifetimeSecs can shorten a grant, never past 60
oauth2TrustedIssueraccepts includes chainingA partner whose grants you redeem
foreignIdentitylink and personId, both required; personOne user’s link to the partner, as for the identity assertion grant
RealmmaxActDepthHow many agents a chain may hold, across both domains (default 4, 1 to 16)
Setting or limitDefaultRange
A chaining grant’s life60 secondsan audience’s lifetimeSecs can shorten it; never past the token it came from
maxActDepth: agents in the chain, both domains together41 to 16
Redemptions per grantonefixed
What a redemption buysan access token, no refresh tokenfixed
SymptomCauseFix
invalid_target when issuingThe audience doesn’t issue chaining, or is inactiveAdd chaining to its issues
invalid_grant when redeeming every grant from a partnerIts trusted issuer doesn’t accept chaining, or its keys or issuer don’t matchCheck the oauth2TrustedIssuer
invalid_grant for an agent’s redemptionYour agent may not act for the user here, or the chain is too deepLink the agent to the user and allow it in your delegation policy; shorten the chain
interaction_requiredYour agent’s guardrail holds the scope for its ownerHave the owner approve, or ask for less

Issuing a grant is a TOKEN_EXCHANGED record keyed by the user, with the token it came from as its parent. Redeeming one is a TOKEN_ISSUED record with grantType urn:ietf:params:oauth:grant-type:jwt-bearer, naming the partner in assertionIssuer. Both, allowed or refused, are on the user’s trail (Read a user’s or agent’s trail) and in Audit → Authentication.

When the realm issues a grant:

  • The token exchanged must be this realm’s access token, issued for the client exchanging it, and still active.
  • The partner must be an assertion audience that issues chaining grants (issues includes chaining), and the client must be named on it. An audience that doesn’t issue them answers as an unknown one.
  • No actor token. The grant carries the subject token’s own chain, so an actor_token is refused.
  • It never widens. The grant carries no more scope than the token had, nor than the audience allows. With no scope asked, it carries the token’s scopes within the audience’s.
  • It is short-lived: at most a minute, and never past the token it was made from.

When the realm redeems a grant:

  • It must come from a partner you trust for chaining. The grant must come from a trusted issuer whose accepts includes chaining, be signed with one of the realm’s tokenEndpointAuthSigningAlgs, be addressed to this realm, name the redeeming client, be fresh, and be used once.
  • The user is found only through a link you made, as for an identity assertion.
  • Only an untyped grant is redeemed this way. An access token, an ID token or an identity assertion presented in its place is refused.
  • Your own rules hold at your hop. When an agent of yours presents the grant, it acts in front of that chain only where it may act for the user here, under your own delegation rules. It is held to its guardrails, and the whole chain, both domains’ hops together, to maxActDepth.
  • An access token only, never a refresh token. It is held to the realm’s governed scopes. Every redemption is on the audit trail.
ErrorSideWhen
invalid_requestIssuingThe subject token isn’t this realm’s access token, isn’t for this client, is no longer active or has expired; an actor_token is sent; a parameter is repeated
invalid_targetIssuingThe audience is unknown, inactive or doesn’t issue chaining grants; a resource it doesn’t govern
access_deniedIssuingThe audience doesn’t name this client
invalid_grantRedeemingThe grant is malformed, carries a header typ (other than an identity assertion’s, which is redeemed as one), comes from an issuer you don’t trust for it, or doesn’t verify; it isn’t addressed here, has expired, names another client or was already redeemed; it names no linked, active user; your agent may not act for the user; the chain is deeper than maxActDepth
invalid_scope, invalid_targetRedeemingAs for any grant: a scope or a resource the client may not have
interaction_requiredRedeemingYour agent’s guardrail needs its owner’s approval for a scope