Skip to content

feat: add AllowedClientAuthMethods to federation automatic registration - #366

Merged
osanderson merged 3 commits into
mainfrom
feat/federation-allowed-client-auth-methods
Sep 23, 2026
Merged

osanderson merged 3 commits into
mainfrom
feat/federation-allowed-client-auth-methods

Conversation

@osanderson

@osanderson osanderson commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an operator-side allowlist for which client authentication methods an OpenID Federation automatically-registered RP may use.

Before this, registeredClientConfigFromMetadata accepted whatever supported token_endpoint_auth_method an 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.

  • New AllowedClientAuthMethods []storage.ClientAuthMethod on federation.AutomaticRegistrationConfig and server.AutomaticRegistrationConfig, wired through server.New.
  • Empty (the default) permits every method, so existing configurations are unaffected. It's a restriction, not an opt-in like 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.
  • An RP declaring an unlisted method fails to resolve, the same as one with invalid metadata, so it surfaces as invalid_client at whichever endpoint it hits: PAR, the token endpoint (including the client_credentials grant) and CIBA. All of them resolve clients through the same wrapped ClientRepository.
  • NewAutomaticClientRepository rejects invalid enum values in the list.
  • Statically registered clients (which always take priority) are unaffected.

Test plan

  • TestAutomaticClientRepositoryResolveClientAllowedClientAuthMethods: empty list permits, listed method permits, unlisted method rejects
  • Invalid-config table gains an out-of-range method case
  • TestNewWiresAutomaticRegistrationAllowedClientAuthMethods: end-to-end PAR returns invalid_client; confirmed this test fails if the server.New pass-through is removed
  • Client-credentials wiring test gains an allowlist-rejection subtest (server-to-server token request returns invalid_client); confirmed it succeeds without the allowlist, so the rejection isn't from replay
  • go vet, go test -race ./..., golangci-lint clean

🤖 Generated with Claude Code

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

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@osanderson
osanderson merged commit cdad8e2 into main Sep 23, 2026
9 checks passed
@osanderson
osanderson deleted the feat/federation-allowed-client-auth-methods branch September 23, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant