当前位置: 首页>>代码示例>>Java>>正文


Java BasicAuthenticationManager类代码示例

本文整理汇总了Java中org.tmatesoft.svn.core.auth.BasicAuthenticationManager的典型用法代码示例。如果您正苦于以下问题:Java BasicAuthenticationManager类的具体用法?Java BasicAuthenticationManager怎么用?Java BasicAuthenticationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicAuthenticationManager类属于org.tmatesoft.svn.core.auth包,在下文中一共展示了BasicAuthenticationManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAuthManager

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
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() );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:23,代码来源:SvnJavaScmProviderRepository.java

示例2: getClientManager

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
protected SVNClientManager getClientManager(final SVNRepository repository) {
    // Gets the current transaction
    Transaction transaction = transactionService.get();
    if (transaction == null) {
        throw new IllegalStateException("All SVN calls must be part of a SVN transaction");
    }
    // Gets the client manager
    return transaction
            .getResource(
                    SVNSession.class,
                    repository.getId(),
                    () -> {
                        // Creates the client manager for SVN
                        SVNClientManager clientManager = SVNClientManager.newInstance();
                        // Authentication (if needed)
                        String svnUser = repository.getConfiguration().getUser();
                        String svnPassword = repository.getConfiguration().getPassword();
                        if (StringUtils.isNotBlank(svnUser) && StringUtils.isNotBlank(svnPassword)) {
                            clientManager.setAuthenticationManager(BasicAuthenticationManager.newInstance(svnUser, svnPassword.toCharArray()));
                        }
                        // OK
                        return new SVNSessionImpl(clientManager);
                    }
            )
            .getClientManager();
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:27,代码来源:SVNClientImpl.java

示例3: getRepository

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:17,代码来源:MCRVersioningMetadataStore.java

示例4: setProxy

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
/**
 * Set the proxy for a {@link BasicAuthenticationManager}.
 * 
 * @param authManager The authentication manager to set the proxy server on.
 */
public void setProxy(final BasicAuthenticationManager authManager) {
  if (proxyHost != null) {
    Message.debug(String.format("The proxy server is %s:%s. The proxy username is %s", proxyHost, Integer
        .toString(proxyPort), proxyUser));
    authManager.setProxy(proxyHost, proxyPort, proxyUser, proxyPassword);
  }
}
 
开发者ID:massdosage,项目名称:ivysvn,代码行数:13,代码来源:ProxySettings.java

示例5: apply

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
public BasicSVNOperations apply(final HttpServletRequest request) {
  DAVRepositoryFactory.setup();
  SVNRepository repository = createRepository();
  UsernamePassword credentials = getBasicAuthCredentials(request.getHeader("Authorization"));
  // To get proxy support for testing/debug:
  // repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager());
  repository.setAuthenticationManager(new BasicAuthenticationManager(credentials.getUsername(), credentials.getPassword()));
  request.setAttribute(RequestAttributes.USERNAME, credentials.getUsername());
  return new RepositoryBasicSVNOperations(repository, _autoPropertiesApplier);
}
 
开发者ID:CoreFiling,项目名称:reviki,代码行数:11,代码来源:BasicAuthPassThroughBasicSVNOperationsFactory.java

示例6: SvnPlugin

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
@Autowired
public SvnPlugin(DataConfigService config, FileService fileService,
		@Value("${vcs.plugin.svn.repository}") String repositoryUriString,
		@Value("${vcs.plugin.svn.username}") String repositoryUsername,
		@Value("${vcs.plugin.svn.password}") String repositoryPassword
		) {
	
	this.fileService = fileService;
	
	svnOperationFactory = new SvnOperationFactory();
	if (repositoryUsername != null && repositoryUsername != "") {
		svnOperationFactory.setAuthenticationManager(
				BasicAuthenticationManager.newInstance(repositoryUsername, repositoryPassword.toCharArray()));
	}
	
	try {
		final String uriString = repositoryUriString.replaceAll(" ", "%20");
		final URI uri = new URI(uriString);
		final SVNURL url = SVNURL.parseURIEncoded(uri.toASCIIString());
		repository = SvnTarget.fromURL(url, SVNRevision.HEAD);
		
	} catch (URISyntaxException | SVNException e) {
		throw new IllegalArgumentException("Invalid SVN repository uri!", e);
	}
	checkRepoAvailable();
	
	workingCopyDir = config.assetsNew();
	workingCopy = SvnTarget.fromFile(workingCopyDir.toFile(), SVNRevision.WORKING);
	
	initializeWorkingCopy(workingCopyDir.toFile());
}
 
开发者ID:Katharsas,项目名称:GMM,代码行数:32,代码来源:SvnPlugin.java

示例7: createOperationFactory

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
@NotNull
private SvnOperationFactory createOperationFactory(@NotNull String userName, @NotNull String password) {
  final SVNWCContext wcContext = new SVNWCContext(new DefaultSVNOptions(getTempDirectory(), 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;
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:12,代码来源:SvnTestServer.java

示例8: create

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
@Override
public SVNClientManager create() throws Exception {
    if (requiresAuthentication) {
        final BasicAuthenticationManager authManager = new BasicAuthenticationManager(username, password);
        return SVNClientManager.newInstance(null, authManager);
    } else {
        return SVNClientManager.newInstance();
    }
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:10,代码来源:SvnObjectPools.java

示例9: returnChangedDirectories

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
public List<String> returnChangedDirectories() {

        if (getRepository() == null) {
            return null;
        }
        if (getVersion() == null) {
            return null;
        }

        File repositoryDir = new File(getRepository());
        changedDirectories svnChangedDirectories = new changedDirectories();

        ISVNAuthenticationManager svnManager = new BasicAuthenticationManager(loginSVN, senhaSVN);
        ISVNOptions svnOptions = new DefaultSVNOptions();
        SVNLookClient cliLook = new SVNLookClient(svnManager, svnOptions);

        try {
            cliLook.doGetChangedDirectories(repositoryDir, SVNRevision.create(Long.parseLong(getVersion())), svnChangedDirectories);
        } catch (SVNException ex) {
            Logger.getLogger(SvnInformation.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

        

        return svnChangedDirectories.getDirectories();
    }
 
开发者ID:gems-uff,项目名称:oceano,代码行数:28,代码来源:SvnInformation.java

示例10: retornaMensagem

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
public String retornaMensagem(){

        String result = null;
        
        if (getRepository() == null) {
            return null;
        }
        if (getVersion() == null) {
            return null;
        }



        ISVNAuthenticationManager svnManager = new BasicAuthenticationManager("", "");
        ISVNOptions svnOptions = new DefaultSVNOptions();
        SVNLookClient cliLook = new SVNLookClient(svnManager, svnOptions);

        File rep = new File(getRepository());
        try {
            result = cliLook.doGetLog(rep, SVNRevision.create(Long.parseLong(getVersion())));
        } catch (SVNException ex) {
            System.out.println("Problema ao fazer svnlook log");
            Logger.getLogger(SvnInformation.class.getName()).log(Level.SEVERE, null, ex);
        }
        

        return result;

    }
 
开发者ID:gems-uff,项目名称:oceano,代码行数:30,代码来源:SvnInformation.java

示例11: returnChangedDirectories

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
public List<String> returnChangedDirectories() {

        if (getRepository() == null) {
            return null;
        }
        if (getVersion() == null) {
            return null;
        }

        File repositoryDir = new File(getRepository());
        changedDirectories svnChangedDirectories = new changedDirectories();

        ISVNAuthenticationManager svnManager = new BasicAuthenticationManager(loginSVN, senhaSVN);
        ISVNOptions svnOptions = new DefaultSVNOptions();
        SVNLookClient cliLook = new SVNLookClient(svnManager, svnOptions);

        try {
            cliLook.doGetChangedDirectories(repositoryDir, SVNRevision.create(Long.parseLong(getVersion())), svnChangedDirectories);
        } catch (SVNException ex) {
            Logger.getLogger(svnInformation.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

        

        return svnChangedDirectories.getDirectories();
    }
 
开发者ID:gems-uff,项目名称:oceano,代码行数:28,代码来源:svnInformation.java

示例12: retornaMensagem

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
public String retornaMensagem(){

        String result = null;
        
        if (getRepository() == null) {
            return null;
        }
        if (getVersion() == null) {
            return null;
        }



        ISVNAuthenticationManager svnManager = new BasicAuthenticationManager("", "");
        ISVNOptions svnOptions = new DefaultSVNOptions();
        SVNLookClient cliLook = new SVNLookClient(svnManager, svnOptions);

        File rep = new File(getRepository());
        try {
            result = cliLook.doGetLog(rep, SVNRevision.create(Long.parseLong(getVersion())));
        } catch (SVNException ex) {
            System.out.println("Problema ao fazer svnlook log");
            Logger.getLogger(svnInformation.class.getName()).log(Level.SEVERE, null, ex);
        }
        

        return result;

    }
 
开发者ID:gems-uff,项目名称:oceano,代码行数:30,代码来源:svnInformation.java

示例13: create

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
/**
 * Creates new {@code SVNRepository} objects based on the data of the
 * supplied {œcode connectionSettings}.
 *
 * @throws SVNException if the supplied url of the {@code connectionSettings} cannot be parsed
 */
static SVNRepository create(ScmConnectionSettings connectionSettings) throws SVNException {
  SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(connectionSettings.getUrl()));
  if (connectionSettings.hasUsername()) {
    repository.setAuthenticationManager(
        new BasicAuthenticationManager(connectionSettings.getUsername(), connectionSettings.getPassword()));
  }
  return repository;
}
 
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:15,代码来源:SvnRepositoryFactory.java

示例14: getRequestedDAVResource

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
@Override
public DAVResource getRequestedDAVResource(boolean isSVNClient, String deltaBase, String pathInfo, long version, String clientOptions,
        String baseChecksum, String resultChecksum, String label, boolean useCheckedIn, List lockTokens, Map capabilities) throws SVNException {
    pathInfo = pathInfo == null ? getResourcePathInfo() : pathInfo;

    // use latest version, if no version was specified
    SVNRepository resourceRepository = SVNGitRepositoryFactory.create(SVNURL.parseURIEncoded(getResourceRepositoryRoot()));
    if ( version == -1 )
    {
      version = resourceRepository.getLatestRevision();
    }

    DAVResourceURI resourceURI = new DAVResourceURI(getResourceContext(), pathInfo, label, useCheckedIn, version);
    DAVConfig config = getDAVConfig();
    String fsParentPath = config.getRepositoryParentPath();
    String xsltURI = config.getXSLTIndex();
    String reposName = config.getRepositoryName();
    String uri = resourceURI.getURI();

    if (fsParentPath != null && getDAVConfig().isListParentPath()) {
        if (uri.endsWith("/")) {
            uri = uri.substring(0, uri.length() - 1);
        }
        //TODO: later add code for parent path resource here
    }

    SVNDebugLog.getDefaultLog().logFine(SVNLogType.DEFAULT, "uri type - " + resourceURI.getType() + ", uri kind - " + resourceURI.getKind());

    String activitiesDB = config.getActivitiesDBPath();
    File activitiesDBDir = null;
    if (activitiesDB == null) {
        activitiesDBDir = new File(myRepositoryRootDir, DEFAULT_ACTIVITY_DB);
    } else {
        activitiesDBDir = new File(activitiesDB);
    }

    String userName = myUserPrincipal != null ? myUserPrincipal.getName() : null;
    SVNAuthentication auth = new SVNUserNameAuthentication(userName, false, null, false);
    BasicAuthenticationManager authManager = new BasicAuthenticationManager(new SVNAuthentication[] { auth });
    resourceRepository.setAuthenticationManager(authManager);
    SVNDebugLog.getDefaultLog().logFine(SVNLogType.DEFAULT, "revision: " + resourceURI.getRevision());
    DAVResource resource = new DAVResource(resourceRepository, this, resourceURI, isSVNClient, deltaBase, version,
            clientOptions, baseChecksum, resultChecksum, userName, activitiesDBDir, lockTokens, capabilities);
    return resource;
}
 
开发者ID:naver,项目名称:svngit,代码行数:46,代码来源:SVNGitRepositoryManager.java

示例15: create

import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; //导入依赖的package包/类
@NotNull
@Override
public SvnTester create() throws Exception {
  return new SvnTesterExternal(url, BasicAuthenticationManager.newInstance(USER_NAME, PASSWORD.toCharArray()));
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:6,代码来源:SvnTesterExternalListener.java


注:本文中的org.tmatesoft.svn.core.auth.BasicAuthenticationManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。