NTLM Authentication fails when behind Proxy server
Posted
by Jan Petersen
on Stack Overflow
See other posts from Stack Overflow
or by Jan Petersen
Published on 2010-06-15T17:41:32Z
Indexed on
2010/06/17
22:13 UTC
Read the original article
Hit count: 362
Hi All,
I've seen a number of post about consuming Web Services from behind a proxy server, but none that seams to address this problem.
I'm building a desktop application, using Java, JAX-WS in NetBeans. I have a working prototype, that can query the server for authentication mode, successfully authenticate and retrieve a list of web site.
However, if I run the same app from a network that is behind a proxy server (the proxy does not require authentication), then I'm running into trouble.
I have sniffed the traffic, and noticed the following:
Behind Proxy
# Result Protocol Host URL
1 200 HTTP host.domain.com /_vti_bin/Authentication.asmx
2 401 HTTP host.domain.com /_vti_bin/Webs.asmx
3 401 HTTP host.domain.com /_vti_bin/Webs.asmx
4 401 HTTP host.domain.com /_vti_bin/Webs.asmx
5 401 HTTP host.domain.com /_vti_bin/Webs.asmx
Without Proxy
# Result Protocol Host URL
1 200 HTTP host.domain.com /_vti_bin/Authentication.asmx
2 401 HTTP host.domain.com /_vti_bin/Webs.asmx
3 401 HTTP host.domain.com /_vti_bin/Webs.asmx
4 401 HTTP host.domain.com /_vti_bin/Webs.asmx
5 401 HTTP host.domain.com /_vti_bin/Webs.asmx
6 200 HTTP host.domain.com /_vti_bin/Webs.asmx
When running the code from a network without a proxy server, I successfully Authentication with the server, but when I'm behind the proxy server, the traffic is cut-off at the 5th message, and thus don't succeed.
I know from the Java docs that On Microsoft Windows platforms, NTLM authentication attempts to acquire the user credentials from the system without prompting the user's authenticator object. If these credentials are not accepted by the server then the user's authenticator will be called. Given that my Authentication code is called only ones, and only as the 5th attempt, it appears as if the connection is dropped when behind the proxy server before my Authentication object is used. Is there any way I can control the behavior of Authentication module, to not have it use the system credentials?
I have put the source text java class files of a demo app up, showing the issue at the following urls (it's a bit to long even in the short demo form to post here).
link text
Br Jan
© Stack Overflow or respective owner