Skip to content

Commit

Permalink
chore: Add documentation pages for the Bitbucket SAAS OAuth flow (#2410)
Browse files Browse the repository at this point in the history
Add instructions how to configure Bitbucket SAAS OAuth flow
  • Loading branch information
vinokurig authored Sep 5, 2022
1 parent 8aa27c1 commit ed593d1
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 37 deletions.
3 changes: 2 additions & 1 deletion modules/administration-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +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-bitbucket.adoc[]
**** xref:configuring-oauth-1-for-a-bitbucket-server.adoc[]
**** xref:configuring-oauth-2-for-the-bitbucket-cloud.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 1.0 for a Bitbucket Server
:keywords: configuring-oauth, authorization, bitbucket, bitbucket-server, oauth-1, oauth-1.0
:navtitle: Configuring OAuth 1.0 for a Bitbucket Server
// :page-aliases:

[id="configuring-oauth-1-for-a-bitbucket-server_{context}"]
= 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.

include::partial$proc_setting-up-an-application-link-on-the-bitbucket-server.adoc[leveloffset=+1]

include::partial$proc_applying-an-application-link-secret-for-the-bitbucket-server.adoc[leveloffset=+1]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:_content-type: ASSEMBLY
:description: Configuring OAuth 2.0 for the Bitbucket Cloud
:keywords: configuring-oauth, authorization, bitbucket, bitbucket-cloud, cloud, oauth-2, oauth-2.0
:navtitle: Configuring OAuth 2.0 for the Bitbucket Cloud
// :page-aliases:

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

You can enable users to work with a remote Git repository that is hosted in the Bitbucket Cloud:

. Set up an OAuth consumer (OAuth 2.0) in the Bitbucket Cloud.
. Apply an OAuth consumer Secret for the Bitbucket Cloud.

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

include::partial$proc_applying-an-oauth-consumer-secret-for-the-bitbucket-cloud.adoc[leveloffset=+1]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:description: OAuth for GitHub, GitLab, or Bitbucket
:keywords: bitbucket
:navtitle: OAuth for GitHub, GitLab, or Bitbucket
:page-aliases:
// :page-aliases:

[id="oauth-for-github-gitlab-or-bitbucket_{context}"]
= OAuth for GitHub, GitLab, or Bitbucket
Expand All @@ -11,4 +11,4 @@ To enable users to work with remote Git repositories:

* xref:configuring-oauth-2-for-github.adoc[]
* xref:configuring-oauth-2-for-gitlab.adoc[]
* xref:configuring-oauth-1-for-bitbucket.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]
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
:_content-type: PROCEDURE
:description: Applying the Bitbucket application link Secret
:keywords: bitbucket, bitbucket-application, bitbucket-app, bitbucket-application-link, bitbucket-app-link, bitbucket-secret, secret
:navtitle: Applying the Bitbucket application link Secret
:description: Applying an application link Secret for the Bitbucket Server
:keywords: bitbucket, bitbucket-server, application-link, bitbucket-secret
:navtitle: Applying an application link Secret for the Bitbucket Server
// :page-aliases:

[id="applying-the-bitbucket-application-link-secret_{context}"]
= Applying the Bitbucket application link Secret
[id="applying-an-application-link-secret-for-the-bitbucket-server_{context}"]
= Applying an application link Secret for the Bitbucket Server

Prepare and apply the Bitbucket application link Secret.
Prepare and apply the application link Secret for the Bitbucket Server.

.Prerequisites

* Setting up the Bitbucket application link is completed.
* The application link is set up on the Bitbucket Server.

* The following Base64-encoded files, which were created when setting up the Bitbucket application link, are prepared:
* The following Base64-encoded files, which were created when setting up the application link, are prepared:
** `privatepkcs8-stripped.pem`
** `bitbucket_consumer_key`
** `bitbucket-shared-secret`
Expand Down Expand Up @@ -44,7 +44,7 @@ data:
shared_secret: __<Base64_content_of_bitbucket-shared-secret>__ <5>
----
<1> The {prod-short} namespace. The default is `{prod-namespace}`.
<2> The Bitbucket server URL.
<2> The URL of the Bitbucket Server.
<3> The Base64-encoded content of the `privatepkcs8-stripped.pem` file.
<4> The Base64-encoded content of the `bitbucket_consumer_key` file.
<5> The Base64-encoded content of the `bitbucket-shared-secret` file.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:_content-type: PROCEDURE
:description: Applying an OAuth consumer Secret for the Bitbucket Cloud
:keywords: bitbucket, bitbucket-cloud, oauth-consumer, bitbucket-consumer, oauth-consumer-secret, bitbucket-client-secret
:navtitle: Applying an OAuth consumer Secret for the Bitbucket Cloud
// :page-aliases:

[id="applying-an-oauth-consumer-secret-for-the-bitbucket-cloud_{context}"]
= Applying an OAuth consumer Secret for the Bitbucket Cloud

Prepare and apply an OAuth consumer Secret for the Bitbucket Cloud.

.Prerequisites

* The OAuth consumer is set up in the Bitbucket Cloud.

* 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
@@ -1,23 +1,23 @@
:_content-type: PROCEDURE
:description: Setting up the Bitbucket application link
:keywords: bitbucket, bitbucket-application-link, application-link
:navtitle: Setting up the Bitbucket application link
:description: Setting up an application link on the Bitbucket Server
:keywords: bitbucket, bitbucket-server, application-link
:navtitle: Setting up an application link on the Bitbucket Server
// :page-aliases:

[id="setting-up-the-bitbucket-application-link_{context}"]
= Setting up the Bitbucket application link
[id="setting-up-an-application-link-on-the-bitbucket-server_{context}"]
= Setting up an application link on the Bitbucket Server

Set up a Bitbucket application link using OAuth 1.0.
Set up an application link for OAuth 1.0 on the Bitbucket Server.

.Prerequisites

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

.Procedure

. On a command line, run the commands to create the necessary files for the next steps and for use when applying the Bitbucket application link Secret:
. 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:
+
[subs="+quotes,+attributes,+macros"]
----
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
:_content-type: PROCEDURE
:description: Setting up an OAuth consumer in the Bitbucket Cloud
:keywords: bitbucket, bitbucket-cloud, oauth-consumer, bitbucket-oauth-consumer, oauth-application
:navtitle: Setting up an OAuth consumer in the Bitbucket Cloud
// :page-aliases:

[id="setting-up-an-oauth-consumer-in-the-bitbucket-cloud_{context}"]
= Setting up an OAuth consumer in the Bitbucket Cloud

Set up an OAuth consumer for OAuth 2.0 in the Bitbucket Cloud.

.Prerequisites

* You are logged in to the Bitbucket Cloud.
* 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 the *All workspaces* page.

. Select a workspace and click it.

. Go to menu:Settings[OAuth consumers > 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, and click *Save*.

. Expand the added consumer and then 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 ed593d1

Please sign in to comment.