String mech = mechsArray[i];
try {
if ("ANONYMOUS".equals(mech) || "EXTERNAL".equals(mech)) {
props.put(Sasl.POLICY_NOANONYMOUS, "false");
}
SaslClientFactory clientFactory = getSaslClientFactory(mech, props);
if (clientFactory == null) {
continue;
}
SVNAuthentication auth = null;
if ("ANONYMOUS".equals(mech)) {
auth = new SVNPasswordAuthentication("", "", false);
} else if ("EXTERNAL".equals(mech)) {
String name = repos.getExternalUserName();
if (name == null) {
name = "";
}
auth = new SVNPasswordAuthentication(name, "", false);
} else {
if (myAuthenticationManager == null) {
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_NOT_AUTHORIZED, "Authentication required for ''{0}''", realm),
SVNLogType.NETWORK);
}
String realmName = getFullRealmName(location, realm);
if (myAuthentication != null) {
myAuthentication = myAuthenticationManager.getNextAuthentication(ISVNAuthenticationManager.PASSWORD, realmName, location);
} else {
myAuthentication = myAuthenticationManager.getFirstAuthentication(ISVNAuthenticationManager.PASSWORD, realmName, location);
}
if (myAuthentication == null) {
if (getLastError() != null) {
SVNErrorManager.error(getLastError(), SVNLogType.NETWORK);
}
SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_NOT_AUTHORIZED, "Authentication required for ''{0}''", realm),
SVNLogType.NETWORK);
}
auth = myAuthentication;
}
if ("ANONYMOUS".equals(mech)) {
mech = "PLAIN";
}
client = clientFactory.createSaslClient(new String[] {mech}, null, "svn", location.getHost(), props, new SVNCallbackHandler(realm, auth));
if (client != null) {
break;
}
myAuthentication = null;
} catch (SaslException e) {