/** * 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); }
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); }
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
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(); } }
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(); }
public SVNConnector build(String login, String pass) { if (repository == null) { DAVRepositoryFactory.setup(); SVNURL url; try { url = SVNURL.parseURIDecoded(SVNURI + SVNTestRepo); repository = SVNRepositoryFactory.create(url, null); } catch (SVNException e1) { e1.printStackTrace(); } } ISVNAuthenticationManager authManager = new BasicAuthenticationManager(login, pass); repository.setAuthenticationManager(authManager); return instance; }
final FileBasedProctorStore.ProctorUpdater updater, final String comment) throws IOException, SVNException, Exception { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); final SVNClientManager userClientManager = SVNClientManager.newInstance(null, authManager); final SVNWCClient wcClient = userClientManager.getWCClient();
final FileBasedProctorStore.ProctorUpdater updater, final String comment) throws IOException, SVNException, Exception { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); final SVNClientManager userClientManager = SVNClientManager.newInstance(null, authManager); final SVNWCClient wcClient = userClientManager.getWCClient();
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (!targets.isEmpty()) { targets.remove(0); } String[] locks = (String[]) targets.toArray(new String[targets.size()]); SVNRepository repository = SVNRepositoryFactory.create(SVNURL.fromFile(getLocalRepository())); String userName = System.getProperty("user.name", "administrator"); repository.setAuthenticationManager(new BasicAuthenticationManager(userName, "")); repository.setCanceller(getEnvironment()); for (int i = 0; i < locks.length; i++) { String lockPath = locks[i]; try { SVNLock lock = repository.getLock(lockPath); if (lock == null) { getEnvironment().getOut().println("Path '" + lockPath + "' isn't locked."); continue; } Map pathToToken = new SVNHashMap(); pathToToken.put(lockPath, lock.getID()); repository.unlock(pathToToken, true, this); } catch (SVNException e) { getEnvironment().handleError(e.getErrorMessage()); } } }
public void run() throws SVNException { List targets = getEnvironment().combineTargets(null, false); if (!targets.isEmpty()) { targets.remove(0); } String[] locks = (String[]) targets.toArray(new String[targets.size()]); SVNRepository repository = SVNRepositoryFactory.create(SVNURL.fromFile(getLocalRepository())); String userName = System.getProperty("user.name", "administrator"); repository.setAuthenticationManager(new BasicAuthenticationManager(userName, "")); repository.setCanceller(getEnvironment()); for (int i = 0; i < locks.length; i++) { String lockPath = locks[i]; try { SVNLock lock = repository.getLock(lockPath); if (lock == null) { getEnvironment().getOut().println("Path '" + lockPath + "' isn't locked."); continue; } Map pathToToken = new SVNHashMap(); pathToToken.put(lockPath, lock.getID()); repository.unlock(pathToToken, true, this); } catch (SVNException e) { getEnvironment().handleError(e.getErrorMessage()); } } }
private ISVNAuthenticationManager getAuthManager() { if ( getPrivateKey() != null ) { SVNSSHAuthentication[] auth = new SVNSSHAuthentication[1]; auth[0] = new SVNSSHAuthentication( getUser(), getPrivateKey().toCharArray(), getPassphrase(), -1, false ); return new BasicAuthenticationManager( auth ); } else if ( getUser() != null ) { return new BasicAuthenticationManager( getUser(), getPassword() ); } else { String configDirectory = SvnUtil.getSettings().getConfigDirectory(); return SVNWCUtil.createDefaultAuthenticationManager( configDirectory == null ? null : new File( configDirectory ), getUser(), getPassword(), SvnUtil.getSettings().isUseAuthCache() ); } } }
BasicAuthenticationManager authManager = new BasicAuthenticationManager(new SVNAuthentication[] { auth }); resourceRepository.setAuthenticationManager(authManager); DAVResource resource = new DAVResource(resourceRepository, this, resourceURI, isSVNClient, deltaBase, version,