Skip to content

feat: add OAuth2ClientType and derive it from auth method - #28043

Draft
BobbyHo wants to merge 1 commit into
oauth2-custom-scheme-fixfrom
oauth2-public-clients-vocabulary
Draft

feat: add OAuth2ClientType and derive it from auth method#28043
BobbyHo wants to merge 1 commit into
oauth2-custom-scheme-fixfrom
oauth2-public-clients-vocabulary

Conversation

@BobbyHo

@BobbyHo BobbyHo commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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 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 PR in the stack) 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.

Refs https://linear.app/codercom/issue/ENG-3029/oauth2-support-public-client

@BobbyHo BobbyHo changed the title feat(codersdk,coderd/database): add OAuth2ClientType and derive it from auth method feat: add OAuth2ClientType and derive it from auth method Aug 11, 2026
@BobbyHo
BobbyHo force-pushed the oauth2-custom-scheme-fix branch from d95d4f9 to 9440708 Compare August 12, 2026 00:07
@BobbyHo
BobbyHo force-pushed the oauth2-public-clients-vocabulary branch from 0d8a377 to 01ec6b3 Compare August 12, 2026 00:18
…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
BobbyHo force-pushed the oauth2-public-clients-vocabulary branch from 01ec6b3 to 3d4b95e Compare August 12, 2026 01:33
@BobbyHo

BobbyHo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Chat: Review in progress (13/17 reviewers complete) | View chat
Requested: 2026-08-12 01:33 UTC by @BobbyHo

deep-review v0.9.0 | Round 1 | 450d037..3d4b95e

Status: Panel review (16 reviewers)

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

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