ISVNAuthenticationManager authManager = myRepository.getAuthenticationManager();
if (authManager != null && authManager.isAuthenticationForced() && mechs.contains("ANONYMOUS") && mechs.contains("CRAM-MD5")) {
mechs.remove("ANONYMOUS");
}
SVNURL location = myRepository.getLocation();
SVNPasswordAuthentication auth = null;
if (repository.getExternalUserName() != null && mechs.contains("EXTERNAL")) {
write("(w(s))", new Object[] { "EXTERNAL", repository.getExternalUserName() });
failureReason = readAuthResponse();
} else if (mechs.contains("ANONYMOUS")) {
write("(w())", new Object[] { "ANONYMOUS" });
failureReason = readAuthResponse();
} else if (mechs.contains("CRAM-MD5")) {
while (true) {
CramMD5 authenticator = new CramMD5();
String realm = getRealm();
if (location != null) {
realm = "<" + location.getProtocol() + "://"
+ location.getHost() + ":"
+ location.getPort() + "> " + realm;
}
if (auth == null && authManager != null) {
auth = (SVNPasswordAuthentication) authManager.getFirstAuthentication(ISVNAuthenticationManager.PASSWORD, realm, location);
} else if (authManager != null) {
authManager.acknowledgeAuthentication(false, ISVNAuthenticationManager.PASSWORD, realm, failureReason, auth);
auth = (SVNPasswordAuthentication) authManager.getNextAuthentication(ISVNAuthenticationManager.PASSWORD, realm, location);
}
if (auth == null || auth.getUserName() == null || auth.getPassword() == null) {
failureReason = SVNErrorMessage.create(SVNErrorCode.RA_NOT_AUTHORIZED, "Can''t get password. Authentication is required for ''{0}''", realm);
break;
}
write("(w())", new Object[] { "CRAM-MD5" });
while (true) {