feat: add OAuth2ClientType and derive it from auth method - #28043
Draft
BobbyHo wants to merge 1 commit into
Draft
Conversation
BobbyHo
force-pushed
the
oauth2-custom-scheme-fix
branch
from
August 12, 2026 00:07
d95d4f9 to
9440708
Compare
BobbyHo
force-pushed
the
oauth2-public-clients-vocabulary
branch
from
August 12, 2026 00:18
0d8a377 to
01ec6b3
Compare
…om auth method Split out of #27873 to make that PR smaller to review. Second in the stack; adds the vocabulary the rest of the public-client work is built on, with no behavioral change beyond what it stores. RFC 7591 §2 / OAuth 2.1 §2.1 define two client types: a confidential client authenticates with a secret, a public client authenticates with PKCE alone. DetermineClientType() previously hardcoded "confidential" regardless of the requested token_endpoint_auth_method. It now derives the type via the new ClientTypeFor() mapping, which is the single owner of the auth-method-to-client-type relationship: registration derives the stored client_type from it, and redirect URI validation uses it to pick which RFC 8252 rules apply, so the two cannot disagree about what "public" means. OAuth2ProviderApp.IsPublic() is the reader for the stored client_type column, added alongside matching database constants so the value registration writes and the value IsPublic reads back cannot drift. An unset or unrecognized client type reads as confidential, so an app can never skip client authentication by accident. AllOAuth2TokenEndpointAuthMethods() is the single source both Valid() and (in a later change) discovery metadata read from, so what registration accepts and what /.well-known advertises cannot drift apart either. registration.go and app registration itself do not yet skip secret issuance for a public client; that follows in the next PR in the stack.
BobbyHo
force-pushed
the
oauth2-public-clients-vocabulary
branch
from
August 12, 2026 01:33
01ec6b3 to
3d4b95e
Compare
Contributor
Author
|
/coder-agents-review |
Contributor
|
Chat: Review in progress (13/17 reviewers complete) | View chat deep-review v0.9.0 | Round 1 | Status: Panel review (16 reviewers) About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
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.
Split out of #27873 to make that PR smaller to review. Second in the stack (on top of #28041); adds the vocabulary the rest of the public-client work is built on, with no behavioral change beyond what it stores.
RFC 7591 §2 / OAuth 2.1 §2.1 define two client types: a confidential client authenticates with a secret, a public client authenticates with PKCE alone.
DetermineClientType()previously hardcoded"confidential"regardless of the requestedtoken_endpoint_auth_method. It now derives the type via the newClientTypeFor()mapping, which is the single owner of the auth-method-to-client-type relationship: registration derives the storedclient_typefrom it, and redirect URI validation uses it to pick which RFC 8252 rules apply, so the two cannot disagree about what "public" means.OAuth2ProviderApp.IsPublic()is the reader for the storedclient_typecolumn, added alongside matching database constants so the value registration writes and the valueIsPublicreads back cannot drift. An unset or unrecognized client type reads as confidential, so an app can never skip client authentication by accident.AllOAuth2TokenEndpointAuthMethods()is the single source bothValid()and (in a later PR in the stack) discovery metadata read from, so what registration accepts and what/.well-knownadvertises cannot drift apart either.registration.goand app registration itself do not yet skip secret issuance for a public client; that follows in the next PR in the stack.Refs https://linear.app/codercom/issue/ENG-3029/oauth2-support-public-client