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
feat(backend): add Bitbucket Server permission syncing
Adds account-driven and repo-driven permission sync support for
Bitbucket Server (Data Center), mirroring the existing GitHub,
GitLab, and Bitbucket Cloud implementations.
- Extend BitbucketServerIdentityProviderConfig to support
purpose: "account_linking" and accountLinkingRequired field
- Request REPO_READ OAuth scope when permission syncing is enabled
- Add bitbucket-server token refresh support via /rest/oauth2/latest/token
- Add bitbucketServer/bitbucket-server to permission sync constants
- Add getReposForAuthenticatedBitbucketServerUser and
getUserPermissionsForServerRepo to bitbucket.ts
- Add bitbucket-server branch to accountPermissionSyncer
- Add bitbucketServer branch to repoPermissionSyncer
- Update docs to reflect new account_linking purpose support
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/docs/configuration/idp.mdx
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,7 +220,8 @@ in the Bitbucket Cloud identity provider config.
220
220
221
221
### Bitbucket Server
222
222
223
-
A Bitbucket Server (Data Center) connection can be used for [authentication](/docs/configuration/auth).
223
+
A Bitbucket Server (Data Center) connection can be used for [authentication](/docs/configuration/auth) and/or [permission syncing](/docs/features/permission-syncing). This is controlled using the `purpose` field
224
+
in the Bitbucket Server identity provider config.
224
225
225
226
<Accordiontitle="instructions">
226
227
<Steps>
@@ -231,6 +232,7 @@ A Bitbucket Server (Data Center) connection can be used for [authentication](/do
231
232
232
233
When configuring your application:
233
234
- Set the redirect URL to `<sourcebot_url>/api/auth/callback/bitbucket-server` (ex. https://sourcebot.coolcorp.com/api/auth/callback/bitbucket-server)
235
+
- If using for permission syncing, ensure the OAuth application requests the `REPO_READ` scope
234
236
235
237
The result of creating the application is a `CLIENT_ID` and `CLIENT_SECRET` which you'll provide to Sourcebot.
236
238
</Step>
@@ -247,7 +249,10 @@ A Bitbucket Server (Data Center) connection can be used for [authentication](/do
247
249
"identityProviders": [
248
250
{
249
251
"provider": "bitbucket-server",
250
-
"purpose": "sso",
252
+
// "sso" for auth + perm sync, "account_linking" for only perm sync
253
+
"purpose": "account_linking",
254
+
// if purpose == "account_linking" this controls if a user must connect to the IdP
thrownewError(`User '${account.user.email}' does not have a Bitbucket Server OAuth access token associated with their account. Please re-authenticate with Bitbucket Server to refresh the token.`);
295
+
}
296
+
297
+
// @hack: we don't have a way of identifying specific identity providers in the config file.
298
+
// Instead, we'll use the first Bitbucket Server connection's URL as the base URL.
0 commit comments