fixup! Add support for PATs in GitHub Enterprise server

pull/603/head
ivinokur 2023-11-17 12:44:31 +02:00
parent d8bdd3b906
commit ebefa6928b
3 changed files with 4 additions and 4 deletions

View File

@ -207,6 +207,7 @@ public abstract class AbstractGithubPersonalAccessTokenFetcher
public Optional<Pair<Boolean, String>> isValid(PersonalAccessTokenParams params) {
GithubApiClient apiClient;
if (githubApiClient.isConnected(params.getScmProviderUrl())) {
// The url from the token has the same url as the api client, no need to create a new one.
apiClient = githubApiClient;
} else {
if ("github".equals(params.getScmTokenName())) {

View File

@ -90,7 +90,10 @@ public abstract class AbstractGithubURLParser {
String trimmedUrl = trimEnd(url, '/');
return githubPattern.matcher(trimmedUrl).matches()
|| githubSSHPattern.matcher(trimmedUrl).matches()
// If the GitHub URL is not configured, try to find it in a manually added user namespace
// token.
|| isUserTokenPresent(trimmedUrl)
// Try to call an API request to see if the URL matches GitHub.
|| isApiRequestRelevant(trimmedUrl);
}

View File

@ -232,8 +232,4 @@ public class GitlabOAuthTokenFetcher implements PersonalAccessTokenFetcher {
? new GitlabApiClient(scmServerUrl)
: null;
}
public String getProviderName() {
return OAUTH_PROVIDER_NAME;
}
}