feat(server): catch client RAR types Config.RAR doesn't register - #521
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
A client registered for a Rich Authorization Request type that Config.RAR doesn't register (usually a typo) was refused at request time with nothing to say why, because clients live in the ClientRepository, out of New's sight. - Server.CheckClientRegistration(client) reports such types, for an application to call when registering a client or over every client at startup. The RAR demos now do, after server.New. - When a request is refused for a type the client isn't registered for, and the client's registration lists a type Config.RAR doesn't register, the refusal's cause (for logs, never the response) names it. - storage.RegisteredClient gains AuthorizationDetailsTypes(), sorted. This also closes a gap from per-client RAR types. The server's AutomaticRegistrationConfig had no AuthorizationDetailsTypes, and federation's was never set, so automatically registered clients could request no RAR type at all. The field now exists and is passed through, and New refuses a type Config.RAR doesn't register. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
osanderson
force-pushed
the
feat/server-rar-type-check
branch
from
October 2, 2026 07:43
c31479b to
9299dde
Compare
|
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
This is DevX follow-up: a client registered for a RAR type
Config.RARdoesn't register (usually a typo, e.g.paymnet) was refused at request time with nothing to say why. Clients live in theClientRepository, out ofserver.New's sight, soNewcan't check them.Server.CheckClientRegistration(client storage.RegisteredClient) errorreports registration typesConfig.RARdoesn't register. Call it when registering a client, or over every client at startup. The four RAR demos now call it afterserver.New, so a typo fails startup.Config.RARdoesn't register, the cause names it ("the client's registration lists ["paymnet"], which Config.RAR doesn't register"). The cause goes to logs, never the response.storage.RegisteredClient.AuthorizationDetailsTypes()returns the registered list, sorted.A gap from #506, fixed here.
server.AutomaticRegistrationConfighad noAuthorizationDetailsTypes, andserver.Newnever setfederation.AutomaticRegistrationConfig.AuthorizationDetailsTypes. So an automatically registered client could request no RAR type at all on a server using RAR. The field now exists and is passed through, andNewrefuses a typeConfig.RARdoesn't register. Here, unlike a repository client, the config is in sight at startup.All of this is additive (
feat).Tests
TestRefusalNamesAMistypedRegistration: a client registered forpaymnetis refusedpaymentat PAR withinvalid_authorization_details, and the cause names"paymnet"andConfig.RAR.TestCheckClientRegistration: registered types and no types give nil.paymentpluspaymnetgives an error namingpaymnetalone.TestAutomaticRegistrationAuthorizationDetailsTypes(real Trust Anchor to RP federation fixture): withAuthorizationDetailsTypes: ["payment"], an automatically registered client's client-credentials request for apaymentdetail succeeds. With none, it getsinvalid_authorization_details.Newrefuses["paymnet"]and names it.TestNewRegisteredClientAuthorizationDetailsTypescovers the sorted accessor.go test -race ./server/... ./storage/... ./federation/...passes.🤖 Generated with Claude Code