Skip to content

ADR-0013: Every caller resolves to an internal account, and authorization is computed on the server per request

Status: accepted (2026-10-26) · Scope: authentication and authorization in rn-forge-auth and every framework binding

Decision

  • Identity resolves to an account first. Every login method ends in the same protocol-neutral external identity. Every caller, session or bearer, then resolves to an internal account through (issuer, subject), never through a subject alone or an email. Nothing after that point depends on the protocol that ran.
  • Authorization is computed per request. Sessions and tokens carry identity only. What a caller may do is computed on the server for each request from the application's current data, and cached with explicit invalidation.
  • Scopes only limit. A token's scopes narrow its account's permissions and never grant one.
  • The UI gets a copy. The SPA receives the effective permissions to show or hide features. The server enforces every check again.

Consequences

  • A bearer token whose (issuer, subject) has no linked account is rejected. Machine clients need a service account the application links explicitly.
  • Every request costs an authorization-context lookup. A versioned cache with an invalidation API, plus a time-to-live for changes that bypass it, keeps that cheap and bounds staleness.
  • A permission change, an account disablement or a revocation applies on the next request, without reissuing anything.
  • Routes check permissions, never roles, so a read-only token cannot pass a role check on a write route. Requirement loses its role clauses, a breaking change.

Influences

E13's design: its pipeline, contracts, authorization model and account linking. F13.3 builds the contracts.

Alternatives considered

  • Permissions, roles or profile data inside the token or session. They are frozen until expiry, grow every request, and expose personal data to anyone holding the token.
  • Bearer callers authorized from token claims alone. The application's own data (entitlements, org structure, tenancy) would never reach a machine client's decision, and session and bearer callers would follow two models.
  • Linking accounts on (provider, email). A provider that does not verify email becomes an account-takeover path.
  • Role checks on routes. A role passes regardless of a token's scopes.