org.tmatesoft.svn.core.auth.BasicAuthenticationManager Java Examples
The following examples show how to use
org.tmatesoft.svn.core.auth.BasicAuthenticationManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvnClient.java From steady with Apache License 2.0 | 6 votes |
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); }
Example #2
Source File: MCRVersioningMetadataStore.java From mycore with GNU General Public License v3.0 | 5 votes |
/** * Returns the SVN repository used to manage metadata versions in this * store. * * @return the SVN repository used to manage metadata versions in this * store. */ SVNRepository getRepository() throws SVNException { SVNRepository repository = SVNRepositoryFactory.create(repURL); String user = MCRSessionMgr.getCurrentSession().getUserInformation().getUserID(); SVNAuthentication[] auth = { SVNUserNameAuthentication.newInstance(user, false, repURL, false) }; BasicAuthenticationManager authManager = new BasicAuthenticationManager(auth); repository.setAuthenticationManager(authManager); return repository; }
Example #3
Source File: SvnTestServer.java From git-as-svn with GNU General Public License v2.0 | 5 votes |
@NotNull private SvnOperationFactory createOperationFactory(@NotNull String username, @NotNull String password) { final SVNWCContext wcContext = new SVNWCContext(new DefaultSVNOptions(getTempDirectory().toFile(), true), null); wcContext.setSqliteTemporaryDbInMemory(true); wcContext.setSqliteJournalMode(SqlJetPagerJournalMode.MEMORY); final SvnOperationFactory factory = new SvnOperationFactory(wcContext); factory.setAuthenticationManager(BasicAuthenticationManager.newInstance(username, password.toCharArray())); svnFactories.add(factory); return factory; }
Example #4
Source File: SvnObjectPools.java From proctor with Apache License 2.0 | 5 votes |
@Override public SVNClientManager create() throws Exception { if (requiresAuthentication) { final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password); return SVNClientManager.newInstance(null, authManager); } else { return SVNClientManager.newInstance(); } }
Example #5
Source File: SvnTesterExternalListener.java From git-as-svn with GNU General Public License v2.0 | 4 votes |
@NotNull @Override public SvnTester create() throws Exception { return new SvnTesterExternal(url, BasicAuthenticationManager.newInstance(USER_NAME, PASSWORD.toCharArray())); }
Example #6
Source File: SvnTestServer.java From git-as-svn with GNU General Public License v2.0 | 4 votes |
@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; }
Example #7
Source File: SvnProctorUtils.java From proctor with Apache License 2.0 | 4 votes |
static void doInWorkingDirectory( final Logger logger, final File userDir, final String username, final String password, final SVNURL svnUrl, 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(); try { // Clean up the UserDir SvnProctorUtils.cleanUpWorkingDir(logger, userDir, svnUrl, userClientManager); /* if (previousVersion != 0) { final Collection<?> changesSinceGivenVersion = repo.log(new String[] { "" }, null, previousVersion, -1, false, false); if (! changesSinceGivenVersion.isEmpty()) { // TODO: the baseline version is out of date, so need to go back to the user } } updateClient.doCheckout(checkoutUrl, workingDir, null, SVNRevision.HEAD, SVNDepth.INFINITY, false); */ final FileBasedProctorStore.RcsClient rcsClient = new SvnPersisterCoreImpl.SvnRcsClient(wcClient); final boolean thingsChanged = updater.doInWorkingDirectory(rcsClient, userDir); if (thingsChanged) { final SVNCommitClient commitClient = userClientManager.getCommitClient(); final SVNCommitPacket commit = commitClient.doCollectCommitItems(new File[]{userDir}, false, false, SVNDepth.INFINITY, new String[0]); long elapsed = -System.currentTimeMillis(); final SVNCommitInfo info = commitClient.doCommit(commit, /* keepLocks */ false, comment); elapsed += System.currentTimeMillis(); if (logger.isDebugEnabled()) { final StringBuilder changes = new StringBuilder("Committed " + commit.getCommitItems().length + " changes: "); for (final SVNCommitItem item : commit.getCommitItems()) { changes.append(item.getKind() + " - " + item.getPath() + ", "); } changes.append(String.format(" in %d ms new revision: r%d", elapsed, info.getNewRevision())); logger.debug(changes.toString()); } } } finally { userClientManager.dispose(); } }