feat(server): wire automatic client registration into server.Config - #260
Merged
Conversation
Adds server.Config.AutomaticRegistration (optional, "zero disables the feature" like every other opt-in capability here) and Dependencies.FederationHTTP. When TrustAnchors is set, New transparently wraps Dependencies.Clients/ClientKeys with federation.AutomaticClientRepository/AutomaticClientKeySource — every other internal (PAR, the token endpoint, CIBA) keeps calling those same Dependencies fields exactly as before, unaware an automatically- registered Relying Party is now also possible. Statically registered clients always take priority, matching those types' own precedence. Also fixes a real bug in AutomaticClientKeySource found while writing this PR's own end-to-end test: it treated any error-free result from Underlying as final, including an empty VerificationKeySet — but keys.ClientKeySource legitimately returns an empty, error-free set to mean "no matching key" (e.g. an unrecognized kid), the same way fakeClientKeySource (server's own test double) already behaves for an unknown client. An empty result now falls through to federation resolution exactly like an error would. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017N2kkxv9BR4Qmj8De3Ucs6
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
server.Config.AutomaticRegistration(optional — zero value disables it entirely, matching this package's existing "zero disables the feature" precedent) andDependencies.FederationHTTP.TrustAnchorsis set,Newtransparently wrapsDependencies.Clients/ClientKeyswithfederation.AutomaticClientRepository/AutomaticClientKeySource(feat(federation): add automatic client registration (OpenID Federation 1.0 §12.1) #259) — every other internal (PAR, the token endpoint, CIBA) keeps calling those sameDependenciesfields exactly as before, unaware an automatically-registered Relying Party is now also possible. Statically registered clients always take priority.AutomaticClientKeySourcetreated any error-free result fromUnderlyingas final, including an emptyVerificationKeySet— butkeys.ClientKeySourcelegitimately returns an empty, error-free set to mean "no matching key" (the same wayserver's ownfakeClientKeySourcetest double already behaves for an unknown client), so this silently defeated the federation fallback wheneverUnderlyinghad that shape. An empty result now falls through to federation resolution exactly like an error would.Test plan
go build ./...go test -race ./...golangci-lint run ./...— 0 issuesConfig.AutomaticRegistrationvalidation (empty allowed scopes, zero max cache age, zero max path length, nilFederationHTTP, a malformedTrustAnchorsentry), zero-value config leaves the server behaving exactly as before, and — the real proof this actually works — a genuine end-to-end test over real HTTPS test servers whereDependencies.Clients/ClientKeysare both deliberately empty (no static client could ever resolve) andPushAuthorizationRequeststill succeeds for a Relying Party authenticated with the key it published in its own federation-resolvedopenid_relying_partymetadata.serverpackage coverage: 87.3%;federationpackage (bug fix): 98.2%🤖 Generated with Claude Code
https://claude.ai/code/session_017N2kkxv9BR4Qmj8De3Ucs6