Repository navigation
Description
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, schemacharts/tesk/values.schema.json:668): a flat list
auth.tokenClients.clientsand oneauth.tokenClients.audienceshared 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.ServiceClientsholdsclientIdsand one
audience;ServiceClientTokenServices.java:170and :410 check every listed client's token against that one value. - So every client must get tokens with the same audience. Making
audiencea 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
audholds one of that client's
audiences; all other checks (requireAtJwt,requireClientSubject, issuer, signature) stay as they are. auth.tokenClients.audiencegoes away; whetherallowAnyAudiencestays (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:
clientsis an object of client ID ->{audiences: [non-empty strings], ...},additionalProperties: falseper client; the old list form andaudiencefail 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 onallowAnyAudience). - 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.mdhere 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity