Skip to content

Tracking: P0-4 — Write audience on token issuance (introspection aud) #258

Closed

Description

@voidvec

Problem

OAuth2AccessToken has an audience field, but no issuance path ever writes it, and introspection therefore always returns an empty aud. Resource servers cannot narrow tokens by audience — every user access token is valid against every resource the user can reach. RFC 8707 resource indicators are not implemented either (that is roadmap P3); this issue only eliminates the dead field so aud reflects reality.

Evidence

  • libs/oauth2/include/fulla/oauth2/protocol/Dto.h:117 — the audience DTO field exists.
  • libs/oauth2/src/protocol/TokenService.cc:336-353 — the access-token assignment list (token/clientId/userId/scope/issuedAt/expiresAt/issuer/orgId) never assigns audience.
  • libs/storage-postgres/src/PostgresTokenRepository.cc:631-646 — introspection maps aud from the (never-written) column, so it is always empty.

Suggested fix

Full design in deliverables/p0-fix-design-2026-10.md §P0-4 (pending review):

  • Write audience = client_id on issuance in both the authorization-code and client-credentials paths; refresh inherits the value. Confirm the DTO field's concrete type (string vs array) during implementation and adapt.
  • Introspection maps the stored audience into aud. Pre-existing rows with empty audience simply omit aud until they drain via TTL.
  • No new request parameters (RFC 8707 resource stays in P3).

Acceptance criteria

  • Introspection of a freshly issued token returns aud equal to the client id.
  • Refresh rotation preserves aud.
  • No new protocol parameters introduced.

Out of scope / follow-ups

  • RFC 8707 resource indicators and per-RS narrowing (roadmap P3-1).
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions