Description
org.apache.cxf.jaxrs.client.spec.ClientImpl only copies the TLSClientParameters configured by ClientBuilder.newBuilder().hostnameVerifier(HostnameVerifier) if an SSLSocketFactory or TrustManagers are configured.
This makes it impossible to use a custom HostnameVerifier without also declaring a custom SSLSocketFactory or TrustManagers.
Snip of incorrect code from rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java, line 282
// TLS TLSClientParameters tlsParams = secConfig.getTlsClientParams(); if (tlsParams.getSSLSocketFactory() != null || tlsParams.getTrustManagers() != null) { clientCfg.getHttpConduit().setTlsClientParameters(tlsParams); }
Proposed replacement:
// TLS TLSClientParameters tlsParams = secConfig.getTlsClientParams(); if (tlsParams.getSSLSocketFactory() != null || tlsParams.getTrustManagers() != null || tlsParams.getHostnameVerifier() != null) { clientCfg.getHttpConduit().setTlsClientParameters(tlsParams); }