feat: add AllowedClientAuthMethods to federation automatic registration - #366
Merged
Merged
Conversation
An automatically-registered RP previously chose any supported client authentication method via its own token_endpoint_auth_method metadata, with no operator-side restriction short of federation metadata policy. AllowedClientAuthMethods (on both federation.AutomaticRegistrationConfig and server.AutomaticRegistrationConfig) lets an operator hold federation RPs to a narrower set than its statically registered clients — e.g. private_key_jwt only while static clients use mTLS. An RP declaring an unlisted method fails to resolve, exactly like one with invalid metadata. Empty (the default) permits every method, so existing configurations are unaffected. Invalid entries are rejected at construction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
Adds an operator-side allowlist for which client authentication methods an OpenID Federation automatically-registered RP may use.
Before this,
registeredClientConfigFromMetadataaccepted whatever supportedtoken_endpoint_auth_methodan RP declared in its own metadata. Operators had no way to hold federation RPs to a narrower set than their statically registered clients short of Trust Anchor metadata policy. CIBA and client credentials already have operator switches (AllowsCIBA,AllowsClientCredentialsGrant); the auth method had none.AllowedClientAuthMethods []storage.ClientAuthMethodonfederation.AutomaticRegistrationConfigandserver.AutomaticRegistrationConfig, wired throughserver.New.AllowsCIBA: every supported method is FAPI 2.0-permitted and sender-proving, so the RP choosing one isn't a capability grant. The doc comment explains this.invalid_clientat whichever endpoint it hits: PAR, the token endpoint (including theclient_credentialsgrant) and CIBA. All of them resolve clients through the same wrappedClientRepository.NewAutomaticClientRepositoryrejects invalid enum values in the list.Test plan
TestAutomaticClientRepositoryResolveClientAllowedClientAuthMethods: empty list permits, listed method permits, unlisted method rejectsTestNewWiresAutomaticRegistrationAllowedClientAuthMethods: end-to-end PAR returnsinvalid_client; confirmed this test fails if theserver.Newpass-through is removedinvalid_client); confirmed it succeeds without the allowlist, so the rejection isn't from replaygo vet,go test -race ./...,golangci-lintclean🤖 Generated with Claude Code