3

I am using CXF 2.7.3 and want to disable CN checking in code with:

TLSClientParameters tlsParams = conduit.getTlsClientParameters();
if (tlsParams == null) {
    tlsParams = new TLSClientParameters();
}
tlsParams.setSecureSocketProtocol(sslAlgorithm);
tlsParams.setUseHttpsURLConnectionDefaultHostnameVerifier(false);
tlsParams.setDisableCNCheck(true);

It does not seem to work for me. I've tried all kinds of examples from the WEB with no luck. If I use cxf.xml it works with this:

<http-conf:conduit name="*.http-conduit"
    xmlns:sec="http://cxf.apache.org/configuration/security"
    xmlns="http://cxf.apache.org/transports/http/configuration">
    <http-conf:tlsClientParameters disableCNCheck="true" useHttpsURLConnectionDefaultHostnameVerifier="false" />
</http-conf:conduit>

I would rather not pull in Spring config just to get this one-liner to work. Any ideas? Thanks!

4

1 回答 1

2

我真的不确定它会解决你的问题(没有足够的信息,而且我没有足够的声誉来对你的帖子发表评论:-))但是因为我花了几天时间解决类似的问题,所以制作信息不会有什么坏处上市...

添加拦截器时我遇到了类似的问题。如果您 client.getEndpoint(); 在代码中的某个位置调用,管道将被重新初始化,参见

http://mail-archives.apache.org/mod_mbox/cxf-users/201305.mbox/%3COFB00B58DA.85E410E4-ONC1257B6D

解决方案是编写一个自定义拦截器来执行客户端/管道配置。

于 2014-07-31T08:57:28.987 回答