Object[] creds = read("[(?S?S)]", null); if (repository != null && repository.getRepositoryRoot() == null) { repository.updateCredentials((String) creds[0], (String) creds[1]);
if (!myIsCredentialsReceived) { Object[] creds = read("[(?S?S)]", null); if (repository != null && repository.getRepositoryRoot() == null) { repository.updateCredentials((String) creds[0], (String) creds[1]); } myIsCredentialsReceived = true;
    public void authenticate(SVNRepositoryImpl repository, ISVNCredentials credentials) throws SVNException {        String failureReason = null;        Object[] items = read("[((*W)S)]", null);        List mechs = SVNReader.getList(items, 0);        if (mechs == null || mechs.size() == 0) {            return;        }        for (int i = 0; i < mechs.size(); i++) {            String mech = (String) mechs.get(i);            if ("ANONYMOUS".equals(mech) || "EXTERNAL".equals(mech)) {            	// send anon and read response                write("(w())", new Object[] { mech });                items = read("(W(?S))", null);                if (SUCCESS.equals(items[0])) {                    Object[] creds = read("[(?S?S)]", null);                    if (repository != null && repository.getRepositoryRoot() == null) {                        repository.updateCredentials((String) creds[0], (String) creds[1]);                    }                    return;                } else if (FAILURE.equals(items[0])) {                	failureReason = (String) items[1];                }            } else if ("CRAM-MD5".equals(mech)) {                CramMD5 authenticator = new CramMD5();                if (credentials == null) {                    throw new SVNAuthenticationException("authentication failed, no credentials");                }                write("(w())", new Object[] { mech });                while(true) {	                authenticator.setUserCredentials(credentials);	                items = read("(W(?B))", null);	                if (SUCCESS.equals(items[0])) {                        Object[] creds = read("[(S?S)]", null);                        if (creds != null && creds.length == 2 && creds[0] != null && creds[1] != null) {                            repository.updateCredentials((String) creds[0], (String) creds[1]);                        }	                    return;	                } else if (FAILURE.equals(items[0])) {	                	failureReason = new String((byte[]) items[1]);                    	throw new SVNAuthenticationException("authentication failed: " + failureReason);	                }  else if (STEP.equals(items[0])) {	                    byte[] response = authenticator.buildChallengeReponse((byte[]) items[1]);	                    try {	                        getOutputStream().write(response);	                    } catch (IOException e) {	                        throw new SVNException(e);	                    }	                }                }            } else {            	failureReason = mech + " authorization requested, but not supported";            }        }        throw new SVNException(failureReason);    }