Skip to content

Commit f781447

Browse files
committed
wip started idp docs
1 parent 4f3369b commit f781447

File tree

3 files changed

+129
-2
lines changed

3 files changed

+129
-2
lines changed

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
]
8080
},
8181
"docs/configuration/language-model-providers",
82+
"docs/configuration/idp",
8283
{
8384
"group": "Authentication",
8485
"pages": [

docs/docs/configuration/idp.mdx

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
title: External Identity Providers
3+
sidebarTitle: External identity providers
4+
---
5+
6+
import LicenseKeyRequired from '/snippets/license-key-required.mdx'
7+
8+
<LicenseKeyRequired />
9+
10+
You can connect Sourcebot to various **external identity providers** to associate a Sourcebot user with one or more external service accounts (ex. Google, GitHub, etc).
11+
12+
External identity providers can be used for [authentication](/docs/configuration/auth) and/or [permission syncing](/docs/features/permission-syncing). They're defined in the
13+
[config file](/docs/configuration/config-file) in the top-level `identityProviders` object:
14+
15+
```json wrap icon="code" Example config with both google and github identity providers defined
16+
{
17+
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
18+
"identityProviders": [
19+
{
20+
"provider": "github",
21+
"purpose": "integration",
22+
"required": true,
23+
/*
24+
Secrets are provided through environment variables. Set the secret into
25+
an env var and provide the name here to tell Sourcebot where to get
26+
the value
27+
*/
28+
"clientId": {
29+
"env": "GITHUB_IDENTITY_PROVIDER_CLIENT_ID"
30+
},
31+
"clientSecret": {
32+
"env": "GITHUB_IDENTITY_PROVIDER_CLIENT_SECRET"
33+
}
34+
},
35+
{
36+
"provider": "google",
37+
"clientId": {
38+
"env": "GOOGLE_IDENTITY_PROVIDER_CLIENT_ID"
39+
},
40+
"clientSecret": {
41+
"env": "GOOGLE_IDENTITY_PROVIDER_CLIENT_SECRET"
42+
}
43+
}
44+
]
45+
}
46+
```
47+
48+
# Supported External Identity Providers
49+
50+
Sourcebot uses [Auth.js](https://authjs.dev/) to connect to external identity providers. If there's a provider supported by Auth.js that you don't see below, please submit a
51+
[feature request](https://github.com/sourcebot-dev/sourcebot/issues) to have it added.
52+
53+
### GitHub
54+
55+
[Auth.js GitHub Provider Docs](https://authjs.dev/getting-started/providers/github)
56+
57+
A GitHub connection can be used for either [authentication](/docs/configuration/auth) or [permission syncing](/docs/features/permission-syncing). This is controlled using the `purpose` field
58+
in the GitHub identity provider config.
59+
60+
<Accordion title="instructions">
61+
<Steps>
62+
<Step title="Register an Oauth Client">
63+
To begin, you must register an Oauth client in GitHub to faciliate the identity provider connection. You can do this by creating a **GitHub App** or a **GitHub OAuth App**. Either
64+
one works, but the **GitHub App** is the [modern way](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-apps).
65+
66+
67+
The result of registering an OAuth client is a `CLIENT_ID` and `CLIENT_SECRET` which you'll provide to Sourcebot.
68+
<Tabs>
69+
<Tab title="GitHub App">
70+
<Note>You don't need to install the app to use it as an external identity provider</Note>
71+
Follow [this guide](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) to register a new GitHub App.
72+
73+
When asked to provide a callback url, provide `<sourcebot_url>/api/auth/callback/github` (ex. https://sourcebot.coolcorp.com/api/auth/callback/github)
74+
75+
Set the following fine-grained permissions in the GitHub App:
76+
- `“Email addresses” account permissions (read)`
77+
</Tab>
78+
<Tab title="GitHub OAuth App">
79+
Follow [this guide](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) by GitHub to create an OAuth App.
80+
81+
When asked to provide a callback url, provide `<sourcebot_url>/api/auth/callback/github` (ex. https://sourcebot.coolcorp.com/api/auth/callback/github)
82+
</Tab>
83+
</Tabs>
84+
</Step>
85+
<Step title="Define environemnt variables">
86+
To provide Sourcebot the client id and secret for your OAuth client you must set them as environment variables. These can be named whatever you like
87+
(ex. `GITHUB_IDENTITY_PROVIDER_CLIENT_ID` and `GITHUB_IDENTITY_PROVIDER_CLIENT_SECRET`)
88+
</Step>
89+
<Step title="Define the identity provider config">
90+
Finally, pass the client id and secret to Sourcebot by defining a `identityProvider` object in the [config file](/docs/configuration/config-file):
91+
92+
```json wrap icon="code"
93+
{
94+
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
95+
"identityProviders": [
96+
{
97+
"provider": "github",
98+
// "sso" for auth + perm sync, "integration" for only perm sync
99+
"purpose": "integration",
100+
// if purpose == "integration" this controls if a user must connect to the IdP
101+
"required": true,
102+
"clientId": {
103+
"env": "YOUR_CLIENT_ID_ENV_VAR"
104+
},
105+
"clientSecret": {
106+
"env": "YOUR_CLIENT_SECRET_ENV_VAR"
107+
}
108+
}
109+
]
110+
}
111+
```
112+
</Step>
113+
</Steps>
114+
</Accordion>
115+
116+
### GitLab
117+
118+
### Google
119+
120+
### Okta
121+
122+
### Keycloak
123+
124+
### Microsoft Entra ID
125+

docs/docs/license-key.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebarTitle: License key
77
If you'd like a trial license, [reach out](https://www.sourcebot.dev/contact) and we'll send one over within 24 hours
88
</Note>
99

10-
All core Sourcebot features are available [FSL licensed](https://github.com/sourcebot-dev/sourcebot/blob/main/LICENSE.md#functional-source-license-version-11-alv2-future-license) without any limits. Some additional features require a license key. See the [pricing page](https://www.sourcebot.dev/pricing) for more details.
10+
All core Sourcebot features are available under the [FSL license](https://github.com/sourcebot-dev/sourcebot/blob/main/LICENSE.md#functional-source-license-version-11-alv2-future-license). Some additional features require a license key. See the [pricing page](https://www.sourcebot.dev/pricing) for more details.
1111

1212

1313
## Activating a license key
@@ -25,7 +25,7 @@ docker run \
2525
## Feature availability
2626
---
2727

28-
| Feature | OSS | Licensed |
28+
| Feature | [FSL](https://github.com/sourcebot-dev/sourcebot/blob/main/LICENSE.md#functional-source-license-version-11-alv2-future-license) | [Enterprise](https://github.com/sourcebot-dev/sourcebot/blob/main/ee/LICENSE) |
2929
|:---------|:-----|:----------|
3030
| [Search](/docs/features/search/syntax-reference) |||
3131
| [Full code host support](/docs/connections/overview) |||
@@ -34,6 +34,7 @@ docker run \
3434
| [Login with credentials](/docs/configuration/auth/overview) |||
3535
| [Login with email codes](/docs/configuration/auth/overview) |||
3636
| [Login with SSO](/docs/configuration/auth/overview#enterprise-authentication-providers) | 🛑 ||
37+
| [Permission syncing](/docs/features/permission-syncing) | 🛑 ||
3738
| [Code navigation](/docs/features/code-navigation) | 🛑 ||
3839
| [Search contexts](/docs/features/search/search-contexts) | 🛑 ||
3940
| [Audit logs](/docs/configuration/audit-logs) | 🛑 ||

0 commit comments

Comments
 (0)