Java 6 HTTPURLConnection and Project Server NTLM Authentication from RHEL5.5

我的未来我决定 提交于 2019-12-11 11:09:44

问题


Currently at a loss for authenticating with a Microsoft Project Server 2007 instance running on IIS with Integrated Windows Authentication enabled from a Java 1.6(u19) client running on linux, RHEL 5.5.

Note: The client works on my Windows workstation.

I initially was trying to implement a JAX-WS call and found that I could not retrieve the WSDL due to authentication errors, specifically a 401.2, followed by a 500. So I simplified it to a Java class that:

  1. Creates an Authenticator and sets it as the default with a user name/password in AD that has permissions to the project server site
  2. Create a java.net.URL object
  3. Create a java.net.HttpURLConnection and invoke getInputStream
  4. It is at this point where a failure occurs.

With HttpURLConnection debugging turned on I can see:

  1. the initial authentication failure (401.2) returned from the server with "negotiate" and "NTLM" included in the response.
  2. the client creating an NTLM token and sending it back to the server
  3. the server returning with a 500 status code

On the Windows server in the logs, I can see that there is no user name included in the log file only for my requestion and only a "-" which I believe means "anonymous".

My thought is that Project Server isn't liking the NTLM token that is being passed and choking. Based on the many postings on this, NTLM (v1 & v2) are suppose to be supported within Java 1.6.

Any help would be greatly appreciated...

UPDATE 6/20/12: narrowed the issue down to a local security policy setting for Network security: Minimum session security for NTLM SSP based (including RPC) servers. The setting that causes the Java client to fail is Require NTLMv2 security. The goes against what is claimed for NTLM support with the 1.6 JDK..

Some references:

  • Java HTTP Authentication
  • Blog showing Java Authenticator Impl

回答1:


A while back when i had this problem, i ended up using a scheme created by somebody else.

http://devsac.blogspot.com/2010/10/supoprt-for-ntlmv2-with-apache.html

Worked for me when i had to get image files from and iis server with ntlm. Snippet using the code above..

AuthPolicy.registerAuthScheme(AuthPolicy.NTLM, org.xyz.JCIFS_NTLMScheme.class);
            HttpClient client = new HttpClient();
            client.getState().setCredentials(AuthScope.ANY, new NTCredentials(userName, password, "", strDomain));
            GetMethod get = new GetMethod(strImageFile);
            get.setDoAuthentication(true);
            client.executeMethod(get);


来源:https://stackoverflow.com/questions/11087721/java-6-httpurlconnection-and-project-server-ntlm-authentication-from-rhel5-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!