Skip to content

feat: exchange user tokens per TES backend #501

Open

Description

@uniqueg

Why?

Nice-to-have integration with ELIXIR Compute WP2 (AAI), tracked in elixir-cloud-aai/generic-issues#58 (D4.1). LS Login supports OAuth 2.0 token exchange (RFC 8693); the LS AAI operations minutes of 10 December 2025 record "OIDC Token exchange fixed according to specification".

Since #488 (closing #397), proTES can request a client-credentials token per TES backend, so backends can't replay their tokens at each other. Those tokens still name proTES, not the user: backends can't apply their own per-user policy, and #254 lists token exchange as the long-term way to pass the user on. With token exchange, proTES swaps the caller's token for a token whose audience is the backend it calls, so each hop gets a token for itself only, and the user stays the subject.

How?

Opt-in, off by default; nothing changes without the setting.

  1. Config: per identity provider, enable token exchange and choose resource (RFC 8707) or audience, reusing audience_parameter and the per-backend audience of feat: request access tokens per TES backend #488.
  2. On requests made on behalf of a user (create, get, list, cancel relayed to a backend), proTES sends a token exchange request (grant_type=urn:ietf:params:oauth:grant-type:token-exchange, subject_token = the caller's access token, plus the backend's audience) and calls the backend with the result.
  3. Calls without a user request behind them (background polling) keep proTES's own per-backend client-credentials token. Document the difference.
  4. Cache exchanged tokens per subject token and audience, no longer than either token lives; never log or store them.
  5. Errors: a refused exchange fails the request with a clear message that names the audience, not the token.
  6. Docs: docs/access-control.md (what the identity provider must allow per client, e.g. that the caller's token must name proTES in aud, and which targets proTES may exchange for), docs/configuration.md, docs/upgrading.md.
  7. Tests against a mock identity provider; the live check is done in the token exchange testbed.

Fit the design to either outcome of #391 (thin gateway proposal), which makes token exchange a core gateway feature. If proWES needs the same, move the exchange client into FOCA.

Acceptance criteria

  • With the setting on, a backend receives a token whose audience is that backend and whose subject is the user.
  • With the setting off, behaviour is unchanged.
  • Documented, including identity provider requirements.

Blocked by the testbed's live checks against LS Login: client registration (elixir-cloud-aai/token-exchange-flow-testbed#8) and the delegated call chain (elixir-cloud-aai/token-exchange-flow-testbed#10).


Part of the ELIXIR Compute Platform WP4 sprint (M&Ds due end of December 2026); nice to have.

Activity

  1. added
    priority: low
    status: blocked
    type: auth
    workload: days
    flag: nice to have
    on Nov 18, 2026
  2. added
    ecp-wp4: D4.1
    on Nov 18, 2026
  3. moved this from Backlog to Nice to have in ELIXIR On-Cloudon Nov 18, 2026
  4. uniqueg commented on Nov 21, 2026

    @uniqueg
    MemberAuthor

    One more requirement for this feature (decided on 2026-11-21, from LS Login's answers recorded in elixir-cloud-aai/token-exchange-flow-testbed#36): after an exchange, LS Login puts the exchanging client into aud as well, next to the target. So a token proTES obtained for a TES backend would also be accepted by proTES itself.

    • proTES refuses incoming tokens whose client_id (or azp) is proTES's own client, i.e. tokens it obtained itself by exchange. Confirm first in the token exchange testbed (T1) that client_id stays the exchanging client after an exchange; if it doesn't, use the claim T1 shows instead.
    • A test for the refusal, and a line in the auth docs.

    In parallel, LS Login is asked to put only the target into aud.

  5. uniqueg commented on Nov 25, 2026

    @uniqueg
    MemberAuthor

    Update from LS Login (Jan Pavlíček, 24 Nov 2026): in the new LS Login proxy, the calling client's client_id will no longer be added implicitly to aud after a token exchange. The current proxy still adds it, and that can't be switched off.

    Consequence for this issue: the self-refusal check above stays (it covers the current proxy and costs little as defence in depth), but it is no longer the long-term fix. Once the new proxy is live, an exchanged token names only the target in aud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ecp-wp4: D4.1flag: nice to havepriority: lowstatus: blockedtype: authworkload: days

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions