Skip to content

Commit f044533

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 ef3c66e commit f044533

39 files changed

+1849
-193
lines changed

coderd/apidoc/docs.go

Lines changed: 32 additions & 6 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: 32 additions & 4 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: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -353,23 +353,34 @@ func TemplateVersionParameterOptionFromPreview(option *previewtypes.ParameterOpt
353353
}
354354
}
355355

356+
// oauth2AppEndpoints generates the OAuth2 endpoints for an app
357+
func oauth2AppEndpoints(accessURL *url.URL) codersdk.OAuth2AppEndpoints {
358+
return codersdk.OAuth2AppEndpoints{
359+
Authorization: accessURL.ResolveReference(&url.URL{
360+
Path: "/oauth2/authorize",
361+
}).String(),
362+
Token: accessURL.ResolveReference(&url.URL{
363+
Path: "/oauth2/token",
364+
}).String(),
365+
DeviceAuth: accessURL.ResolveReference(&url.URL{
366+
Path: "/oauth2/device",
367+
}).String(),
368+
Revocation: accessURL.ResolveReference(&url.URL{
369+
Path: "/oauth2/revoke",
370+
}).String(),
371+
}
372+
}
373+
356374
func OAuth2ProviderApp(accessURL *url.URL, dbApp database.OAuth2ProviderApp) codersdk.OAuth2ProviderApp {
357375
return codersdk.OAuth2ProviderApp{
358376
ID: dbApp.ID,
359377
Name: dbApp.Name,
360378
RedirectURIs: dbApp.RedirectUris,
361379
Icon: dbApp.Icon,
362-
Endpoints: codersdk.OAuth2AppEndpoints{
363-
Authorization: accessURL.ResolveReference(&url.URL{
364-
Path: "/oauth2/authorize",
365-
}).String(),
366-
Token: accessURL.ResolveReference(&url.URL{
367-
Path: "/oauth2/token",
368-
}).String(),
369-
DeviceAuth: accessURL.ResolveReference(&url.URL{
370-
Path: "/oauth2/device/authorize",
371-
}).String(),
372-
},
380+
CreatedAt: dbApp.CreatedAt,
381+
GrantTypes: dbApp.GrantTypes,
382+
UserID: dbApp.UserID.UUID,
383+
Endpoints: oauth2AppEndpoints(accessURL),
373384
}
374385
}
375386

@@ -379,6 +390,55 @@ func OAuth2ProviderApps(accessURL *url.URL, dbApps []database.OAuth2ProviderApp)
379390
})
380391
}
381392

393+
func OAuth2ProviderAppRow(accessURL *url.URL, dbApp database.GetOAuth2ProviderAppByIDRow) codersdk.OAuth2ProviderApp {
394+
return codersdk.OAuth2ProviderApp{
395+
ID: dbApp.ID,
396+
Name: dbApp.Name,
397+
RedirectURIs: dbApp.RedirectUris,
398+
Icon: dbApp.Icon,
399+
CreatedAt: dbApp.CreatedAt,
400+
GrantTypes: dbApp.GrantTypes,
401+
UserID: dbApp.UserID.UUID,
402+
Username: dbApp.Username.String,
403+
Email: dbApp.Email.String,
404+
Endpoints: oauth2AppEndpoints(accessURL),
405+
}
406+
}
407+
408+
func OAuth2ProviderAppsRows(accessURL *url.URL, dbApps []database.GetOAuth2ProviderAppsRow) []codersdk.OAuth2ProviderApp {
409+
return List(dbApps, func(dbApp database.GetOAuth2ProviderAppsRow) codersdk.OAuth2ProviderApp {
410+
return codersdk.OAuth2ProviderApp{
411+
ID: dbApp.ID,
412+
Name: dbApp.Name,
413+
RedirectURIs: dbApp.RedirectUris,
414+
Icon: dbApp.Icon,
415+
CreatedAt: dbApp.CreatedAt,
416+
GrantTypes: dbApp.GrantTypes,
417+
UserID: dbApp.UserID.UUID,
418+
Username: dbApp.Username.String,
419+
Email: dbApp.Email.String,
420+
Endpoints: oauth2AppEndpoints(accessURL),
421+
}
422+
})
423+
}
424+
425+
func OAuth2ProviderAppsByOwnerIDRows(accessURL *url.URL, dbApps []database.GetOAuth2ProviderAppsByOwnerIDRow) []codersdk.OAuth2ProviderApp {
426+
return List(dbApps, func(dbApp database.GetOAuth2ProviderAppsByOwnerIDRow) codersdk.OAuth2ProviderApp {
427+
return codersdk.OAuth2ProviderApp{
428+
ID: dbApp.ID,
429+
Name: dbApp.Name,
430+
RedirectURIs: dbApp.RedirectUris,
431+
Icon: dbApp.Icon,
432+
CreatedAt: dbApp.CreatedAt,
433+
GrantTypes: dbApp.GrantTypes,
434+
UserID: dbApp.UserID.UUID,
435+
Username: dbApp.Username.String,
436+
Email: dbApp.Email.String,
437+
Endpoints: oauth2AppEndpoints(accessURL),
438+
}
439+
})
440+
}
441+
382442
func convertDisplayApps(apps []database.DisplayApp) []codersdk.DisplayApp {
383443
dapps := make([]codersdk.DisplayApp, 0, len(apps))
384444
for _, app := range apps {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy