/** * Creates an auth manager given user credentials to use. * * @param credentials user credentials * * @since 1.8.9 */ public static BasicAuthenticationManager newInstance(SVNAuthentication[] credentials) { return new BasicAuthenticationManager(credentials); }
private BasicAuthenticationManager getAuthenticationManager() { if (username != null && password != null) { return BasicAuthenticationManager.newInstance(username, password.toCharArray()); } return null; }
/** * Creates an auth manager given user credentials to use. * * @param authentications user credentials */ public BasicAuthenticationManager(SVNAuthentication[] authentications) { setAuthentications(authentications); }
public void setRepoUrl(URL _u) throws RepoMismatchException { if(_u==null) throw new IllegalArgumentException("Invalid url: " + _u); this.url = _u; // Prepare repository setup (authentication and HTTP proxy) authManager = new BasicAuthenticationManager( "login" , "password" ); final String phost = this.cfg.getString("http.proxyHost", null); final String pport = this.cfg.getString("http.proxyPort", null); if(phost!=null && pport!=null) { authManager.setProxy(phost, new Integer(pport).intValue(), "", ""); SvnClient.log.info("Using proxy " + phost + ":" + pport); } // Set up repo for trunk (used for searching log entries) this.rootRepo = this.setupRepo(null); }
public void acknowledgeAndClearAuthentication(SVNErrorMessage errorMessage) throws SVNException { if (myAuthentication != null) { BasicAuthenticationManager.acknowledgeAuthentication(errorMessage == null, ISVNAuthenticationManager.SSL, realm, errorMessage, myAuthentication, url, authenticationManager); } if (errorMessage != null) { myKeyManagers = null; chooseAlias = null; } else { myAuthentication = null; myIsFirstRequest = true; } final Exception exception = myException; myException = null; if (exception instanceof SVNException) { throw (SVNException) exception; } else if (exception != null) { throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE, exception); } if (errorMessage != null && isNonInteractive()) { throw new SVNException(errorMessage); } }
/** * Sets a proxy server context to this manager. * * @deprecated * * @param proxyHost a proxy server hostname * @param proxyPort a proxy server port * @param proxyUserName a username to supply to a proxy machine * @param proxyPassword a password to supply to a proxy machine */ public void setProxy(String proxyHost, int proxyPort, String proxyUserName, String proxyPassword) { setProxy(proxyHost, proxyPort, proxyUserName, proxyPassword != null ? proxyPassword.toCharArray() : null); }
BasicAuthenticationManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.USERNAME, host, null, auth, repository.getLocation(), authManager); svnServeCommand = "svnserve -t --tunnel-user \"" + userName + "\""; repository.setExternalUserName(userName);
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
/** * Creates an auth manager given user credentials to use. * * @param authentications user credentials */ public BasicAuthenticationManager(SVNAuthentication[] authentications) { setAuthentications(authentications); }
/** * Creates an auth manager given a user credential - a username and * an ssh private key. * * @param userName a username * @param keyFile a private key file * @param passphrase a password to the private key * @param portNumber a port number over which an ssh tunnel is established * * @since 1.8.9 */ public static BasicAuthenticationManager newInstance(String userName, File keyFile, char[] passphrase, int portNumber) { return newInstance(new SVNAuthentication[] { SVNSSHAuthentication.newInstance(userName, keyFile, passphrase, portNumber, false, null, false), SVNUserNameAuthentication.newInstance(userName, false, null, false), }); }
BasicAuthenticationManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.USERNAME, realm, null, auth, myLocation, authManager); return auth.getUserName(); BasicAuthenticationManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.USERNAME, realm, err, auth, myLocation, authManager); auth = authManager.getNextAuthentication(ISVNAuthenticationManager.USERNAME, realm, getLocation());
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
/** * Creates an auth manager given user credentials to use. * * @param authentications user credentials */ public BasicAuthenticationManager(SVNAuthentication[] authentications) { setAuthentications(authentications); }
@NotNull @Override public SvnTester create() throws Exception { return new SvnTesterExternal(url, BasicAuthenticationManager.newInstance(USER_NAME, PASSWORD.toCharArray())); }
final SVNErrorMessage errorMessage = ex.getErrorMessage(); if (errorMessage != null && errorMessage.getErrorCode() == SVNErrorCode.RA_NOT_AUTHORIZED && authManager != null && myAuthentication != null) { BasicAuthenticationManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.PASSWORD, myRealm, errorMessage, myAuthentication, repository.getLocation(), authManager);
private boolean checkPassword(SVNURL url, String user, String password) throws SVNException { SVNRepository svnRepository = SVNRepositoryFactory.create(url); try { svnRepository.setAuthenticationManager(new BasicAuthenticationManager(user, password)); svnRepository.testConnection(); return true; } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_AUTHORIZED) { return false; } else { throw e; } } finally { svnRepository.closeSession(); } }
/** * Creates an auth manager given user credentials to use. * * @param authentications user credentials */ public BasicAuthenticationManager(SVNAuthentication[] authentications) { setAuthentications(authentications); }
@NotNull public static SVNRepository openSvnRepository(@NotNull SVNURL url, @NotNull String userName, @NotNull String password) throws SVNException { final SVNRepository repo = SVNRepositoryFactory.create(url); repo.setAuthenticationManager(BasicAuthenticationManager.newInstance(userName, password.toCharArray())); return repo; }
BasicAuthenticationManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.SSL, realm, null, auth, url, authenticationManager); } else { BasicAuthenticationManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.SSL, clientCertPath, null, SVNPasswordAuthentication.newInstance("", clientCertPassword, sslAuthentication.isStorageAllowed(), sslAuthentication.getURL(), false), url, authenticationManager); SVNDebugLog.getDefaultLog().logFine(SVNLogType.NETWORK, io); if (auth != null) { BasicAuthenticationManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.SSL, realm, SVNErrorMessage.create(SVNErrorCode.RA_NOT_AUTHORIZED, io.getMessage()), auth, url, authenticationManager); auth = authenticationManager.getNextAuthentication(ISVNAuthenticationManager.SSL, realm, sslAuthentication.getURL()); } else {
final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final SVNURL url = ...; svnOperationFactory.setAuthenticationManager(new BasicAuthenticationManager("myusername", "mypassword")); final SvnLog log = svnOperationFactory.createLog(); log.addRange(SvnRevisionRange.create(SVNRevision.create(date1), SVNRevision.create(date2))); log.setDiscoverChangedPaths(true); log.setSingleTarget(SvnTarget.fromURL(url)); log.setReceiver(new ISvnObjectReceiver<SVNLogEntry>() { @Override public void receive(SvnTarget target, SVNLogEntry logEntry) throws SVNException { ... } }); log.run(); } finally { svnOperationFactory.dispose(); }