Skip to content

Build auth.Identity from verified claims #7468

Backlog

Description

@jhrozek

Can start now; it begins with a design decision.

Why. A program that embeds ToolHive's MCP handlers behind its own token verification has to hand them an
auth.Identity. TokenValidator fills that struct, and the rules keep growing: AdmissionRoute (interactive or
delegated) is read by session binding and the per-user credential read, SessionlessGrant is read by the Cedar
authorizer, and AdmittedAfterExpiry marks expired-token admission. An embedder that copies these rules will drift.

What.

  1. Decide the boundary. Does the function only build the Identity, or does it also refuse marked tokens that
    aren't delegated and load upstream tokens by tsid, as TokenValidator.Middleware does? Its inputs must include
    what the route classification needs today: whether the key came from the in-process key provider, whether the
    caller is bound to the embedded issuer, and whether an audience was checked.
  2. Build it. TokenValidator calls the same function, so there is one implementation.

Done when.

  • TokenValidator and the function produce identical Identity values for interactive, delegated (marked),
    session-less and machine tokens, including AdmissionRoute, SessionlessGrant and AdmittedAfterExpiry, shown by
    a table test.
  • The function is documented for embedders.

Activity

  1. added
    needs-triage
    on Dec 2, 2026
  2. added
    enhancement
    go
    on Dec 2, 2026
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

    authenticationauthorizationenhancementgoneeds-triagerefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions