Skip to content

App Suite session auth first, OIDC later

  • Deciders: David Bauer, Julian Bäume
  • Date: 2026-06-12

Status

Accepted

Context

Booking replaces the Java booking-service, and the callers we need to bring across first — the App Suite owner plugin (ui-plugin) and the public poll page (ui-poll) — authenticate today against App Suite's classic session model: a session query parameter or open-xchange-session* cookie, resolved against the middleware (GET /appsuite/api/user/me), gated by the booking capability, with ownership checks on mutations. Voter/vote endpoints are intentionally public (see ADR-0005).

We must decide what auth booking ships with first. We are not obliged to reproduce the Java service's auth model indefinitely; the goal is a clear migration path for existing users onto booking, delivered incrementally, and support for OIDC bearer tokens is a direction we want. The question is sequencing, not either/or.

Decision

Ship classic App Suite session resolution first and add OIDC as a planned, additive second step. This is an incremental-delivery choice: it lets us cut existing users over onto booking without a coordinated auth change, then layer OIDC in behind the same interface without touching the routes that already work.

Ship a custom Fastify session plugin (src/plugins/session.ts) that resolves the classic App Suite session model, with plugins: { jwt: false } in createApp() for now. OIDC (minting/consuming bearer tokens rather than classic sessions) is an explicitly planned second step, to be added behind the same request-decorator interface (request.appsuite, see src/types/fastify.d.ts) so existing routes don't change when it lands.

The session plugin:

  1. Extracts the session query parameter or an open-xchange-session* cookie — the query parameter always wins.
  2. Cookie-only resolution is opt-in per route via allowCookieOnlySession(), used by the public poll-read route so an invitee who happens to be logged into App Suite is recognized without requiring a session parameter.
  3. Resolves the current user via GET /appsuite/api/user/me on demand, with a per-request cache (getCurrentUser() memoizes by session id) so repeated calls within one request don't re-hit the middleware.
  4. autohooks.ts-style route guards enforce session + booking capability for owner routes; public voter/vote/poll-read routes skip that guard entirely.

The undici client composition that injects session and cookies into every middleware call (src/appsuite/client.ts) and the request.appsuite type augmentation (src/types/fastify.d.ts) are shared with the planned OIDC step: only how the session is obtained changes, not how it is consumed downstream.

Consequences

Positive

  • Existing users migrate onto booking without an auth change: ui-plugin and ui-poll keep sending the same session query parameter/cookie they always have, so the auth model is not on the critical path for the initial cutover.
  • The first release ships less code and less risk: no OIDC client, token exchange, or session-store complexity to build (or secure) before it is needed. The classic-session code is small and directly auditable against the Java SessionContext it replaces.
  • The public/owner route split (allowCookieOnlySession(), capability + ownership checks) is centralized in one plugin and one set of route guards, not duplicated per route.
  • OIDC can be added incrementally behind the existing request.appsuite interface, so it does not block the initial delivery and does not force a rewrite of the routes when it arrives.

Negative

  • No OIDC support yet — Booking cannot serve callers that only have an OIDC bearer token and no classic App Suite session until the planned second step lands.
  • The per-request user cache is intentionally short-lived (session-keyed, request-scoped) rather than shared across requests, trading a little redundant middleware traffic for simplicity and freshness.
  • Query param vs. cookie precedence is a security-relevant behavior (see Security); any future refactor of the session plugin needs to preserve it deliberately, not incidentally.

References

  • src/plugins/session.ts, src/appsuite/client.ts, src/types/fastify.d.ts
  • ADR-0005 — the API decision this auth model serves