【问题标题】:How do I call a NTLM secured webservice using Camel-cxf?如何使用 Camel-cxf 调用 NTLM 安全网络服务?
【发布时间】:2014-10-28 15:21:14
【问题描述】:

在我的 Camel (2.13) 流程中,我想使用 Camel-CXF 调用 Web 服务。 使用 NTLM 保护 Web 服务。我确实发现 CXF 本身支持 NTLM,但我在 Camel-CXF 上找不到任何东西。当然,我确实尝试了参数用户名和密码,但这不起作用。 Ik 看起来像 Camel-CXF 不支持它。 关于如何解决这个问题的任何想法?

我使用的是 java6,所以我认为不需要 jcif。

罗德

【问题讨论】:

  • 您确定 Web 服务使用的是 NTLM 而不是 NTLMv2? AFAIK,CFX 仅支持旧版本和过时版本的 NTLM,由于重大安全问题,不应再使用。
  • 我认为您需要使用 jaxws 方式并使用 jcifs 库将身份验证添加到您的消息中,然后传播消息。如果您在 Linux 机器中部署或添加自定义用户名密码,请参考以下链接 jcifs.samba.org
  • 你能告诉我们camel-cxf端点的配置吗?

标签: java cxf apache-camel ntlm


【解决方案1】:
<cxf:cxfEndpoint id="sharepointQueryEndpoint"
                     address="http://yourhostwithpathtowsdl/_vti_bin/search.asmx"
                     serviceClass="com.somewhere.special.generated.QueryServiceSoap" 
                     endpointName="ssp:SecureConnection"
                     xmlns:ssp="http://microsoft.com/webservices/OfficeServer/QueryService"
            >

        <cxf:properties>
            <entry key="dataFormat" value="POJO"/>
            <entry key="loggingFeatureEnabled" value="true" />
        </cxf:properties>
        <cxf:inInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
        </cxf:inInterceptors>

        <cxf:outInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        </cxf:outInterceptors>
    </cxf:cxfEndpoint>

    <http:conduit name="{http://microsoft.com/webservices/OfficeServer/QueryService}SecureConnection.http-conduit">
        <http:client
                AllowChunking="false"
                MaxRetransmits="11"
                Connection="Keep-Alive"
                ReceiveTimeout="60000"
                CacheControl="No-Cache"
                />

        <http:authorization>
            <sec:UserName>Domain\Username</sec:UserName>
            <sec:Password>Password</sec:Password>
            <sec:Authorization>NTLM</sec:Authorization>
        </http:authorization>

    </http:conduit>

cxfEndpoint配置中的serviceClass属性指向wsdl2java生成的接口。enter code here 注意:当从基于 Windows 的机器上运行此配置时,它不起作用。在握手期间,它将用当前登录用户的凭据替换 http-conduit 中配置的用户名/密码。 更多信息请见Can Java's 'single sign-on' (use credentials from 'Credential Manager') on Windows be disabled?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多