feat: enable GitHub OAuth2 login by default on new deployments (#16662)

Third and final PR to address
https://github.com/coder/coder/issues/16230.

This PR enables GitHub OAuth2 login by default on new deployments.
Combined with https://github.com/coder/coder/pull/16629, this will allow
the first admin user to sign up with GitHub rather than email and
password.

We take care not to enable the default on deployments that would upgrade
to a Coder version with this change.

To disable the default provider an admin can set the
`CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER` env variable to false.
This commit is contained in:
Hugo Dutka
2025-02-25 16:31:33 +01:00
committed by GitHub
parent 67d89bb102
commit d3a56ae3ef
25 changed files with 544 additions and 83 deletions
+1
View File
@@ -328,6 +328,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
],
"client_id": "string",
"client_secret": "string",
"default_provider_enable": true,
"device_flow": true,
"enterprise_base_url": "string"
}
+38 -16
View File
@@ -787,6 +787,7 @@
```json
{
"github": {
"default_provider_configured": true,
"enabled": true
},
"oidc": {
@@ -803,12 +804,12 @@
### Properties
| Name | Type | Required | Restrictions | Description |
|------------------------|----------------------------------------------------|----------|--------------|-------------|
| `github` | [codersdk.AuthMethod](#codersdkauthmethod) | false | | |
| `oidc` | [codersdk.OIDCAuthMethod](#codersdkoidcauthmethod) | false | | |
| `password` | [codersdk.AuthMethod](#codersdkauthmethod) | false | | |
| `terms_of_service_url` | string | false | | |
| Name | Type | Required | Restrictions | Description |
|------------------------|--------------------------------------------------------|----------|--------------|-------------|
| `github` | [codersdk.GithubAuthMethod](#codersdkgithubauthmethod) | false | | |
| `oidc` | [codersdk.OIDCAuthMethod](#codersdkoidcauthmethod) | false | | |
| `password` | [codersdk.AuthMethod](#codersdkauthmethod) | false | | |
| `terms_of_service_url` | string | false | | |
## codersdk.AuthorizationCheck
@@ -1977,6 +1978,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
],
"client_id": "string",
"client_secret": "string",
"default_provider_enable": true,
"device_flow": true,
"enterprise_base_url": "string"
}
@@ -2449,6 +2451,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
],
"client_id": "string",
"client_secret": "string",
"default_provider_enable": true,
"device_flow": true,
"enterprise_base_url": "string"
}
@@ -3101,6 +3104,22 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
| `updated_at` | string | false | | |
| `user_id` | string | false | | |
## codersdk.GithubAuthMethod
```json
{
"default_provider_configured": true,
"enabled": true
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------------------------|---------|----------|--------------|-------------|
| `default_provider_configured` | boolean | false | | |
| `enabled` | boolean | false | | |
## codersdk.Group
```json
@@ -3807,6 +3826,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
],
"client_id": "string",
"client_secret": "string",
"default_provider_enable": true,
"device_flow": true,
"enterprise_base_url": "string"
}
@@ -3833,6 +3853,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
],
"client_id": "string",
"client_secret": "string",
"default_provider_enable": true,
"device_flow": true,
"enterprise_base_url": "string"
}
@@ -3840,16 +3861,17 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
### Properties
| Name | Type | Required | Restrictions | Description |
|-----------------------|-----------------|----------|--------------|-------------|
| `allow_everyone` | boolean | false | | |
| `allow_signups` | boolean | false | | |
| `allowed_orgs` | array of string | false | | |
| `allowed_teams` | array of string | false | | |
| `client_id` | string | false | | |
| `client_secret` | string | false | | |
| `device_flow` | boolean | false | | |
| `enterprise_base_url` | string | false | | |
| Name | Type | Required | Restrictions | Description |
|---------------------------|-----------------|----------|--------------|-------------|
| `allow_everyone` | boolean | false | | |
| `allow_signups` | boolean | false | | |
| `allowed_orgs` | array of string | false | | |
| `allowed_teams` | array of string | false | | |
| `client_id` | string | false | | |
| `client_secret` | string | false | | |
| `default_provider_enable` | boolean | false | | |
| `device_flow` | boolean | false | | |
| `enterprise_base_url` | string | false | | |
## codersdk.OAuth2ProviderApp
+1
View File
@@ -159,6 +159,7 @@ curl -X GET http://coder-server:8080/api/v2/users/authmethods \
```json
{
"github": {
"default_provider_configured": true,
"enabled": true
},
"oidc": {