9.3.5.2. Bitbucket Server OAuth 1 の設定
この手順では、Bitbucket Server の OAuth 1 をアクティベートして以下を実行する方法を説明します。
- Bitbucket Server でホストされる devfile を使用します。
- SCM サーバーのプライベートリポジトリーでユーザーを認証する。
これは CodeReady Workspaces が Bitbucket Server Personal アクセストークンを取得し、更新できるようにします。
前提条件
-
oc
ツールが利用できる。 - Bitbucket サーバーは、CodeReady Workspaces サーバーから利用できます。
手順
RSA キーペアと公開鍵の省略バージョンを生成します。
openssl genrsa -out <private.pem> 2048 openssl rsa -in <private.pem> -pubout > <public.pub> openssl pkcs8 -topk8 -inform pem -outform pem -nocrypt -in <private.pem> -out <privatepkcs8.pem> 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_server_consumer_key> openssl rand -base64 24 > <bitbucket_shared_secret>
コンシューマーおよびプライベートキーを含む Kubernetes シークレットを CodeReady Workspaces namespace に作成します。
$ oc apply -f - <<EOF kind: Secret apiVersion: v1 metadata: name: bitbucket-oauth-config namespace: <...> 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: <...> 2 type: Opaque data: private.key: <...> 3 consumer.key: <...> 4 EOF
Bitbucket でアプリケーションリンクを設定し、CodeReady Workspaces から Bitbucket サーバーへの通信を有効にします。
- Bitbucket Server で上部のナビゲーションバーをクリックし、Administration > Application Links に移動します。
-
アプリケーション URL:
\https://codeready-<openshift_deployment_name>.<domain_name>
を入力し、Create new link ボタンをクリックします。
- 「No response was received from the URL」という警告メッセージが表示されたら Continue ボタンをクリックします。
Link Applications フォームを入力し、Continue ボタンをクリックします。
- Application Name
-
<CodeReady Workspaces>
- Application Type
- Generic Application
- Service Provider Name
-
<CodeReady Workspaces>
- Consumer Key
-
<bitbucket_server_consumer_key>
ファイルの内容を貼り付けます。 - Shared secret
-
<bitbucket_shared_secret>
ファイルの内容を貼り付けます。 - Request Token URL
-
<Bitbucket Server URL>/plugins/servlet/oauth/request-token
- アクセストークン URL
-
<Bitbucket Server URL>/plugins/servlet/oauth/access-token
- Authorize URL
-
<Bitbucket Server URL>/plugins/servlet/oauth/access-token
- Create incoming link
- Enabled
Link Applications フォームを入力し、Continue ボタンをクリックします。
- Consumer Key
-
<bitbucket_server_consumer_key>
ファイルの内容を貼り付けます。 - Consumer name
-
<CodeReady Workspaces>
- Public Key
-
<public-stripped.pub>
ファイルの内容を貼り付けます。