Skip to content

feat(enterprise): Bitbucket Data Center Integration#13228

Merged
raymyers merged 6 commits intomainfrom
jl/bitbucket-dc-enterprise-auth
Mar 6, 2026
Merged

feat(enterprise): Bitbucket Data Center Integration#13228
raymyers merged 6 commits intomainfrom
jl/bitbucket-dc-enterprise-auth

Conversation

@jlav
Copy link
Copy Markdown
Contributor

@jlav jlav commented Mar 5, 2026

Summary of PR

This PR adds an enterprise integration for Bitbucket Data Center so that users can authenticate to OpenHands with OAuth2.

This PR largely pattern matches the existing enterprise authentication integrations, except that Bitbucket Data Center doesn't support OIDC directly. Data Center lacks the standard userinfo endpoint, so this PR introduces a proxy endpoint that compiles user info from Data Center's whoami and users endpoints. The keycloack realm config points at the proxy for the userInfoUrl.

Demo Screenshots/Videos

Video demonstrates logging in with Bitbucket Data Center, starting a conversation, and opening a PR.

Screen.Recording.2026-03-04.at.8.52.05.PM.mov

Change Type

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Other (dependency update, docs, typo fixes, etc.)

Checklist

  • I have read and reviewed the code and I understand what the code is doing.
  • I have tested the code to the best of my ability and ensured it works as expected.

Fixes

Resolves #(issue)

Release Notes

  • Include this change in the Release Notes.

Added enterprise integration for Bitbucket Data Center.


To run this PR locally, use the following command:

GUI with Docker:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.openhands.dev/openhands/runtime:5efdcb9-nikolaik   --name openhands-app-5efdcb9   docker.openhands.dev/openhands/openhands:5efdcb9

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 5, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  enterprise
  saas_server.py 14-16, 131-142
  enterprise/integrations/bitbucket_data_center
  bitbucket_dc_service.py 21-34, 37-65
  enterprise/server
  config.py 165-171
  enterprise/server/auth
  constants.py
  saas_user_auth.py 178-184
  token_manager.py 383-389, 466-467, 472-494, 497-498
  enterprise/server/routes
  bitbucket_dc_proxy.py 21-56
Project Total  

This report was generated by python-coverage-comment-action

@jlav jlav force-pushed the jl/bitbucket-dc-enterprise-auth branch from 16b4382 to 1bab530 Compare March 5, 2026 02:40
@jlav jlav marked this pull request as ready for review March 5, 2026 02:45
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taste Rating: 🟡 Acceptable

This is solid, pragmatic engineering. You're pattern-matching the existing GitHub/GitLab integrations, solving a real problem (Bitbucket DC's lack of OIDC support), and the solution is appropriately simple. Test coverage is comprehensive.

A couple of minor improvements to consider, but nothing blocking.

Comment thread enterprise/server/routes/bitbucket_dc_proxy.py
Comment thread enterprise/server/routes/bitbucket_dc_proxy.py Outdated
Comment thread enterprise/server/auth/saas_user_auth.py
openhands-agent and others added 4 commits March 5, 2026 13:29
- Remove module-level BITBUCKET_DATA_CENTER_HOST import
- Read from os.environ.get() inside userinfo method
- Add ValueError if BITBUCKET_DATA_CENTER_HOST is not set
- Use local bitbucket_base_url variable instead of module constant

Co-authored-by: openhands <openhands@all-hands.dev>
…inside route method

Moved from reading os.environ directly to importing the constant from
server.auth.constants. The validation check remains inside the route method
rather than at module level.

Co-authored-by: openhands <openhands@all-hands.dev>
Extract the timeout value of 10 seconds to a module-level constant
BITBUCKET_DC_TIMEOUT for improved clarity and maintainability.
Copy link
Copy Markdown
Collaborator

@malhotra5 malhotra5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@raymyers raymyers merged commit ede203a into main Mar 6, 2026
14 checks passed
@raymyers raymyers deleted the jl/bitbucket-dc-enterprise-auth branch March 6, 2026 16:49
amanape pushed a commit that referenced this pull request Mar 6, 2026
Co-authored-by: openhands <openhands@all-hands.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants