Skip to content

Commit 8c29819

Browse files
committed
feat(oauth2): add frontend UI for client credentials applications
- Add ClientCredentialsAppForm and ClientCredentialsAppRow components - Update API schemas to include created_at, grant_types, and user_id fields - Add dedicated pages for creating and managing client credentials apps - Update sidebar navigation and routing for OAuth2 client credentials - Enhance OAuth2AppPageView with user ownership information display Change-Id: I3271c7fb995d7225dd6cc830066fa2c8cb29720a Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent c654948 commit 8c29819

File tree

19 files changed

+1218
-70
lines changed

19 files changed

+1218
-70
lines changed

coderd/apidoc/docs.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/db2sdk/db2sdk.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,19 @@ func TemplateVersionParameterOptionFromPreview(option *previewtypes.ParameterOpt
354354
}
355355

356356
func OAuth2ProviderApp(accessURL *url.URL, dbApp database.OAuth2ProviderApp) codersdk.OAuth2ProviderApp {
357+
var userID uuid.UUID
358+
if dbApp.UserID.Valid {
359+
userID = dbApp.UserID.UUID
360+
}
361+
357362
return codersdk.OAuth2ProviderApp{
358363
ID: dbApp.ID,
359364
Name: dbApp.Name,
360365
RedirectURIs: dbApp.RedirectUris,
361366
Icon: dbApp.Icon,
367+
CreatedAt: dbApp.CreatedAt,
368+
GrantTypes: dbApp.GrantTypes,
369+
UserID: userID,
362370
Endpoints: codersdk.OAuth2AppEndpoints{
363371
Authorization: accessURL.ResolveReference(&url.URL{
364372
Path: "/oauth2/authorize",
@@ -369,6 +377,9 @@ func OAuth2ProviderApp(accessURL *url.URL, dbApp database.OAuth2ProviderApp) cod
369377
DeviceAuth: accessURL.ResolveReference(&url.URL{
370378
Path: "/oauth2/device/authorize",
371379
}).String(),
380+
Revocation: accessURL.ResolveReference(&url.URL{
381+
Path: "/oauth2/revoke",
382+
}).String(),
372383
},
373384
}
374385
}

codersdk/oauth2.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/http"
1010
"net/url"
1111
"strings"
12+
"time"
1213

1314
"github.com/google/uuid"
1415
"golang.org/x/oauth2"
@@ -25,6 +26,9 @@ type OAuth2ProviderApp struct {
2526
Name string `json:"name"`
2627
RedirectURIs []string `json:"redirect_uris"`
2728
Icon string `json:"icon"`
29+
CreatedAt time.Time `json:"created_at" format:"date-time"`
30+
GrantTypes []string `json:"grant_types"`
31+
UserID uuid.UUID `json:"user_id,omitempty" format:"uuid"`
2832

2933
// Endpoints are included in the app response for easier discovery. The OAuth2
3034
// spec does not have a defined place to find these (for comparison, OIDC has
@@ -186,6 +190,7 @@ type OAuth2ProviderAppSecretFull struct {
186190

187191
type OAuth2ProviderAppSecret struct {
188192
ID uuid.UUID `json:"id" format:"uuid"`
193+
CreatedAt time.Time `json:"created_at" format:"date-time"`
189194
LastUsedAt NullTime `json:"last_used_at"`
190195
ClientSecretTruncated string `json:"client_secret_truncated"`
191196
}

docs/reference/api/enterprise.md

Lines changed: 35 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/api/typesGenerated.ts

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)