myAuthManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.PASSWORD, realm, null, auth);
authManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.PASSWORD, realm, null, auth);
    public void authenticate(SVNRepositoryImpl repository) throws SVNException {        // use provider to get creds.        String failureReason = null;        Object[] items = read("[((*W)?S)]", null);        List mechs = SVNReader.getList(items, 0);        myRealm = SVNReader.getString(items, 1);        if (mechs == null || mechs.size() == 0) {            return;        }        SVNPasswordAuthentication auth = null;        boolean preemptive = myAuthManager != null && myAuthManager.isAuthenticationForced();        for (int i = 0; i < mechs.size(); i++) {            String mech = (String) mechs.get(i);            if ("EXTERNAL".equals(mech)) {                write("(w(s))", new Object[] { mech,                        repository.getExternalUserName() });                failureReason = readAuthResponse(repository);                if (failureReason == null) {                    return;                }            } else if ("ANONYMOUS".equals(mech) && !(preemptive && mechs.contains("CRAM-MD5"))) {                write("(w())", new Object[] { mech });                failureReason = readAuthResponse(repository);                if (failureReason == null) {                    return;                }            } else if ("CRAM-MD5".equals(mech)) {                preemptive = false;                while (true) {                    CramMD5 authenticator = new CramMD5();                    String realm = getRealm();                    if (myLocation != null) {                        realm = "<" + myLocation.getProtocol() + "://"                                + myLocation.getHost() + ":"                                + myLocation.getPort() + "> " + realm;                    }                    if (auth == null && myAuthManager != null) {                        auth = (SVNPasswordAuthentication) myAuthManager.getFirstAuthentication(ISVNAuthenticationManager.PASSWORD, realm, myLocation);                    } else if (myAuthManager != null) {                        myAuthManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.PASSWORD, realm, failureReason, auth);                        auth = (SVNPasswordAuthentication) myAuthManager.getNextAuthentication(ISVNAuthenticationManager.PASSWORD, realm, myLocation);                    }                    if (auth == null || auth.getUserName() == null || auth.getPassword() == null) {                        failureReason = "no credentials for '" + mech + "'";                        break;                    }                    write("(w())", new Object[] { mech });                    while (true) {                        authenticator.setUserCredentials(auth);                        items = read("(W(?B))", null);                        if (SUCCESS.equals(items[0])) {                            // should it be here?                            if (!myIsCredentialsReceived) {                                Object[] creds = read("[(S?S)]", null);                                if (creds != null && creds.length == 2                                        && creds[0] != null && creds[1] != null) {                                    SVNURL rootURL = SVNURL.parseURIEncoded((String) creds[1]);                                     repository.updateCredentials((String) creds[0], rootURL);                                    if (myRealm == null) {                                        myRealm = (String) creds[0];                                    }                                }                                myIsCredentialsReceived = true;                            }                            myAuthManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.PASSWORD, realm, null, auth);                            return;                        } else if (FAILURE.equals(items[0])) {                            failureReason = new String((byte[]) items[1]);                            break;                        } 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 SVNAuthenticationException(failureReason);    }