Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Commit f8b3707

Browse files
mminnswhoisj
authored andcommitted
issue-695 Add support for Botbucket Access Token authentication into Network HttpClient calls.
1 parent 693fed8 commit f8b3707

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

Bitbucket.Authentication/Src/Authority.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public async Task<bool> ValidateCredentials(TargetUri targetUri, string username
166166
}
167167

168168
// If the basic authentication test failed then try again as OAuth
169-
if (await ValidateCredentials(targetUri, new Token(credentials.Password, TokenType.BitbucketPassword)))
169+
if (await ValidateCredentials(targetUri, new Token(credentials.Password, TokenType.BitbucketAccess)))
170170
{
171171
return true;
172172
}

Microsoft.Alm.Authentication/Src/Network.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ private HttpClient GetHttpClient(TargetUri targetUri, HttpMessageHandler handler
440440
switch (token.Type)
441441
{
442442
case TokenType.AzureAccess:
443+
case TokenType.BitbucketAccess:
443444
{
444445
// ADAL access tokens are packed into the Authorization header.
445446
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Value);

Microsoft.Alm.Authentication/Src/TokenType.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,16 @@ public enum TokenType
6060
[System.ComponentModel.Description("Test-only Token")]
6161
Test = 5,
6262

63-
/// <summary>
64-
/// Bitbucket Password Tokens.
65-
/// </summary>
66-
[System.ComponentModel.Description("Bitbucket Password Token")]
67-
BitbucketPassword = 6,
68-
6963
/// <summary>
7064
/// Bitbucket Access Tokens.
7165
/// </summary>
7266
[System.ComponentModel.Description("Bitbucket Access Token")]
73-
BitbucketAccess = 7,
67+
BitbucketAccess = 6,
7468

7569
/// <summary>
7670
/// Used to auto-refresh Bitbucket Access Tokens.
7771
/// </summary>
7872
[System.ComponentModel.Description("Bitbucket Refresh Token")]
79-
BitbucketRefresh = 8,
73+
BitbucketRefresh = 7,
8074
}
8175
}

0 commit comments

Comments
 (0)