Skip to content

Commit

Permalink
fixup! Specify Bitbucket Server provider naem, fix GitHub url parser
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig committed Jun 6, 2024
1 parent fa88e1e commit 901e212
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class BitbucketOAuthAuthenticator extends OAuthAuthenticator {
private final String bitbucketEndpoint;

private static final String BITBUCKET_CLOUD_ENDPOINT = "https://bitbucket.org";
private static final String BITBUCKET_NAME = "bitbucket";
private static final String BITBUCKET_SERVER_NAME = "bitbucket-server";

public BitbucketOAuthAuthenticator(
String bitbucketEndpoint,
Expand All @@ -54,7 +56,10 @@ public String getAuthenticateUrl(URL requestUrl, List<String> scopes) {

@Override
public final String getOAuthProvider() {
return BITBUCKET_CLOUD_ENDPOINT.equals(bitbucketEndpoint) ? "bitbucket" : "bitbucket-server";
// Bitbucket Cloud and Bitbucket Server have different provider names.
return BITBUCKET_CLOUD_ENDPOINT.equals(bitbucketEndpoint)
? BITBUCKET_NAME
: BITBUCKET_SERVER_NAME;
}

@Override
Expand Down

0 comments on commit 901e212

Please sign in to comment.