- Notifications
You must be signed in to change notification settings - Fork928
chore(docs): make external auth docs easier to follow#12970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from2 commits
Commits
Show all changes
5 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
68 changes: 59 additions & 9 deletionsdocs/admin/external-auth.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -25,16 +25,11 @@ application. The following providers are supported: | ||
- [Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops) | ||
- [Azure DevOps (via Entra ID)](https://learn.microsoft.com/en-us/entra/architecture/auth-oauth2) | ||
The next step is to [configure the Coder server](./configure.md) to use the OAuth application by setting the following environment variables: | ||
```env | ||
CODER_EXTERNAL_AUTH_0_ID="USER_DEFINED_ID" | ||
doodzik marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
CODER_EXTERNAL_AUTH_0_TYPE=<github|gitlab|azure-devops|bitbucket-cloud|bitbucket-server|etc> | ||
CODER_EXTERNAL_AUTH_0_CLIENT_ID=xxxxxx | ||
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=xxxxxxx | ||
@@ -43,10 +38,17 @@ CODER_EXTERNAL_AUTH_0_DISPLAY_NAME="Google Calendar" | ||
CODER_EXTERNAL_AUTH_0_DISPLAY_ICON="https://mycustomicon.com/google.svg" | ||
``` | ||
The `CODER_EXTERNAL_AUTH_0_ID` environment variable is used for internal reference. Therefore, it can be set arbitrarily (e.g., `primary-github` for your GitHub provider). | ||
### GitHub | ||
> If you don't require fine-grained access control, it's easier to configure a GitHub OAuth app! | ||
1. [Create a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) | ||
* Set the callback URL to `https://coder.example.com/external-auth/USER_DEFINED_ID/callback`. | ||
* Deactivate Webhooks. | ||
* Enable fine-grained access to specific repositories or a subset of | ||
permissions for security. | ||
 | ||
@@ -69,6 +71,13 @@ CODER_EXTERNAL_AUTH_0_DISPLAY_ICON="https://mycustomicon.com/google.svg" | ||
 | ||
```env | ||
CODER_EXTERNAL_AUTH_0_ID="USER_DEFINED_ID" | ||
CODER_EXTERNAL_AUTH_0_TYPE=github | ||
CODER_EXTERNAL_AUTH_0_CLIENT_ID=xxxxxx | ||
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=xxxxxxx | ||
``` | ||
### GitHub Enterprise | ||
GitHub Enterprise requires the following environment variables: | ||
@@ -204,6 +213,47 @@ add this to the | ||
git config --global credential.useHttpPath true | ||
``` | ||
### Kubernetes environment variables | ||
If you deployed Coder with Kubernetes you can set the environment variables in your `values.yaml` file: | ||
```yaml | ||
coder: | ||
env: | ||
# […] | ||
- name: CODER_EXTERNAL_AUTH_0_ID | ||
value: USER_DEFINED_ID | ||
- name: CODER_EXTERNAL_AUTH_0_TYPE | ||
value: github | ||
- name: CODER_EXTERNAL_AUTH_0_CLIENT_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: github-primary-basic-auth | ||
key: client-id | ||
- name: CODER_EXTERNAL_AUTH_0_CLIENT_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: github-primary-basic-auth | ||
key: client-secret | ||
``` | ||
You can set the secrets by creating a `github-primary-basic-auth.yaml` file and applying it. | ||
```yaml | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: github-primary-basic-auth | ||
type: Opaque | ||
stringData: | ||
client-secret: xxxxxxxxx | ||
client-id: xxxxxxxxx | ||
``` | ||
Make sure to restart the affected pods for the change to take effect. | ||
## Require git authentication in templates | ||
If your template requires git authentication (e.g. running `git clone` in the | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.