List of usage examples for org.eclipse.jgit.transport URIish setPass
public URIish setPass(String n)
From source file:jetbrains.buildServer.buildTriggers.vcs.git.agent.UpdaterImpl.java
License:Apache License
@Nullable private Trinity<String, String, String> getLfsAuth() { try {/*from www . j av a 2 s . c om*/ URIish uri = new URIish(myRoot.getRepositoryFetchURL().toString()); String scheme = uri.getScheme(); if (myRoot.getAuthSettings().getAuthMethod() == AuthenticationMethod.PASSWORD && ("http".equals(scheme) || "https".equals(scheme))) { String lfsUrl = uri.setPass("").setUser("").setPath("").toASCIIString(); if (lfsUrl.endsWith(".git")) { lfsUrl += "/info/lfs"; } else { lfsUrl += lfsUrl.endsWith("/") ? ".git/info/lfs" : "/.git/info/lfs"; } return Trinity.create(lfsUrl, myRoot.getAuthSettings().getUserName(), myRoot.getAuthSettings().getPassword()); } } catch (Exception e) { LOG.debug("Cannot get lfs auth config", e); } return null; }
From source file:jetbrains.buildServer.buildTriggers.vcs.git.AuthSettings.java
License:Apache License
public URIish createAuthURI(final URIish uri, boolean fixErrors) { URIish result = uri; if (requiresCredentials(result)) { if (!StringUtil.isEmptyOrSpaces(myUserName)) { result = result.setUser(myUserName); }//from ww w . j a v a 2s. c o m if (!StringUtil.isEmpty(myPassword)) { result = result.setPass(myPassword); } } if (fixErrors && isAnonymousProtocol(result)) { result = result.setUser(null); result = result.setPass(null); } return result; }