Repository navigation
Open
Labels
Description
Summary
Let an application that embeds the auth server declare its own OAuth clients in authserver.Config. The auth server then writes those clients to storage at every startup and owns them, the same way it already owns configured delegate clients.
Motivation
Today, an embedder that needs a fixed internal client, for example a public PKCE client used by its own UI flow, writes it straight into storage with ClientRegistry.RegisterClient before it starts the server. Then the embedder has to:
- check for drift by hand: compare the stored client with the one it expects, and decide what to do when they differ;
- keep track of the client for its whole lifetime: renaming or retiring the client leaves the old row in storage;
- make it behave the same on the memory and Redis backends.
Configured delegate clients already avoid all of this. They are declared in config and reconciled into storage at startup. Embedder clients should work the same way.
Proposal
- Add
Config.ProvisionedClients []fosite.Client(Go API only, not part of RunConfig or the CRD). - At startup, write each client with
ReconcileConfiguredClient, next to the delegate client registration. That covers drift correction and the cross-replica conflict checks, as it does for delegates. - Treat config as the only source of truth. A client removed from the list is no longer served after a restart, as with delegate clients.
- Validation: reject nil clients, DCR-marked clients, URL-shaped IDs (they are reserved for CIMD), duplicate IDs, and collisions with delegate or SPIFFE client IDs.
- Document the migration for embedders that call
RegisterClienttoday: replace the call and the drift check with the config entry.
Notes
- A client served only from an in-memory overlay, with no stored row, was considered and rejected. The Redis backend rebuilds authorization-code and refresh-token sessions from the stored client row, so interactive clients need a row.
- Rolling updates where replicas run different configs would overwrite each other's rows. That is the same behaviour as delegate clients today.
- This builds on in-flight work on configured clients in the embedded auth server. Implementation should start after that lands.
Activity