in TeamCity.GitHubIssues-server/src/main/java/jetbrains/buildServer/issueTracker/github/GitHubIssueFetcher.java [123:149]
public IssueData fetch() throws Exception {
GitHubClientSSL client;
if ("github.com".equals(myURL.getHost())) {
client = new GitHubClientSSL();
} else {
client = new GitHubClientSSL(myURL.getHost(), myURL.getPort(), myURL.getProtocol());
}
client.setTrustStore(myTrustStore);
if (myCredentials == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Connecting to " + myURL.toString() + "anonymously");
}
} else if (myCredentials instanceof TokenCredentials) {
final String token = ((TokenCredentials) myCredentials).getToken();
if (LOG.isDebugEnabled()) {
LOG.debug("Connecting to " + myURL.toString() + "using token starting with [" + token.substring(0, Math.min(2, token.length())) + "]");
}
client.setOAuth2Token(token);
} else {
UsernamePasswordCredentials cr = (UsernamePasswordCredentials) myCredentials;
if (LOG.isDebugEnabled()) {
LOG.debug("Connecting to " + myURL.toString() + "using username + [" + cr.getUserName() + "] and password");
}
client.setCredentials(cr.getUserName(), cr.getPassword());
}
return createIssueData(new IssueService(client).getIssue(myOwner, myRepo, myId));
}