Connect Bitbucket Server with OAuth 2.0
You can use OAuth 2.0 to enable users to work with a remote Git repository that is hosted on a Bitbucket Server:
-
Set up an OAuth 2.0 application link on the Bitbucket Server.
-
Apply an application link Secret for the Bitbucket Server.
Create an OAuth 2.0 application link on the Bitbucket Server
Create an OAuth 2.0 application link on the Bitbucket Server so that Che can authenticate your developers and provide credential-free access to Bitbucket Server repositories.
-
You are logged in to the Bitbucket Server.
-
Go to Administration > Applications > Application links.
-
Select Create link.
-
Select External application and Incoming.
-
Enter
https://<che_fqdn>/api/oauth/callbackto the Redirect URL field. -
Select the Admin - Write checkbox in Application permissions.
-
Click Save.
-
Copy and save the Client ID for use when applying the Bitbucket application link Secret.
-
Copy and save the Client secret for use when applying the Bitbucket application link Secret.
Connect Che to your Bitbucket Server OAuth 2.0 application
Connect Che to your Bitbucket Server OAuth 2.0 application so that developers can access Bitbucket Server repositories from workspaces without re-entering credentials.
-
You have configured the OAuth 2.0 application link on the Bitbucket Server.
-
You have the following values, which were generated when configuring the Bitbucket application link:
-
Bitbucket Client ID
-
Bitbucket Client secret
-
-
An active
kubectlsession with administrative permissions to the destination Kubernetes cluster. See Overview of kubectl.
-
Prepare the Secret:
kind: Secret apiVersion: v1 metadata: name: bitbucket-oauth-config namespace: eclipse-che (1) labels: app.kubernetes.io/part-of: che.eclipse.org app.kubernetes.io/component: oauth-scm-configuration annotations: che.eclipse.org/oauth-scm-server: bitbucket che.eclipse.org/scm-server-endpoint: <bitbucket_server_url> (2) type: Opaque stringData: id: <Bitbucket_Client_ID> (3) secret: <Bitbucket_Client_Secret> (4)1 The Che namespace. The default is eclipse-che.2 The URL of the Bitbucket Server. 3 The Bitbucket Client ID. 4 The Bitbucket Client secret. -
Apply the Secret:
$ kubectl apply -f - <<EOF <Secret_prepared_in_the_previous_step> EOF
-
Verify that the output displays
secret/bitbucket-oauth-config created.