2017-11-09 5 views
0

모든 환경에서 작동하지만 Weblogic Server 내에서 작동하는 MS Sharepoint에 대해 Java로부터 NTLM 인증을 받았습니다.Authenticator # getPasswordAuthentication은 Weblogic에서 ntlm 대신 basic을 반환합니다.

WLS에서 Authenticator#getPasswordAuthentication은 'ntlm'대신 'basic'을 반환합니다. 그 행동의 이유는 무엇일 수 있습니까? 독립 실행 형 또는 Tomcat (동일한 JVM 사용)에서 실행되는 경우 동일한 코드가 제대로 작동합니다.

관련 코드는 다음과 같이

NtlmAuthenticator authenticator = new NtlmAuthenticator(configParameters.getNtlmUsername(), 
    configParameters.getNtlmPassword(), configParameters.getNtlmDomain()); 

log.info("JVM running with security manager enabled: {}", System.getSecurityManager() != null); 
// requires NetPermission 'setDefaultAuthenticator' if security manager enabled 
Authenticator.setDefault(authenticator); 


public class NtlmAuthenticator extends Authenticator { 

    private char[] password; 
    private String userAuthentication; 

    public NtlmAuthenticator(String username, String password, String domain) { 
    userAuthentication = username; 
    if (StringUtils.isNotBlank(domain)) { 
     // According to 
     // https://msdn.microsoft.com/en-us/library/windows/desktop/aa380525(v=vs.85).aspx 
     userAuthentication = domain + "\\" + username; 
    } 
    this.password = password.toCharArray(); 
    } 

    @Override 
    public PasswordAuthentication getPasswordAuthentication() { 
    log.debug("Scheme: '{}'", getRequestingScheme()); 
    return new PasswordAuthentication(userAuthentication, password); 
    } 
} 

답변

0

짧은 답변 1

를 사용하여 아파치 HttpClient를의 패치 버전 : https://issues.apache.org/jira/browse/HTTPCLIENT-1881

짧은 답변이

-DUseSunHttpHandler=true 설정을 WebLog를 시작할 때 ic Server. 일부 참조 : https://docs.oracle.com/en/cloud/paas/javase-cloud/csjsu/you-should-now-set-sun-http-handlers-property-value-true-when-making-outbound-http-s-calls.html, Impact/Risk on enable -DuseSunHttpHandler on Weblogic10.3.0 & https://stackoverflow.com/a/27931816/131929 (모두 약간 더 오래된). (원격) 디버깅하는 동안 어떤 점 I에서

내가 java.net.http.* 스택에 객체하지만 weblogic .net.http.*을 가지고 있지 않은 것으로 나타났습니다. WTF 나는 생각했다. WLS는 표준 썬 네트워킹 스택 을 기본적으로으로 바꾼다.

관련 문제