Skip to content

Commit 318ec35

Browse files
authored
docs: add bitbucket app password requirements (#1213)
Separate instructions for authentication into a new `bitbucket-authentication` file. For Password/Token authentication, add a callout that, when using an App Password, account read permissions are required. Closes #1119
2 parents 628b3f0 + b430184 commit 318ec35

File tree

3 files changed

+61
-48
lines changed

3 files changed

+61
-48
lines changed

docs/bitbucket-authentication.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Bitbucket Authentication
2+
3+
When GCM is triggered by Git, it will check the `host` parameter passed
4+
to it. If this parameter contains `bitbucket.org` it will trigger Bitbucket
5+
authentication and prompt you for credentials. In this scenario, you have two
6+
options for authentication: `OAuth` or `Password/Token`.
7+
8+
### OAuth
9+
10+
The dialog GCM presents for authentication contains two tabs. The first tab
11+
(labeled `Browser`) will trigger OAuth Authentication. Clicking the `Sign in
12+
with your browser` button opens a browser request to
13+
`_https://bitbucket.org/site/oauth2/authorize?response_type=code&client_id={consumerkey}&state=authenticated&scope={scopes}&redirect_uri=http://localhost:34106/_`. This triggers a flow on Bitbucket requiring you to log in
14+
(and potentially complete 2FA) to authorize GCM to access Bitbucket with the
15+
specified scopes. GCM will then spawn a temporary local webserver, listening on
16+
port 34106, to handle the OAuth redirect/callback. Assuming you successfully
17+
log into Bitbucket and authorize GCM, this callback will include the appropriate
18+
tokens for GCM to handle authencation. These tokens are then stored in your
19+
configured [credential store][credstores] and are returned to Git.
20+
21+
### Password/Token
22+
23+
**Note:** Bitbucket Data Center, also known as Bitbucket Server or Bitbucket On
24+
Premises, only supports Basic Authentication - please follow the below
25+
instructions if you are using this product.
26+
27+
The dialog GCM presents for authentication contains two tabs. The second tab
28+
(labeled `Password/Token`) will trigger Basic Authentication. This tab contains
29+
two fields, one for your username and one for your password or token. If the
30+
`username` parameter was passed into GCM, that will pre-populate the username
31+
field, although it can be overridden. Enter your username (if needed) and your
32+
password or token (i.e. Bitbucket App Password) and click `Sign in`.
33+
34+
:rotating_light: Requirements for App Passwords :rotating_light:
35+
36+
If you are planning to use an [App Password][app-password] for basic
37+
authentication, it must at a minimum have _Account Read_ permissions (as shown
38+
below). If your App Password does not have these permissions, you will be
39+
re-prompted for credentials on every interaction with the server.
40+
41+
![][app-password-example]
42+
43+
When your username and password are submitted, GCM will attempt to retrieve a
44+
basic authentication token for these credentials via the Bitbucket REST API. If
45+
this is successful, the credentials, username, and password/token are stored in
46+
your configured [credential store][credstores] and are returned to Git.
47+
48+
If the API request fails with a 401 return code, the entered username/password
49+
combination is invalid; nothing is stored and nothing is returned to Git. In
50+
this scenario, re-attempt authentication, ensuring your credentials are correct.
51+
52+
If the API request fails with a 403 (Forbidden) return code, the username and
53+
password are valid, but 2FA is enabled on the corresponding Bitbucket Account.
54+
In this scenario, you will be prompted to complete the OAuth authentication
55+
process. If this is successful, the credentials, username, and password/token
56+
are stored in your configured [credential store][credstores] and are returned to
57+
Git.
58+
59+
[app-password]: https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/
60+
[app-password-example]: img/app-password.png
61+
[credstores]: ./credstores.md

docs/bitbucket-development.md

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -54,60 +54,12 @@ i.e. using a key such as `git:https://[email protected]/` rather than
5454
GCM can support multiple accounts, and usernames, for a single user against
5555
Bitbucket, e.g. a personal account and a work account.
5656

57-
## Authentication User Experience
58-
59-
When the GCM is triggered by Git, the GCM will check the `host` parameter passed
60-
to it. If it contains `bitbucket.org` it will trigger the Bitbucket related
61-
processes.
62-
63-
### Basic Authentication
64-
65-
If the GCM needs to prompt the user for credentials they will always be shown an
66-
initial dialog where they can enter a username and password. If the `username`
67-
parameter was passed into the GCM it is used to pre-populate the username field,
68-
although it can be overridden. When username and password credentials are
69-
submitted the GCM will use them to attempt to retrieve a token, for Basic
70-
Authentication this token is in effect the password the user just entered. The
71-
GCM retrieves this `token` by checking the password can be used to successfully
72-
retrieve the User profile via the Bitbucket REST API.
73-
74-
If the username and password credentials sent as Basic Authentication
75-
credentials works, then the password is identified as the token. The
76-
credentials, the username and the password/token, are then stored and the values
77-
returned to Git.
78-
79-
If the request for the User profile via the REST API fails with a 401 return
80-
code it indicates the username/password combination is invalid, nothing is
81-
stored and nothing is returned to Git.
82-
83-
However if the request fails with a 403 (Forbidden) return code, this indicates
84-
that the username and password are valid but 2FA is enabled on the Bitbucket
85-
Account. When this occurs the user it prompted to complete the OAuth
86-
authentication process.
87-
88-
### OAuth
89-
90-
OAuth authentication prompts the User with a new dialog where they can trigger
91-
OAuth authentication. This involves opening a browser request to `_https://bitbucket.org/site/oauth2/authorize?response_type=code&client_id={consumerkey}&state=authenticated&scope={scopes}&redirect_uri=http://localhost:34106/_`.
92-
This will trigger a flow on Bitbucket where the user must login, potentially
93-
including a 2FA prompt, and authorize the GCM to access Bitbucket with the
94-
specified scopes. The GCM will spawn a temporary, local webserver, listening on
95-
port 34106, to handle the OAuth redirect/callback. Assuming the user
96-
successfully logins into Bitbucket and authorizes the GCM this callback will
97-
include the Access and Refresh Tokens.
98-
99-
The Access and Refresh Tokens will be stored against the username and the
100-
username/Access Token credentials returned to Git.
101-
10257
## On-Premise Bitbucket
10358

10459
On-premise Bitbucket, more correctly known as Bitbucket Server or Bitbucket DC,
10560
has a number of differences compared to the cloud instance of Bitbucket,
10661
[bitbucket.org][bitbucket].
10762

108-
As far as GCMC is concerned the main difference it doesn't support OAuth so only
109-
Basic Authentication is available.
110-
11163
It is possible to test with Bitbucket Server by running it locally using the
11264
following command from the Atlassian SDK:
11365

docs/img/app-password.png

60.5 KB
Loading

0 commit comments

Comments
 (0)