2017-11-09 3 views
0

すべての環境で動作するが、Weblogic Server内からはMS Sharepointに対するJavaのNTLM認証があります。オーセンティケータ#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

使用のApacheのHTTPClientのパッチを当てたバージョン:https://issues.apache.org/jira/browse/HTTPCLIENT-1881

短い答え2

-DUseSunHttpHandler=trueを設定しますWebLogを起動するとicサーバー。いくつかの参考文献: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.htmlImpact/Risk on enable -DuseSunHttpHandler on Weblogic10.3.0 & https://stackoverflow.com/a/27931816/131929(ともに少し古い)。 (リモート)デバッグ中のある時点で

私は私がスタックにjava.net.http.*オブジェクトを持っていますが、weblogic.net.http.*なかったことに気づきました。 WTF私は思った...そしてはい、WLSは標準のSunネットワーキングスタックをデフォルトでに置き換えます。

関連する問題