You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/admin/auth/index.mdx
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,6 @@ Leave the `url` field empty for GitHub.com.
102
102
103
103
Once you've configured GitHub as a sign-on provider, you may also want to [add GitHub repositories to Sourcegraph](/admin/code_hosts/github#repository-syncing).
104
104
105
-
106
105
### How to control user sign-up and sign-in with GitHub auth provider
107
106
108
107
You can use the following filters to control how users will create accounts and sign in to your Sourcegraph instance via the GitHub auth provider.
@@ -116,7 +115,6 @@ The new user email, during their account creation, should match one of their Git
116
115
117
116
> WARNING: If `allowSignup` is set to `true`, anyone with internet access to both your Sourcegraph instance and your GitHub url are able to sign up and login to your instance. In particular, if url is set to `https://github.com`, this means that anyone with a Github account could log in to your Sourcegraph instance and search your indexed code. Make sure to also configure the `allowOrgs` field described below to limit sign-ups to your org, or limit public access to your Sourcegraph instance via IP restrictions / VPN. For assistance, contact support.
118
117
119
-
120
118
```json
121
119
{
122
120
"type": "github",
@@ -533,3 +531,11 @@ Usernames from authentication providers are normalized before being used in Sour
533
531
For example, a user whose external username (according the authentication provider) is `[email protected]` would have the Sourcegraph username `alice-smith`.
534
532
535
533
If multiple accounts normalize into the same username, separate accounts are still created, but Sourcegraph will add a randomized suffix to the username to ensure uniqueness.
534
+
<<<<<<< Updated upstream
535
+
=======
536
+
537
+
## Remind users to connect external accounts
538
+
539
+
When repository permissions are enabled, users must link their external code host accounts with their Sourcegraph accounts to access private repositories.
540
+
To ensure users are aware of any unlinked accounts, users will be prompted to connect any missing external accounts upon visiting Sourcegraph for the first time, or when the provider configuration changes.
Copy file name to clipboardExpand all lines: docs/admin/auth/saml/azure_ad.mdx
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,16 @@
4
4
5
5
1. In Microsoft Entra ID, create an unlisted (non-gallery) application [following the official documentation](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/add-non-gallery-app).
6
6
1. Once the application is created, follow [these instructions to enable SAML SSO](https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/configure-single-sign-on-non-gallery-applications). Use these configuration values (replacing "sourcegraph.example.com" with your Sourcegraph instance URL):
Copy file name to clipboardExpand all lines: docs/admin/auth/saml/okta.mdx
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,13 @@
11
11
- For “Single sign on URL”, set the value to `<URL>`/.auth/saml/acs
12
12
- Under this box, there should be a checkbox labeled “Use this for Recipient URL and Destination URL”. Check the box if it is not already selected.
13
13
- For “Audience URI (SP Entity ID)”, set the value to `<URL>`/.auth/saml/metadata
14
-
- For "Name ID format", choose "EmailAddress"
14
+
- For "Name ID format", choose "Persistent"
15
+
- For "Application username", choose "Custom" and insert `user.getInternalProperty("id")`.
15
16
- In the section titled “Attribute Statements (optional)”:
16
17
- Set the following Name and Values, leaving the Name format to “Unspecified”
17
-
-Email: user.email (This one is required)
18
-
-Login: user.login (This one is optional)
19
-
- displayName: user.firstName (This one is optional)
18
+
-`email`: `user.email`
19
+
-`login`: `user.login`
20
+
-`displayName`: `user.firstName` or an alternative field
20
21
6. Click Next.
21
22
7. Now you should be on the “Feedback” step. Select the radio button for “I’m an Okta customer adding an internal app”, and provide feedback if you wish. Click "Finish".
22
23
8. You should now be on the Application page for Sourcegraph, where you can view the settings and configurations you have just set. You will want to grant users or groups sign-in access before moving on.
@@ -52,4 +53,4 @@
52
53
}
53
54
```
54
55
55
-
> NOTE: Optional, but recommended: [add automatic provisioning of users with SCIM](/admin/scim).
56
+
<Callouttype="note">Optional, but recommended: [add automatic provisioning of users with SCIM](/admin/scim).</Callout>
Copy file name to clipboardExpand all lines: docs/admin/code_hosts/gitlab.mdx
+1-33Lines changed: 1 addition & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,38 +98,6 @@ Then, [add or edit a GitLab connection](#repository-syncing) and include the `au
98
98
In this case, a user's OAuth token will be used to get a list of repositories that the user can access.
99
99
[Repository-centric permissions syncing](/admin/permissions/syncing) will be disabled.
100
100
101
-
### Administrator (sudo-level) access token
102
-
103
-
This method requires administrator access to GitLab so that Sourcegraph can access the [admin GitLab Users API endpoint](https://docs.gitlab.com/ee/api/users.html#for-admins). For each GitLab user, this endpoint provides the user ID that comes from the authentication provider, so Sourcegraph can associate a user in its system to a user in GitLab.
104
-
105
-
Prerequisite: Add the [SAML](/admin/auth/#saml) or [OpenID Connect](/admin/auth/#openid-connect)
106
-
authentication provider you use to sign into GitLab.
107
-
108
-
Then, [add or edit a GitLab connection](#repository-syncing) using an administrator (sudo-level) personal access token, and include the `authorization` field:
109
-
110
-
```json
111
-
{
112
-
"url": "https://gitlab.com",
113
-
"token": "$PERSONAL_ACCESS_TOKEN",
114
-
// ...
115
-
"authorization": {
116
-
"identityProvider": {
117
-
"type": "external",
118
-
"authProviderID": "$AUTH_PROVIDER_ID",
119
-
"authProviderType": "$AUTH_PROVIDER_TYPE",
120
-
"gitlabProvider": "$AUTH_PROVIDER_GITLAB_ID"
121
-
}
122
-
}
123
-
}
124
-
```
125
-
126
-
`$AUTH_PROVIDER_ID` and `$AUTH_PROVIDER_TYPE` identify the authentication provider to use and should
127
-
match the fields specified in the authentication provider config
128
-
(`auth.providers`). The authProviderID can be found in the `configID` field of the auth provider config.
129
-
130
-
`$AUTH_PROVIDER_GITLAB_ID` should match the `identities.provider` returned by
131
-
[the admin GitLab Users API endpoint](https://docs.gitlab.com/ee/api/users.html#for-admins).
132
-
133
101
### Username
134
102
135
103
Prerequisite: Ensure that `http-header` is the *only* authentication provider type configured for
@@ -296,7 +264,7 @@ See [Internal rate limits](/admin/code_hosts/rate_limits#internal-rate-limits).
296
264
// It is important that the Sourcegraph repository name generated with this pattern be unique to this code host. If different code hosts generate repository names that collide, Sourcegraph's behavior is undefined.
// A GitLab access token with "api" scope. Can be a personal access token (PAT) or an OAuth token. If you are enabling permissions with identity provider type "external", this token should also have "sudo" scope.
267
+
// A GitLab access token with "api" scope. Can be a personal access token (PAT) or an OAuth token. If you are enabling permissions with identity provider type "username", this token should also have "sudo" scope.
300
268
"token": null,
301
269
302
270
// The OAuth token expiry (Unix timestamp in seconds)
Copy file name to clipboardExpand all lines: docs/admin/config/authorization_and_authentication.mdx
+1-36Lines changed: 1 addition & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,48 +68,13 @@ Once authentication with GitHub via OAuth is configured, follow [these steps to
68
68
69
69
### GitLab Enterprise or GitLab Cloud authentication and authorization
70
70
71
-
We support both authentication and permissions syncing (through OAuth) for GitLab. If you use GitLab as your code host, you have two available authentication flows:
72
-
73
-
#### Option 1
71
+
We support both authentication and permissions syncing (through OAuth) for GitLab.
74
72
75
73
1. Use SAML (or another auth mechanism) to log in to GitLab
76
74
2. Use GitLab OAuth to log in to Sourcegraph
77
75
78
76
In this way, access to Sourcegraph will still be managed by your identity provider, using the code host as a middle step. This option is the simplest to configure. To do so, [set up GitLab as an authentication option](/admin/auth/#gitlab), and then [enable permissions syncing](/admin/code_hosts/gitlab#oauth-application).
79
77
80
-
#### Option 2
81
-
82
-
Alternatively, you can configure SAML authentication in Sourcegraph, and use GitLab permissions syncing in the background to control access permissions. To implement this method, you will need to make sure that GitLab is able to return a value in `identities.provider` for the `GET /users` endpoint ([GitLab documentation](https://docs.gitlab.com/ee/api/users.html#for-admins)) that your identity provider is able to pass as the `nameID` in the SAML response. If that isn’t possible, you will need to use the first option.
83
-
84
-
To configure SAML auth with GitLab permissions, you will need to first [configure permissions from GitLab](/admin/code_hosts/gitlab#administrator-sudo-level-access-token). Then, [configure SAML authentication](/admin/auth/saml/). The `nameID` passed by the identity provider will need to match the value of `identities.provider`.
Then you will need to configure permission in Sourcegraph as:
95
-
96
-
```json
97
-
{
98
-
"url": "https://gitlab.com",
99
-
"token": "$PERSONAL_ACCESS_TOKEN",
100
-
"authorization": {
101
-
"identityProvider": {
102
-
"type": "external",
103
-
"authProviderID": "$AUTH_PROVIDER_ID",
104
-
"authProviderType": "$AUTH_PROVIDER_TYPE",
105
-
"gitlabProvider": "saml"
106
-
}
107
-
}
108
-
}
109
-
```
110
-
111
-
And configure the identity provider to pass the email address as the `nameID`.
112
-
113
78
### Bitbucket Server / Bitbucket Data Center authorization
114
79
115
80
We do not currently support OAuth for Bitbucket Server or Bitbucket Data Center. You will need to combine permissions syncing from Bitbucket Server / Bitbucket Data Center with another authentication mechanism (SAML, built-in auth, HTTP authentication proxies). Bitbucket Server and Bitbucket Data Center only pass usernames to Sourcegraph, so you’ll need to make sure that those usernames are matched by whatever mechanism you choose to use for access.
Copy file name to clipboardExpand all lines: docs/admin/config/email.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Sourcegraph uses an SMTP server of your choosing to send emails for:
7
7
- Important updates to a user accounts (for example, creation of API keys)
8
8
- For [`builtin` authentication](/admin/auth/#builtin-password-authentication), password resets and email verification
9
9
10
-
> NOTE: Sourcegraph Cloud customers can take advantage of mananged SMTP servers - [learn more](/cloud/#managed-smtp).
10
+
<Callouttype="note">Sourcegraph Cloud customers can take advantage of mananged SMTP servers - [learn more](/cloud/#managed-smtp).</Callout>
11
11
12
12
## User email verification
13
13
@@ -82,8 +82,8 @@ Make sure that `[email protected]` in both places of the configuration matches th
82
82
83
83
Other providers such as Mailchimp and Sendgrid may also be used with Sourcegraph. Any valid SMTP server account should do. For those two providers in specific, you may follow their documentation:
Once you have an SMTP account, simply navigate to your site configuration (e.g. `https://sourcegraph.com/site-admin/configuration`) and fill in the configuration:
Copy file name to clipboardExpand all lines: docs/admin/config/webhooks/outgoing.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
1
# Outgoing webhooks
2
2
3
+
<<<<<<<Updatedupstream
3
4
<Callouttype="note"> This feature is supported on Sourcegraph versions 5.0 or more.</Callout>
5
+
=======
6
+
<Callouttype="note"> This feature is currently in beta and supported on Sourcegraph versions 5.0 or later.</Callout>
7
+
>>>>>>> Stashed changes
4
8
5
9
Outgoing webhooks can be configured on a Sourcegraph instance in order to send Sourcegraph events to external tools and services. This allows for deeper integrations between Sourcegraph and other applications.
Copy file name to clipboardExpand all lines: docs/admin/permissions/index.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,7 @@ of `alice` are the following union set: [`horsegraph/global`, `horsegraph/hay-v1
124
124
### Configuration
125
125
126
126
**Prerequisites:**
127
+
127
128
1. Sourcegraph version 5.0+
128
129
1. Go to **Site Admin > Migrations** page. There is a migration called `Migrate data from user_permissions table to unified user_repo_permissions.`.
129
130
Make sure that it finished migrating all the data (it reports as 100%). Contact support if the migration does not seem to complete for a long time (multiple days).
@@ -150,8 +151,8 @@ permission sync, it will replace the existing set of synced permissions for that
150
151
151
152
**Example**:
152
153
153
-
Let's follow the example from above,`alice` has existing synced permissions to repositories `horsegraph/global` and `horsegraph/hay-v1`
154
-
and explicit permissions to `horsegraph/hay-dev`, meaning a unioned set of effective permissions of [`horsegraph/global`, `horsegraph-hay-v1`, `horsegraph/hay-dev`].
154
+
Let's follow the example from above.`alice` has existing synced permissions for the repositories `horsegraph/global` and `horsegraph/hay-v1`
155
+
and explicit permissions set for `horsegraph/hay-dev`, meaning a unioned set of effective permissions of [`horsegraph/global`, `horsegraph/hay-v1`, `horsegraph/hay-dev`].
155
156
156
157
An update comes in from permission sync, now returning `alice` permissions as [`horsegraph/global`, `horsegraph/hay-v2`]. Notice
-`bob` has access to repositories `horsegraph/global` and `horsegraph/bob` on the code host
50
54
- an on-demand request is made to sync repository permissions of `bob`, this job is added to the queue with high priority, so it will be processed
@@ -69,6 +73,7 @@ processed. To avoid overloading the code host a sync job [might not be processed
69
73
and depending on the code host, might be heavily rate limited.
70
74
71
75
Priority queue is needed to process the sync jobs in the order of most important first. E.g.:
76
+
72
77
- on-demand sync is high priority
73
78
- sync of entities with no permissions is high priority
74
79
- sync of oldest permissions is normal priority, since we already do have some permissions in the system
@@ -230,13 +235,14 @@ mentioned above. Even if we let permission sync consume all the rate limit and w
230
235
is rarely the case. Depending on the code host, the rate limit might be much higher, but then we might be
231
236
firing huge amounts of requests to the code host.
232
237
233
-
> IMPORTANT: For permission syncing to be quicker, the code host needs to be able to handle big amounts of requests per hour.
238
+
<Callouttype="warning">IMPORTANT: For permission syncing to be quicker, the code host needs to be able to handle big amounts of requests per hour.</Callout>
234
239
235
-
> IMPORTANT: Depending on the customer scale, the amount of users, repositories and the distribution of permissions accross them, the time it takes to fully sync will vary.
240
+
<Callouttype="warning">IMPORTANT: Depending on the customer scale, the amount of users, repositories and the distribution of permissions accross them, the time it takes to fully sync will vary.</Callout>
236
241
237
-
> IMPORTANT: We recommend **configuring webhooks for permissions on GitHub** which makes lag time much smaller.
242
+
<Callouttype="warning">IMPORTANT: We recommend **configuring webhooks for permissions on GitHub** which makes lag time much smaller.</Callout>
238
243
239
244
## Configuration
245
+
240
246
There are variety of options in the site configuration to tune how the permissions sync requests are
241
247
scheduled. Default values are shown below:
242
248
@@ -268,7 +274,9 @@ Internal rate limiter settings are described on each code host configuration pag
268
274
### Recommendations
269
275
270
276
#### Less users than repositories
277
+
271
278
If there are a lot less users, than repositories, it is better to rely on user-centric perms sync instead of repo-centric sync. In that case, we recommend:
279
+
272
280
```json
273
281
{
274
282
// ...
@@ -288,6 +296,7 @@ a minute. `5000/(4 * 60) = 20.8`, so the scheduler needs to schedule 21 users on
288
296
289
297
The rate limit for the code host would need to be changed to support the load. In that case the recommendation
290
298
is to set it to 2x of the amount of [requests expected from permission syncing](#request-count).
299
+
291
300
#### More users than repositories
292
301
293
302
If the situation is reversed, it is recommended to do the opposite than above. Prefer repo-centric
0 commit comments