Skip to content

Commit cd0cf55

Browse files
committed
feat(oauth2): replace dev flag with oauth2 experiment for controlled rollout
- Add ExperimentOAuth2 constant to enable OAuth2 via experiment flag - Replace dev-only middleware with experiment-based gating - Maintain backward compatibility with dev mode - Allow OAuth2 enablement in production environments via --experimental=oauth2 Change-Id: I51e021a21ad385c133783d715e872fb4069f9e66 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 494dccc commit cd0cf55

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

coderd/apidoc/docs.go

Lines changed: 5 additions & 2 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: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/oauth2.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ const (
3737
displaySecretLength = 6 // Length of visible part in UI (last 6 characters)
3838
)
3939

40-
func (*API) oAuth2ProviderMiddleware(next http.Handler) http.Handler {
40+
func (api *API) oAuth2ProviderMiddleware(next http.Handler) http.Handler {
4141
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
42-
if !buildinfo.IsDev() {
42+
if !api.Experiments.Enabled(codersdk.ExperimentOAuth2) && !buildinfo.IsDev() {
4343
httpapi.Write(r.Context(), rw, http.StatusForbidden, codersdk.Response{
44-
Message: "OAuth2 provider is under development.",
44+
Message: "OAuth2 provider functionality requires enabling the 'oauth2' experiment.",
4545
})
4646
return
4747
}

codersdk/deployment.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,6 +3341,7 @@ const (
33413341
ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
33423342
ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
33433343
ExperimentWebPush Experiment = "web-push" // Enables web push notifications through the browser.
3344+
ExperimentOAuth2 Experiment = "oauth2" // Enables OAuth2 provider functionality.
33443345
)
33453346

33463347
// ExperimentsKnown should include all experiments defined above.
@@ -3350,6 +3351,7 @@ var ExperimentsKnown = Experiments{
33503351
ExperimentNotifications,
33513352
ExperimentWorkspaceUsage,
33523353
ExperimentWebPush,
3354+
ExperimentOAuth2,
33533355
}
33543356

33553357
// ExperimentsSafe should include all experiments that are safe for

docs/reference/api/schemas.md

Lines changed: 1 addition & 0 deletions
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: 2 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)
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