Repository navigation
Description
Why?
With auth on, tesk-api validates every token at the user info endpoint of the identity provider and authorizes the user by groups or a claim of the user info. Gateways and other services call TES with tokens of their own, obtained with the OAuth 2.0 client credentials grant (RFC 6749, section 4.4), e.g. the proTES gateway with auth: client_credentials for its backends. Such tokens have no user: the user info endpoint may refuse them, and even if it answers, it releases no groups. So a TESK with auth can't be used behind a gateway, and operators have to choose between leaving TESK open and not offering it through a gateway.
Proposed solution
An optional allow-list of clients whose access tokens tesk-api accepts without the user info:
- Settings (off by default): the issuer, the JWKS URI (default: from the issuer's OpenID Connect discovery document), the claim that names the client (default
client_id, RFC 9068; some providers useazp), and the list of client IDs. - A bearer token that is a JWT is checked locally first: signature against the issuer's JWKS (keys cached, refreshed for an unknown key ID), exact
iss,expandnbf(small leeway), and the client claim in the list. If all hold, the request is authenticated as that client. Otherwise (no JWT, other issuer, client not listed) the token goes the existing way through the user info endpoint, so user tokens keep working as before. - Authorization of such a client: it may create tasks, and list, get and cancel the tasks it created. No group rules apply; the client is a principal of its own (e.g. labelled with the client ID, without a team).
- Optional: require the header
typ: at+jwt(RFC 9068, section 4), so that ID tokens aren't accepted as access tokens. - Log the client ID (not the token) for accepted and refused service tokens.
Tests and docs
- Unit tests with tokens signed by a test key and a local JWKS: accepted client, unlisted client, other issuer, expired, bad signature, unknown key ID (refresh), non-JWT token falling through to the user info path.
- An integration test of the API with both kinds of tokens (service and user).
-
docs/access-control.md(a section on tokens of services, with the trust implications: every holder of a listed client's credentials can run tasks),docs/configuration.md(the settings), and the release notes.
Acceptance criteria
- With the setting on, a token of a listed client creates, lists, gets and cancels its own tasks without a user info call; unlisted clients and invalid tokens get
401. - With the setting off, behaviour is unchanged.
- Docs and tests as above.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity