Skip to content

tokenClients: audiences per client #336

Done

Description

@uniqueg

Context

auth.tokenClients (chart 0.4.0, tesk-api 2.0.0) lets tesk-api accept access tokens of listed clients (client
credentials grant) without userinfo. We will have two such clients at LS Login: proTES' gateway client and a
dedicated client for automated smoke tests. Each should be accepted only at its own audiences.

Current behaviour

  • Values (charts/tesk/values.yaml:324, schema charts/tesk/values.schema.json:668): a flat list
    auth.tokenClients.clients and one auth.tokenClients.audience shared by all clients (or
    allowAnyAudience: true, which accepts any audience).
  • charts/tesk/templates/_helpers.tpl:871 (tesk.tokenClientsEnv) renders
    TESK_API_AUTHORISATION_SERVICE_CLIENTS_CLIENT_IDS (comma-joined) and ..._AUDIENCE.
  • tesk-api (elixir-cloud-aai/tesk-api): AuthorisationProperties.ServiceClients holds clientIds and one
    audience; ServiceClientTokenServices.java:170 and :410 check every listed client's token against that one value.
  • So every client must get tokens with the same audience. Making audience a flat list wouldn't help: every client
    would be accepted at every audience in it.

Proposal

auth.tokenClients.clients becomes a map from client ID to per-client settings, starting with audiences:

auth:
  tokenClients:
    enabled: true
    issuer: https://login.aai.lifescience-ri.eu/oidc/
    clients:
      <client ID>:
        audiences: [https://tesk.example.org]
  • A token is accepted if its client claim names a listed client and its aud holds one of that client's
    audiences; all other checks (requireAtJwt, requireClientSubject, issuer, signature) stay as they are.
  • auth.tokenClients.audience goes away; whether allowAnyAudience stays (moved per client) or goes is decided in the
    PR (proposal: per client, default false).
  • The object leaves room for more per-client settings later (none now).
  • Clean break, no compatibility layer: the next chart release is already breaking (feat(chart): support restricted namespaces #331), and the flat form has been
    out only since 0.4.0 / tesk-api 2.0.0. Upgrade notes in both repos say how to convert.
  • Must land before tesk-api 2.1.0 and the next chart release.

The chart owns the schema, so this issue is here. tesk-api needs the matching change (property and env format, the
per-client audience check after reading the client claim); it gets its own linked issue in elixir-cloud-aai/tesk-api,
and both PRs are released together. The env format is the tesk-api PR's choice (e.g. one JSON variable, since client
IDs don't bind well to Spring map keys from env).

Long term, RFC 8693 token exchange (a token per backend audience, issued on demand) is the proper fix for gateways
like proTES; this change makes per-client audiences possible meanwhile.

Acceptance criteria

  • Schema: clients is an object of client ID -> {audiences: [non-empty strings], ...}, additionalProperties: false per client; the old list form and audience fail the schema check with a hint to the upgrade notes.
  • The chart renders the new env for tesk-api and fails with a clear message on a client without audiences
    (unless allowed otherwise per the PR's decision on allowAnyAudience).
  • tesk-api: client A's token with client B's audience is refused; each client's token with its own audience is
    accepted.
  • Upgrade notes (docs/upgrading.md here and in tesk-api), configuration reference (docs/configuration.md:139ff)
    and deployment guide ("Tokens of services") updated.

Tests

Chart: tests/test_chart.py cases for the map form, rendering, and the refusals above. tesk-api:
ServiceClientTokenServicesTest (per-client audiences, cross-client refusal) and ServiceClientAuthIT.

Activity

  1. added
    priority: high
    status: triage
    type flag: breaking change
    type: auth
    workload: days
    ecp-wp4: M4.4
    on Nov 23, 2026
  2. added
    status: in progress
    and removed
    status: triage
    on Nov 23, 2026
  3. self-assigned this
    on Nov 23, 2026
  4. moved this from Backlog to In progress in ELIXIR On-Cloudon Nov 23, 2026
  5. moved this from In progress to In review in ELIXIR On-Cloudon Nov 23, 2026
  6. added this to the v0.5.0 milestone on Nov 23, 2026
  7. moved this from In review to Done in ELIXIR On-Cloudon Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ecp-wp4: M4.4priority: highstatus: in progresstype flag: breaking changetype: authworkload: days

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions