Skip to content

Commit

Permalink
chore: Add documentation pages for the Bitbucket SAAS OAuth flow
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
  • Loading branch information
vinokurig authored and max-cx committed Sep 5, 2022
1 parent ed593d1 commit 99ff6dc
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/administration-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
*** xref:oauth-for-github-gitlab-or-bitbucket.adoc[]
**** xref:configuring-oauth-2-for-github.adoc[]
**** xref:configuring-oauth-2-for-gitlab.adoc[]
**** xref:configuring-oauth-1-for-a-bitbucket-server.adoc[]
**** xref:configuring-oauth-2-for-the-bitbucket-cloud.adoc[]
**** xref:configuring-oauth-1-for-bitbucket.adoc[]
**** xref:configuring-oauth-2-for-bitbucket.adoc[]
*** xref:configuring-the-administrative-user.adoc[]
*** xref:removing-user-data.adoc[]
* xref:managing-workloads-using-the-che-server-api.adoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:_content-type: ASSEMBLY
:description: Configuring OAuth 2.0 for Bitbucket
:keywords: configuring-oauth, authorization, bitbucket, oauth-2, oauth-2.0
:navtitle: Configuring OAuth 2.0 for Bitbucket
// :page-aliases:

[id="configuring-oauth-2-for-bitbucket{context}"]
= Configuring OAuth 2.0 for Bitbucket SAAS

To enable users to work with a remote Git repository that is hosted using a Bitbucket instance:

. Set up the Bitbucket OAuth consumer (OAuth 2.0).
. Apply the Bitbucket OAuth consumer Secret.

include::partial$proc_setting-up-the-bitbucket-saas-oauth-consumer.adoc[leveloffset=+1]

include::partial$proc_applying-the-bitbucket-saas-oauth-consumer-secret.adoc[leveloffset=+1]
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
:_content-type: CONCEPT
:description: OAuth for GitHub, GitLab, or Bitbucket
:description: OAuth for GitHub, GitLab, Bitbucket or Bitbucket SAAS
:keywords: bitbucket
:navtitle: OAuth for GitHub, GitLab, or Bitbucket
:navtitle: OAuth for GitHub, GitLab, Bitbucket or Bitbucket SAAS
// :page-aliases:

[id="oauth-for-github-gitlab-or-bitbucket_{context}"]
= OAuth for GitHub, GitLab, or Bitbucket
= OAuth for GitHub, GitLab, Bitbucket or Bitbucket SAAS

To enable users to work with remote Git repositories:

* xref:configuring-oauth-2-for-github.adoc[]
* xref:configuring-oauth-2-for-gitlab.adoc[]
* Configuring xref:configuring-oauth-1-for-a-bitbucket-server.adoc[OAuth 1.0 for a Bitbucket Server] or xref:configuring-oauth-2-for-the-bitbucket-cloud.adoc[OAuth 2.0 for the Bitbucket Cloud]
* xref:configuring-oauth-1-for-bitbucket.adoc[]
* xref:configuring-oauth-2-for-bitbucket.adoc[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:_content-type: PROCEDURE
:description: Applying the Bitbucket OAuth consumer Secret
:keywords: bitbucket, apply, secret, bitbucket-consumer, bitbucket-client-secret
:navtitle: Applying the Bitbucket OAuth consumer Secret
// :page-aliases:

[id="applying-the-bitbucket-oauth-consumer-secret_{context}"]
= Applying the Bitbucket OAuth consumer Secret

Prepare and apply the Bitbucket OAuth consumer Secret.

.Prerequisites

* Setting up the Bitbucket OAuth consumer is completed.

* The Base64-encoded values, which were generated when setting up the Bitbucket OAuth consumer, are prepared:
** *Bitbucket OAuth consumer Key*
** *Bitbucket OAuth consumer Secret*

* An active `{orch-cli}` session with administrative permissions to the destination {orch-name} cluster. See {orch-cli-link}.

.Procedure

. Prepare the Secret:
+
[source,yaml,subs="+quotes,+attributes,+macros"]
----
kind: Secret
apiVersion: v1
metadata:
name: bitbucket-oauth-config
namespace: {prod-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
type: Opaque
data:
id: __<Base64_Bitbucket_Oauth_Consumer_Key>__ <2>
secret: __<Base64_Bitbucket_Oauth_Consumer_Secret>__ <3>
----
<1> The {prod-short} namespace. The default is `{prod-namespace}`.
<2> The Base64-encoded *Bitbucket OAuth consumer Key*.
<3> The Base64-encoded *Bitbucket OAuth consumer Secret*.

. Apply the Secret:
+
[subs="+quotes,+attributes,+macros"]
----
$ {orch-cli} apply -f - <<EOF
__<Secret_prepared_in_the_previous_step>__
EOF
----

. Verify in the output that the Secret is created.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
:_content-type: PROCEDURE
:description: Setting up the Bitbucket OAuth consumer
:keywords: bitbucket, bitbucket-application, bitbucket-oauth-consumer, oauth-application
:navtitle: Setting up the Bitbucket OAuth consumer
// :page-aliases:

[id="setting-up-the-bitbucket-saas-oauth-consumer_{context}"]
= Setting up the Bitbucket OAuth consumer

Set up a Bitbucket OAuth consumer using OAuth 2.0.

.Prerequisites

* You are logged in to Bitbucket.
* link:https://www.gnu.org/software/coreutils/base64[`base64`] is installed in the operating system you are using.

.Procedure

. Click your avatar and go to *All workspaces* page.

. Select a workspace and click it.

. Go to menu:Settings[OAuth consumers] and click *Add consumer*.

. Enter *{prod-short}* as the *Name*.

. Enter `pass:c,a,q[{prod-url}]/api/oauth/callback` as the *Callback URL*.

. Under *Permissions*, check all of the `Account` and `Repositories` checkboxes.

. Click *Save*.

. Expand the added consumer, copy the *Key* value and encode it to Base64 for use when applying the Bitbucket OAuth consumer Secret:
+
[subs="+quotes,+attributes,+macros"]
----
$ echo -n '__<bitbucket_oauth_consumer_key>__' | base64
----

. Copy the *Secret* value and encode it to Base64 for use when applying the Bitbucket OAuth consumer Secret:
+
[subs="+quotes,+attributes,+macros"]
----
$ echo -n '__<bitbucket_oauth_consumer_secret>__' | base64
----

.Additional resources

* link:https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud[Bitbucket Docs: Use OAuth on Bitbucket Cloud]

0 comments on commit 99ff6dc

Please sign in to comment.