Examples of ISVNAuthenticationManager


Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

        SVNRepositoryFactoryImpl.setup();
        SVNRepository repository = null;
        SVNNodeKind nodeKind = null;
        try {
            repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(username, password);
            repository.setAuthenticationManager(authManager);
            nodeKind = repository.checkPath("", -1);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

         *
         *  authManager = new BasicAuthenticationsManager(userName, userPassword);
         *
         * You may also skip this point - anonymous access will be used.
         */
        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, userPassword);
        repository.setAuthenticationManager(authManager);

        /*
         * Get type of the node located at URL we used to create SVNRepository.
         *
 
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

        DAVRepositoryFactory.setup();
        SVNRepositoryFactoryImpl.setup();
        String uri = args[0].getStringValue();
        try {
            SVNRepository repo = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(uri));
            ISVNAuthenticationManager authManager =
                    SVNWCUtil.createDefaultAuthenticationManager(args[1].getStringValue(), args[2].getStringValue());
            repo.setAuthenticationManager(authManager);

            long latestRevision = repo.getLatestRevision();
        return new IntegerValue(latestRevision);
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

        SVNRepositoryFactoryImpl.setup();
        String uri = args[0].getStringValue();
        try {
            SVNRepository repo =
                    SVNRepositoryFactory.create(SVNURL.parseURIDecoded(uri));
            ISVNAuthenticationManager authManager =
                    SVNWCUtil.createDefaultAuthenticationManager(args[1].getStringValue(), args[2].getStringValue());
            repo.setAuthenticationManager(authManager);

            long startRevision = 0;
            long endRevision = -1; // = HEAD
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

//      try {
//        db = BrokerPool.getInstance();
//        broker = db.get(SecurityManager.SYSTEM_USER);
//       
            boolean storeAuth = options == null ? true : options.isAuthStorageEnabled();
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(null, userName, password, storeAuth);
            return new SVNClientManager(options, authManager);
//    } catch (Exception e) {
//      if (db != null) db.release(broker);
//      return null;
//    }
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

   
  }
 
  private void storeInSubversion(byte[] file, String fileName, String commitComment) throws SVNException {
    try {
      ISVNAuthenticationManager authManager = new BasicAuthenticationManager(svnUser, svnPwd);
      DAVRepositoryFactory.setup();
      SVNURL url = SVNURL.parseURIDecoded(svnUrl);
      SVNRepository repository = DAVRepositoryFactory.create(url, null);
      repository.setAuthenticationManager(authManager);
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

   
  }
 
  private void storeInSubversion(byte[] file, String fileName, String commitComment) throws SVNException {
    try {
      ISVNAuthenticationManager authManager = new BasicAuthenticationManager(svnUser, svnPwd);
      DAVRepositoryFactory.setup();
      SVNURL url = SVNURL.parseURIDecoded(svnUrl);
      SVNRepository repository = DAVRepositoryFactory.create(url, null);
      repository.setAuthenticationManager(authManager);
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

        myIsUseConnectionPing = useConnectionPing;
        myIsUseSessionPing = useSessionPing;
    }

    public void open(SVNRepositoryImpl repository) throws SVNException {
        ISVNAuthenticationManager authManager = repository.getAuthenticationManager();
        if (authManager == null) {
            SVNErrorManager.authenticationFailed("Authentication required for ''{0}''", repository.getLocation());
            return;
        }

        String realm = repository.getLocation().getProtocol() + "://" + repository.getLocation().getHost();
        if (repository.getLocation().hasPort()) {
            realm += ":" + repository.getLocation().getPort();
        }
        if (repository.getLocation().getUserInfo() != null && !"".equals(repository.getLocation().getUserInfo())) {
            realm = repository.getLocation().getUserInfo() + "@" + realm;
        }

        int reconnect = 1;
        while(true) {
            SVNSSHAuthentication authentication = (SVNSSHAuthentication) authManager.getFirstAuthentication(ISVNAuthenticationManager.SSH, realm, repository.getLocation());
            SSHConnectionInfo connection = null;
           
            // lock SVNSSHSession to make sure connection opening and session creation is atomic.
            SVNSSHSession.lock(Thread.currentThread());
            try {
                while (authentication != null) {
                    try {
                        connection = SVNSSHSession.getConnection(repository.getLocation(), authentication, authManager.getConnectTimeout(repository), myIsUseConnectionPing);
                        if (connection == null) {
                            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Cannot connect to ''{0}''", repository.getLocation().setPath("", false));
                            SVNErrorManager.error(err, SVNLogType.NETWORK);
                        }
                        authManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.SSH, realm, null, authentication);
                        break;
                    } catch (SVNAuthenticationException e) {
                        SVNDebugLog.getDefaultLog().logFine(SVNLogType.NETWORK, e);
                        authManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.SSH, realm, e.getErrorMessage(), authentication);
                        authentication = (SVNSSHAuthentication) authManager.getNextAuthentication(ISVNAuthenticationManager.SSH, realm, repository.getLocation());
                        connection = null;
                    }
                }
                if (authentication == null) {
                    SVNErrorManager.cancel("authentication cancelled", SVNLogType.NETWORK);
                } else if (connection == null) {
                    SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_SVN_CONNECTION_CLOSED, "Can not establish connection to ''{0}''", realm), SVNLogType.NETWORK);
                }
                try {
                    mySession = connection.openSession();
                    SVNAuthentication author = authManager.getFirstAuthentication(ISVNAuthenticationManager.USERNAME, realm, repository.getLocation());
                    if (author == null) {
                        SVNErrorManager.cancel("authentication cancelled", SVNLogType.NETWORK);
                    }
                    String userName = author.getUserName();
                    if (userName == null || "".equals(userName.trim())) {
                        userName = authentication.getUserName();
                    }
                    if (author.getUserName() == null || author.getUserName().equals(authentication.getUserName()) ||
                            "".equals(author.getUserName())) {
                        repository.setExternalUserName("");
                    } else {
                        repository.setExternalUserName(author.getUserName());
                    }
                    author = new SVNUserNameAuthentication(userName, author.isStorageAllowed());
                    authManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.USERNAME, realm, null, author);
   
                    if ("".equals(repository.getExternalUserName())) {
                        mySession.execCommand(SVNSERVE_COMMAND);
                    } else {
                        mySession.execCommand(SVNSERVE_COMMAND_WITH_USER_NAME + "\"" + repository.getExternalUserName() + "\"");
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

        if (mechs == null || mechs.size() == 0) {
            return;
        }
        myRealm = SVNReader.getString(items, 1);
       
        ISVNAuthenticationManager authManager = myRepository.getAuthenticationManager();
        if (authManager != null && authManager.isAuthenticationForced() && mechs.contains("ANONYMOUS") &&
                (mechs.contains("CRAM-MD5") || mechs.contains("DIGEST-MD5"))) {
            mechs.remove("ANONYMOUS");
        }
        SVNAuthenticator authenticator = createSASLAuthenticator();
        authenticator.authenticate(mechs, myRealm, repository);
View Full Code Here

Examples of org.tmatesoft.svn.core.auth.ISVNAuthenticationManager

     * @return SVNRepository object
     */
    private SVNRepository getNewRepository() throws SVNException {
        SVNRepository repository = SVNRepositoryFactory.create(repoUrl);
        if (username != null) {
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(new File(repoUrl.getPath()), username,
                    password);
            repository.setAuthenticationManager(authManager);
        }
        return repository;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.