Skip to content

feat: validate JWT access tokens #222

In progress
In progress

Description

@uniqueg

Context

Part of the TESK access-control redesign: the group model is removed entirely, the owner is identified by issuer and subject, and only task creation is gated by policy. Today TESK API authenticates user tokens only through the IdP's userinfo endpoint. It never checks their issuer, signature or audience itself. Only service-client tokens are validated locally (#153, #220).

Goal

A token validator that validates every access token locally. It sits behind one interface, so that other kinds of validation (for example RFC 7662 introspection of opaque tokens) can be added later without rework.

  • TokenValidator interface; the implementation is selected by tesk.api.auth.token-validator (only jwt for now).
  • The JWT implementation accepts JWT access tokens only:
    • typ at+jwt;
    • iss exactly one of the configured issuers;
    • keys from the issuer's OIDC discovery, or from a configured JWKS URI (https only);
    • asymmetric algorithms only;
    • exp, iat and sub required; nbf, maximum age and clock skew checked.
  • Audience:
    • user tokens: aud must contain one of the issuer's configured front-end client IDs;
    • listed service clients (iss + client ID from an allow list; client claim == sub == the client ID): aud must contain the client's own ID.
  • The principal is <iss>|<sub>. There is no group model.
  • Not wired into request authentication in this issue. Wiring is a follow-up that also removes the userinfo authentication and ServiceClientTokenServices.

Acceptance criteria

  • Unit tests for every check, including the refusals: unknown issuer, wrong audience, symmetric algorithms or none, wrong typ, expired or not yet valid, user sub equal to a listed client ID, delegated tokens (act).
  • Invalid settings fail at startup.
  • 100% coverage (repo rule).
  • Developer docs describe the interface and the settings.
  • The audience defaults are confirmed against a real LS Login user token (typ, aud, where the entitlements live) before the wiring issue starts.

Out of scope

  • Wiring into Spring Security.
  • Entitlement lookup and the decision-service call on create.
  • Delegated tokens / trusted actors (open question).
  • Introspection.

Activity

  1. added
    type: feature
    on Nov 25, 2026
  2. self-assigned this
    on Nov 25, 2026
  3. added
    priority: high
    status: in progress
    workload: hours
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: highstatus: in progresstype: featureworkload: hours

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions