代理服务器的 Axis2 NTLM 身份验证

发布于 2024-10-12 00:15:49 字数 1034 浏览 1 评论 0原文

在需要 NTLM 身份验证的 http 代理服务器上对 Axis2(版本 1.4)客户端进行身份验证的正确方法是什么?

我使用以下代码来提供代理凭据,但身份验证仍然失败(请参阅最后的详细信息):

Options options = serviceStub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.CHUNKED, false);
options.setProperty(HTTPConstants.PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);

ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setProxyName("123.123.123.123");
proxyProperties.setProxyPort(8080);
proxyProperties.setUserName("[email protected]");
proxyProperties.setPassWord("1234");
proxyProperties.setDomain("");
options.setProperty(HTTPConstants.PROXY, proxyProperties);

使用完全相同的凭据,网络浏览器(例如 Firefox)能够通过代理,所以我假设,代理服务器设置正确。然而,对于 Axis2 客户端,身份验证失败(HTTP 状态代码为“407 需要代理身份验证”)。

更多详情: 我使用网络嗅探器比较了 Firefox 和我的客户端的网络流量。主要区别似乎是,axis2 客户端正在为 ntlm 质询发送空响应。

有人使用 NTLM 在 http 代理服务器上成功进行了身份验证吗?你能给我一个代码示例吗?

What is the correct way to authenticate an Axis2 (Version 1.4) Client at a http proxy server that requires NTLM authentication?

I'm using the following code to provide the proxy credentials, but the authentication still fails (see details at the end):

Options options = serviceStub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.CHUNKED, false);
options.setProperty(HTTPConstants.PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);

ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setProxyName("123.123.123.123");
proxyProperties.setProxyPort(8080);
proxyProperties.setUserName("[email protected]");
proxyProperties.setPassWord("1234");
proxyProperties.setDomain("");
options.setProperty(HTTPConstants.PROXY, proxyProperties);

With exactly the same credentials, a webbrowser, such as Firefox is able to get trough the proxy, so I assume, the proxy server is correctly set up. With the Axis2 client however, the authentication failes (HTTP status code is "407 Proxy Authentication Required").

Further details:
I compared the network traffic from firefox and my client using a network sniffer. The main difference seems to be, that the axis2 client is sending an empty response for the ntlm challenge.

Has anyone successfully authenticated at a http proxy server using NTLM? Can you give me a code example?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏尔 2024-10-19 00:15:50

我无法解决这个问题(使用 Axis 2)。不想把这归咎于 Axis2 的强硬。也许我做错了什么,但即使经过几个小时的尝试、调试和阅读文档也无法弄清楚。

但当我没有选择时,我不得不寻找其他选择。这个其他选项以替代 SOAP 框架的形式出现。存在相当多的 Java SOAP 框架。我了解 Axis2、CXF 和 JAX-WS。

我现在使用 JAX-WS,而不是 Axis2。更换框架是一个直接的过程。替换的一个很好的副作用是,我摆脱了 Axis2 附带的巨大依赖树。 JAX-WS 是 J6EE 的一部分,因此不需要导入其他依赖项。

此时我只在客户端进行了替换。服务器仍然使用Axis2。到目前为止,这种组合效果很好,但我仍然计划最终在服务器端替换 Axis2。

总而言之:如果您不使用Axis2的特殊功能,我认为JAX-WS是更好的选择。

I was unable to resolve this problem (with Axis 2). Don't want to blame this on Axis2 tough. Maybe I did something wrong but couldn't figure it out, even after many hours of trying, debugging and reading the docs.

But when I was running out of options I had to look out for other options. This other option came in the form of alternative SOAP-Frameworks. There exist quite a few SOAP frameworks for java. I know about Axis2, CXF and JAX-WS.

Instead of Axis2 I use now JAX-WS. Replacing the frameworks was a straight forward process. A nice side effect of the replacement was, that I got rid of the huge dependency tree, Axis2 comes with. JAX-WS is part of J6EE so there wasn't any need to import other dependencies.

At this time I did the replacement only on the client side. The server still uses Axis2. This combination works great so far, but I still plan to eventually replace Axis2 on the server side too.

All in all: If you do not use a special feature of Axis2, I think, JAX-WS is the better option.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文