여기 NTLM 및 Java와 관련된 StackOverflow에 대한 모든 토론을 살펴본 결과 답변을 찾지 못하는 것 같습니다. 나는 좀 더 구체적으로하려고 노력할 것이다.Apache Axis2 1.5.1 및 NTLM 인증
이ServiceStub getService() {
try {
ServiceStub stub = new ServiceStub(
"http://myserver/some/path/to/webservices.asmx"); // this service is hosted on IIS
List<String> ntlmPreferences = new ArrayList<String>(1);
ntlmPreferences.add(HttpTransportProperties.Authenticator.NTLM);
HttpTransportProperties.Authenticator ntlmAuthenticator = new HttpTransportProperties.Authenticator();
ntlmAuthenticator.setAuthSchemes(ntlmPreferences);
ntlmAuthenticator.setUsername("me");
ntlmAuthenticator.setHost("localhost");
ntlmAuthenticator.setDomain("mydomain");
Options options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.AUTHENTICATE, ntlmAuthenticator);
options.setProperty(HTTPConstants.CHUNKED, "false");
return stub;
} catch (AxisFault e) {
e.printStackTrace();
}
return null;
}
이 유효한 SerivceStub 객체를 반환 :
여기 (I 희망)가 NTLM 인증을 위해 구성되어있는 클라이언트 스텁을 반환하는 코드입니다. 스텁에서 전화를 걸려고 할 때 내 로그에 다음 내용이 표시됩니다.Jun 9, 2010 12:12:22 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: NTLM authentication scheme selected
Jun 9, 2010 12:12:22 PM org.apache.commons.httpclient.HttpMethodDirector authenticate
SEVERE: Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials
누구든지이 문제를 해결할 수 있습니까?
나는이 대답을 생각합니다. 축을 사용하지 마십시오. Axis는 NTLM을 지원하지만 자격 증명이 필요하다고 말합니다. 이는 주변 인증 정보가 필요한 SSO 환경에서는 쓸모가 없습니다. Java 6에는 기본 NTLM이 있기 때문에 Axis는 Java 6에서 쉽게 수정해야하지만 상관하지 않습니다. 나는 CXF를 시도 할 것이다 - 그것이 효과가있을 것이다 ... 또는 적어도 나는 희망한다. – andyczerwonka
NTLM이 필요한 경우 CXF가 올바르게 작동합니다. – andyczerwonka
NTLM을 처리 할 코드가 CXF에 없습니다. JDK에서 제공하는 NTLM 지원에 따라 다릅니다. CXF에서 NTLM을 작동하게 만들 때 httpClientPolicy.setAllowChunking (false);을 설정해야했습니다. 해당 속성 집합이 없으면 작동하지 않았습니다. –