Always use NTCredentials for proxy authorization

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@868 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-12-01 16:22:05 +00:00
parent d05ae65cdf
commit 1b67a58656
1 changed files with 2 additions and 11 deletions

View File

@ -40,8 +40,6 @@ import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -150,20 +148,13 @@ public final class DavGatewayHttpClientFacade {
// detect ntlm authentication (windows domain name in user name) // detect ntlm authentication (windows domain name in user name)
int backslashindex = proxyUser.indexOf('\\'); int backslashindex = proxyUser.indexOf('\\');
if (backslashindex > 0) { if (backslashindex > 0) {
// get local host name for NTLM authentication
String host;
try {
host = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
host = "localhost";
}
httpClient.getState().setProxyCredentials(authScope, httpClient.getState().setProxyCredentials(authScope,
new NTCredentials(proxyUser.substring(backslashindex + 1), new NTCredentials(proxyUser.substring(backslashindex + 1),
proxyPassword, host, proxyPassword, "",
proxyUser.substring(0, backslashindex))); proxyUser.substring(0, backslashindex)));
} else { } else {
httpClient.getState().setProxyCredentials(authScope, httpClient.getState().setProxyCredentials(authScope,
new UsernamePasswordCredentials(proxyUser, proxyPassword)); new NTCredentials(proxyUser, proxyPassword, "", ""));
} }
} }
} }