Repository navigation
Description
State today. "Add oauthproto/idjag with the XAA client and server rules" (#7103) settled the default: when the request has no resource and the ID-JAG has a single-value resource claim, the claim is used (idJAGResource in pkg/authserver/server/tokenexchange/id_jag_handler.go). That closed "ID-JAG grant ignores the assertion's resource claim and requires a form resource" (#6983).
What is left is the comparison. When the request names a resource that the claim does not cover, or the claim is malformed, the redemption is accepted. Only logDraftDepartures notices, and it logs resource_not_covered or resource_malformed. So a client holding an ID-JAG issued for gateway A can redeem it for a token to gateway B, if B's authorization server also trusts the issuer and B's policy allows the subject.
Draft-ietf-oauth-identity-assertion-authz-grant-06 §4.4.1: "The access token MUST be restricted to resources in the resource claim". Accepting the mismatch breaks that MUST. It is the authorization server that departs from the draft here, not the issuer.
Rule
resource claim |
Form resource |
Result |
|---|---|---|
| well-formed, covers it | present | accept (unchanged) |
| well-formed, does not cover it | present | refuse, invalid_target (today: accepted) |
| malformed | any | refuse, invalid_grant (today: claim ignored, the form decides) |
| single value | absent | use the claim (unchanged, from "Add oauthproto/idjag with the XAA client and server rules" (#7103)) |
| array with more than one value | absent | refuse (unchanged) |
| absent | present | the form decides under the existing policy (unchanged) |
| absent | absent | invalid_request (unchanged) |
Why:
- Malformed is
invalid_grant: the fault is in the assertion, and draft §4.4.3 tiesinvalid_grantto "the ID-JAG failed a validation rule in Section 4.4", which a re-issued ID-JAG may fix. Ignoring a malformed claim drops the issuer's restriction entirely. - Absent stays lenient: draft §4.4.1 lets the authorization server choose default resources when the claim is absent. Okta's documented redemption request sends only
grant_type,assertionandscope, so clients that follow Okta keep working. - Mismatch is
invalid_target: the ID-JAG is valid, but the client asked for a resource it does not cover. That is RFC 8707's "the requested resource is invalid". It also matches the handler's other resource refusals.
resource_not_covered and resource_malformed leave the draft-departure log, because they are now refusals.
Behaviour change for existing callers
- Before: a form
resourceoutside the claim was accepted when the subject binding allowed it, and a malformed claim was ignored. - After: both are refused.
A client that follows the draft or Okta's docs omits resource and is unaffected. Mecatl is unaffected because its issuer always signs the claim, and ToolHive's ID-JAG client already refuses to request a resource the claim does not cover (pkg/oauthproto/idjag/exchange.go).
Acceptance
- A form
resourcenot covered by a well-formed claim:invalid_target, no token issued. - A malformed claim (not a string or array of strings, an empty string or empty array, a non-string element, duplicates):
invalid_grant, no token issued. - The unchanged rows keep passing.
- Unit rows in
id_jag_handler_test.gofor string and array claims; a mismatch row intwo_server_id_jag_integration_test.go. - The in-process delegated-agent flow test, step 6: a mismatch row (refused) and a malformed-claim row (hand-signed).
- Tested against a real Okta-issued ID-JAG before relying on the mismatch refusal for Okta. Okta's docs disagree on whether the claim holds the API URL or the issuer.
-
docs/arch/17-token-exchange-delegation.mddescribes the rule (it still describes the exactly-one-resourcerule).
Later, not in this change
- Returning the granted
resourcein the token response. Draft -04 required it (and "ID-JAG grant ignores the assertion's resource claim and requires a form resource" (ID-JAG grant ignores the assertion's resource claim and requires a form resource #6983) asked for it); draft -06 requires only the grantedscopeandauthorization_details. Revisit if a later draft or a client asks for it.
Part of "Delegated access: subject mapping at ID-JAG redemption" (#6887). The client's own audiences remain a separate check, from "Stable pre-provisioned broker client for token exchange and ID-JAG redemption" (#6893).
Activity
Split resource choice from JWT-bearer policy
Let each handler set the default audience
Default the ID-JAG resource to its claim
Accept the issuer as ID-JAG audience
Add oauthproto/idjag with the XAA client and server rules (#7103)
Add reason codes to redemption refusals
Refuse ID-JAGs whose resource claim disagrees (stacklok#7198)