Skip to content

feat: add OAuth2 client credentials grant type and user ownership #18841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: thomask33/07-10-feat_add_cleanup_for_expired_oauth2_provider_app_codes_and_tokens
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 36 additions & 3 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions coderd/database/dbgen/dbgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ func OAuth2ProviderApp(t testing.TB, db database.Store, seed database.OAuth2Prov
RedirectUris: takeFirstSlice(seed.RedirectUris, []string{"http://localhost"}),
ClientType: takeFirst(seed.ClientType, sql.NullString{String: "confidential", Valid: true}),
DynamicallyRegistered: takeFirst(seed.DynamicallyRegistered, sql.NullBool{Bool: false, Valid: true}),
UserID: takeFirst(seed.UserID, uuid.NullUUID{Valid: false}),
ClientIDIssuedAt: takeFirst(seed.ClientIDIssuedAt, sql.NullTime{}),
ClientSecretExpiresAt: takeFirst(seed.ClientSecretExpiresAt, sql.NullTime{}),
GrantTypes: takeFirstSlice(seed.GrantTypes, []string{"authorization_code", "refresh_token"}),
Expand Down
6 changes: 5 additions & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions coderd/database/foreign_key_constraint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Restore refresh_hash as NOT NULL (existing data should still be valid)
ALTER TABLE oauth2_provider_app_tokens
ALTER COLUMN refresh_hash SET NOT NULL;

-- Remove user_id column from OAuth2 provider apps
ALTER TABLE oauth2_provider_apps
DROP COLUMN user_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Add user ownership to OAuth2 provider apps for client credentials support
ALTER TABLE oauth2_provider_apps
ADD COLUMN user_id uuid REFERENCES users(id) ON DELETE CASCADE;

-- Make refresh_hash nullable to support client credentials tokens
-- RFC 6749 Section 4.4.3: "A refresh token SHOULD NOT be included" for client credentials
ALTER TABLE oauth2_provider_app_tokens
ALTER COLUMN refresh_hash DROP NOT NULL;
1 change: 1 addition & 0 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading