feat: add OAuth2 provider functionality as an experiment (#18692)

# Add OAuth2 Provider Functionality as an Experiment

This PR adds a new experiment flag `oauth2` that enables OAuth2 provider functionality in Coder. When enabled, this experiment allows Coder to act as an OAuth2 provider.

The changes include:
- Added the new `ExperimentOAuth2` constant with appropriate documentation
- Updated the OAuth2 provider middleware to check for the experiment flag
- Modified the error message to indicate that the OAuth2 provider requires enabling the experiment
- Added the new experiment to the known experiments list in the SDK

Previously, OAuth2 provider functionality was only available in development mode. With this change, it can be enabled in production environments by activating the experiment.
This commit is contained in:
Thomas Kosiewski
2025-07-03 19:44:29 +02:00
committed by GitHub
parent 2c95a1dd71
commit 15551541e8
6 changed files with 18 additions and 7 deletions

7
coderd/apidoc/docs.go generated
View File

@ -12550,12 +12550,14 @@ const docTemplate = `{
"auto-fill-parameters",
"notifications",
"workspace-usage",
"web-push"
"web-push",
"oauth2"
],
"x-enum-comments": {
"ExperimentAutoFillParameters": "This should not be taken out of experiments until we have redesigned the feature.",
"ExperimentExample": "This isn't used for anything.",
"ExperimentNotifications": "Sends notifications via SMTP and webhooks following certain events.",
"ExperimentOAuth2": "Enables OAuth2 provider functionality.",
"ExperimentWebPush": "Enables web push notifications through the browser.",
"ExperimentWorkspaceUsage": "Enables the new workspace usage tracking."
},
@ -12564,7 +12566,8 @@ const docTemplate = `{
"ExperimentAutoFillParameters",
"ExperimentNotifications",
"ExperimentWorkspaceUsage",
"ExperimentWebPush"
"ExperimentWebPush",
"ExperimentOAuth2"
]
},
"codersdk.ExternalAuth": {