i2goSignals

goSignals

26. OAuth Authorization Server Metadata discovery reflects the configured AS (proxy)

Date: 2026-06-23

Status

Accepted (GH #209 follow-up). Builds on ADR 0001 (per-service Keycloak clients — OAuth delegated to an external authorization server), ADR 0023 (local-issuer addressing), and the GH #209 local-rooted-then-bare issuer resolution.

Context

goSignals is an SSF transmitter / resource server. It does not run an OAuth authorization server of its own: the authorization grant and access-token issuance are delegated to an external authorization server (Keycloak in the reference deployment — ADR 0001). goSignals already consumes RFC 8414 OAuth 2.0 Authorization Server Metadata as a client (pkg/oauthClient discoverTokenEndpoint) and advertises the external authorization_servers via RFC 9728 Protected Resource Metadata at /.well-known/oauth-protected-resource.

A concurrent cleanup (this branch) moved the OAuth metadata (authorization_servers, scopes_supported, bearer_methods_supported) out of the SSF Transmitter Configuration document, where it never belonged, leaving RFC 9728 PRM as its home. What remained absent was the RFC 8414 discovery surface itself: a client that resolved /.well-known/oauth-authorization-server[/{issuer}] against goSignals got a 404, even though goSignals knows exactly which authorization server it is bound to.

goSignals does implement a partial authorization-server surface for the bearer tokens it mints itself (stream-management / rotate-on-GET tokens — ADR 0022): /introspect, /revoke, /register, and its JWKS. But it has no authorization_endpoint or token_endpoint — those live on the configured external AS.

So “what should goSignals say at /.well-known/oauth-authorization-server?” splits on whether an external AS is configured. The interesting case is the common one: when Keycloak is configured, the information a client actually needs is about the currently configured authorization server, not about goSignals.

Decision

Serve RFC 8414 metadata at /.well-known/oauth-authorization-server and /.well-known/oauth-authorization-server/{issuer:.+}, with two behaviors keyed off whether an external authorization server is configured (AuthIssuer.GetOAuthServers()):

  1. External AS configured → reflect it verbatim (a discovery proxy). goSignals fetches the configured authorization server’s RFC 8414 document (oauth-authorization-server, falling back to the OpenID Provider openid-configuration — Keycloak serves both) and returns the raw JSON unmodified. The client thereby learns the real AS’s issuer, authorization_endpoint, and token_endpoint, and talks to it directly. Passthrough is lossless (json.RawMessage): no field of the upstream document is dropped through a narrower local struct.

  2. No external AS → advertise goSignals’ own partial surface. A small RFC 8414 document carrying only what goSignals implements directly — introspection_endpoint, revocation_endpoint, registration_endpoint, jwks_uri, and scopes_supported — and deliberately no authorization_endpoint / token_endpoint, so the document never advertises a grant capability goSignals cannot honor.

The optional {issuer} path segment is resolved with the same local-rooted-then-bare lookup SSF §7.2.1 discovery and JWKS serving use (resolveIssuerKeyName, GH #209): a path-bearing variant must address a registered issuer or 404 — it never synthesizes metadata for an unknown issuer. The bare endpoint describes the default issuer.

A configured-but-unreachable authorization server returns 502 Bad Gateway, not the self-document: claiming to be the authorization server when goSignals is not would be misleading.

Considered alternatives

Consequences

Positive

Negative / accepted trade-offs