Skip to content

ID-JAG issuance through token exchange #6898

Closed

Description

@jhrozek

Part of #6886. Depends on #6897 (grants through token exchange).

Problem: ToolHive only redeems ID-JAGs. A delegated client needs to request an ID-JAG for a gateway that has its own authorization server, using a grant it holds.

Change:

  • Token exchange with subject_token_type=refresh_token and requested_token_type=urn:ietf:params:oauth:token-type:id-jag (required). It is handled by Refresh tokens through token exchange, as generic grants #6897's refresh-token handler, whose routing already claims this combination and refuses it today.

  • The subject token is a grant from Refresh tokens through token exchange, as generic grants #6897:

    • it is for the authenticated client and lists id-jag;
    • it is not revoked and not expired;
    • if it has a parent, the parent exists and is not revoked. This is checked on every request.

    Refusals: revoked, parent_revoked, or not_issuable (a grant that lists refresh_token). A forged, unknown, expired or other-client token gets the one code grant_invalid, as on the derive path.

    Three handler changes are needed: allow refresh token to ID-JAG in the routing decision; split the combined depth-and-type check so a child grant can issue ID-JAGs; and give the ID-JAG branch its own request-parameter check. The derive path's checkRefreshTokenParams refuses audience and resource with invalid_target, but draft §4.3 makes audience REQUIRED for an ID-JAG request (resource is OPTIONAL).

  • Targets come from client configuration, not the grant. A grant carries no target bound. audience must be one of the target authorization servers configured for the client, and resource a resource configured for that target; otherwise invalid_target. The configuration may not name this server itself (draft §9.3). The ID-JAG's client_id is the client's ID at the target server, from configuration.

  • ID-JAG claims and header follow draft-ietf-oauth-identity-assertion-authz-grant §3.1:

    • header typ: oauth-id-jag+jwt;
    • claims iss, sub (from the grant, never from the request), aud, client_id, jti, exp, iat, resource;
    • a short lifetime, about 60 s.
  • Without Pluggable actor-token validation at ID-JAG issuance #6899, ID-JAGs carry no act.

  • upstream_subject and sub_id. When the target is configured for it, include upstream_subject (the user's company-IdP identity: issuer plus a configured stable claim, as Emit sub_id (RFC 9493) with the user's upstream identity in access tokens #6900 emits in access tokens) and sub_id (RFC 9493), both read from the grant, which copied them from the subject token when it was created (Refresh tokens through token exchange, as generic grants #6897). A grant that lacks upstream_subject cannot issue an ID-JAG for a target that requires it: refuse with invalid_request and a stable reason of its own, named in the implementation and documented in the profile. The target's authorization server finds the local user from upstream_subject, in both embedded and external mode, and compares it with the approving user's identity when an approval is created. The target must not use either claim to link accounts on its own, only through its configured subject mapping and approval (§9.5).

  • Only grants can produce ID-JAGs. This server issues ID-JAGs only from grants, never from ID tokens or access tokens (§4.3 allows ID tokens; this profile does not), so only a client holding a revocable grant can mint them.

  • Audit: an exchange_grant.id_jag_issued log line with client, sub, target, ID-JAG jti, and whether the grant has a parent. Never token values.

Acceptance:

  • an ID-JAG from this server is accepted by a ToolHive gateway's redemption;
  • an audience or resource outside the client's configured targets is refused with invalid_target;
  • a revoked grant gets revoked;
  • a child grant whose parent is revoked gets parent_revoked;
  • a grant that lists refresh_token gets not_issuable;
  • sub comes from the grant even if the request tries to set it;
  • an ID-JAG for a target that requires upstream_subject carries the value the grant recorded, also when the grant is a child; a grant without it is refused.

Activity

  1. added
    needs-triage
    on Oct 21, 2026
  2. removed
    needs-triage
    on Nov 2, 2026
  3. self-assigned this
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions