Configuring OAuth 1.0 for a Bitbucket Server
To enable users to work with a remote Git repository that is hosted on a Bitbucket Server:
-
Set up an application link (OAuth 1.0) on the Bitbucket Server.
-
Apply an application link Secret for the Bitbucket Server.
Setting up an application link on the Bitbucket Server
Set up an application link for OAuth 1.0 on the Bitbucket Server.
-
You are logged in to the Bitbucket Server.
-
openssl
is installed in the operating system you are using.
-
On a command line, run the commands to create the necessary files for the next steps and for use when applying the application link Secret:
$ openssl genrsa -out private.pem 2048 && \ openssl pkcs8 -topk8 -inform pem -outform pem -nocrypt -in private.pem -out privatepkcs8.pem && \ cat privatepkcs8.pem | sed 's/-----BEGIN PRIVATE KEY-----//g' | sed 's/-----END PRIVATE KEY-----//g' | tr -d '\n' > privatepkcs8-stripped.pem && \ openssl rsa -in private.pem -pubout > public.pub && \ cat public.pub | sed 's/-----BEGIN PUBLIC KEY-----//g' | sed 's/-----END PUBLIC KEY-----//g' | tr -d '\n' > public-stripped.pub && \ openssl rand -base64 24 > bitbucket-consumer-key && \ openssl rand -base64 24 > bitbucket-shared-secret
-
Go to
. -
Enter
https://<che_fqdn>/
into the URL field and click Create new link. -
Under The supplied Application URL has redirected once, check the Use this URL checkbox and click Continue.
-
Enter Che as the Application Name.
-
Select Generic Application as the Application Type.
-
Enter Che as the Service Provider Name.
-
Paste the content of the
bitbucket-consumer-key
file as the Consumer key. -
Paste the content of the
bitbucket-shared-secret
file as the Shared secret. -
Enter
<bitbucket_server_url>/plugins/servlet/oauth/request-token
as the Request Token URL. -
Enter
<bitbucket_server_url>/plugins/servlet/oauth/access-token
as the Access token URL. -
Enter
<bitbucket_server_url>/plugins/servlet/oauth/authorize
as the Authorize URL. -
Check the Create incoming link checkbox and click Continue.
-
Paste the content of the
bitbucket-consumer-key
file as the Consumer Key. -
Enter Che as the Consumer name.
-
Paste the content of the
public-stripped.pub
file as the Public Key and click Continue.
Applying an application link Secret for the Bitbucket Server
Prepare and apply the application link Secret for the Bitbucket Server.
-
The application link is set up on the Bitbucket Server.
-
The following files, which were created when setting up the application link, are prepared:
-
privatepkcs8-stripped.pem
-
bitbucket-consumer-key
-
bitbucket-shared-secret
-
-
An active
kubectl
session 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/component: oauth-scm-configuration app.kubernetes.io/part-of: che.eclipse.org annotations: che.eclipse.org/oauth-scm-server: bitbucket che.eclipse.org/scm-server-endpoint: <bitbucket_server_url> (2) type: Opaque stringData: private.key: <Content_of_privatepkcs8-stripped.pem> (3) consumer.key: <Content_of_bitbucket-consumer-key> (4) shared_secret: <Content_of_bitbucket-shared-secret> (5)
1 The Che namespace. The default is eclipse-che
.2 The URL of the Bitbucket Server. 3 The content of the privatepkcs8-stripped.pem
file.4 The content of the bitbucket-consumer-key
file.5 The content of the bitbucket-shared-secret
file. -
Apply the Secret:
$ kubectl apply -f - <<EOF <Secret_prepared_in_the_previous_step> EOF
-
Verify in the output that the Secret is created.