모든 환경에서 작동하지만 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);
}
}