使用Axis 1.4客户端进行NTLM代理身份验证

时间:2019-08-08 15:05:16

标签: java soap proxy axis ntlm

我需要向使用 Axis 1.4 访问Web服务的旧版Java客户端添加以下功能:

客户端应通过接受 NTLM身份验证代理路由所有http请求(Axis Web服务请求)。

我已按如下方式配置代理:

System.setProperty("http.proxyUser", configuration.getUsername());
System.setProperty("http.proxyPassword", configuration.getPassword());
System.setProperty("https.proxyUser", configuration.getUsername());
System.setProperty("https.proxyPassword", configuration.getPassword());

这对于基本身份验证来说工作正常,但是在我的具有NTLM身份验证的代理上失败。

是否可以将Axis 1.4配置为通过NTLM进行身份验证?,如果可以,我将如何处理?经过数小时的研究,我对如何解决这个问题一无所知。

我试图像这样设置自定义身份验证器,但遗憾的是没有效果。

Authenticator.setDefault(
  new NtlmAuthenticator(configuration.getUsername(), configuration.getPassword())
);

NtlmAuthenticator的外观如下:

class NtlmAuthenticator extends Authenticator {

    private final String username;
    private final char[] password;

    public NtlmAuthenticator(final String username, final String password) {
        super();
        this.username = username;
        this.password = password.toCharArray();
    }

    public PasswordAuthentication getPasswordAuthentication() {
        return (new PasswordAuthentication(username, password));
    }
}

如果能为我指明正确的方向,我将不胜感激!

0 个答案:

没有答案