SSL安全的Web服务客户端使用CXF Spring配置



我需要使用CXF Spring配置创建SSL安全的Web服务客户端我想知道如何告诉CXF使用来自密钥库的客户端证书?我需要在WEB-INF下创建cxf.xml文件吗?如果有,我应该包括什么?

我只需要客户端,因为服务器端是我连接的第三方提供商。

我的pom

中确实有以下依赖项

 <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>

谢谢!

我有同样的问题,没有找到一个春季的方式来配置它。所以我这样做。

http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-ConfiguringSSLSupport

<http:conduit name="{http://apache.org/hello_world}HelloWorld.http-conduit">
<http:tlsClientParameters>
  <sec:keyManagers keyPassword="password">
    <sec:keyStore type="JKS" password="password"
                  file="my/file/dir/Morpit.jks"/>
  </sec:keyManagers>
  <sec:trustManagers>
    <sec:keyStore type="JKS" password="password"
                  file="my/file/dir/Truststore.jks"/>
  </sec:trustManagers>
  <sec:cipherSuitesFilter>
    <!-- these filters ensure that a ciphersuite with export-suitable or null encryption is used, but exclude anonymous Diffie-Hellman key change as
         this is vulnerable to man-in-the-middle attacks -->
    <sec:include>.*_EXPORT_.*</sec:include>
    <sec:include>.*_EXPORT1024_.*</sec:include>
    <sec:include>.*_WITH_DES_.*</sec:include>
    <sec:include>.*_WITH_AES_.*</sec:include>
    <sec:include>.*_WITH_NULL_.*</sec:include>
    <sec:exclude>.*_DH_anon_.*</sec:exclude>
  </sec:cipherSuitesFilter>
</http:tlsClientParameters>
<http:authorization>
  <sec:UserName>Betty</sec:UserName>
  <sec:Password>password</sec:Password>
</http:authorization>
<http:client AutoRedirect="true" Connection="Keep-Alive"/>
</http:conduit>

最新更新