use of org.apache.cxf.configuration.jsse.TLSClientParameters in project camel by apache.
the class ServiceNowClient method configureTls.
private static void configureTls(CamelContext camelContext, ServiceNowConfiguration configuration, WebClient client) throws Exception {
SSLContextParameters sslContextParams = configuration.getSslContextParameters();
if (sslContextParams != null) {
HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
TLSClientParameters tlsClientParams = conduit.getTlsClientParameters();
if (tlsClientParams == null) {
tlsClientParams = new TLSClientParameters();
}
SSLContext sslContext = sslContextParams.createSSLContext(camelContext);
tlsClientParams.setSSLSocketFactory(sslContext.getSocketFactory());
conduit.setTlsClientParameters(tlsClientParams);
}
}
use of org.apache.cxf.configuration.jsse.TLSClientParameters in project opennms by OpenNMS.
the class TsrmTicketerPlugin method getService.
private SHSIMPINCPortType getService() {
final SHSIMPINC service = new SHSIMPINC();
port = service.getSHSIMPINCSOAP12Port();
final Client cxfClient = ClientProxy.getClient(port);
try {
cxfClient.getRequestContext().put(Message.ENDPOINT_ADDRESS, getProperties().getProperty("tsrm.url"));
final HTTPConduit http = (HTTPConduit) cxfClient.getConduit();
String stictSSL = getProperties().getProperty("tsrm.ssl.strict");
if (!Boolean.parseBoolean(stictSSL)) {
LOG.debug("Disabling strict SSL checking.");
// Accept all certificates
final TrustManager[] simpleTrustManager = new TrustManager[] { new AnyServerX509TrustManager() };
final TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setTrustManagers(simpleTrustManager);
tlsParams.setDisableCNCheck(true);
http.setTlsClientParameters(tlsParams);
}
} catch (IOException e) {
LOG.error("Unable to load tsrm properties ", e);
}
// Log incoming and outgoing requests
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
loggingInInterceptor.setPrettyLogging(true);
cxfClient.getInInterceptors().add(loggingInInterceptor);
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
loggingOutInterceptor.setPrettyLogging(true);
cxfClient.getOutInterceptors().add(loggingOutInterceptor);
return port;
}
use of org.apache.cxf.configuration.jsse.TLSClientParameters in project OpenAM by OpenRock.
the class SoapSTSConsumer method handleSTSServerCertCNDNSMismatch.
/**
* This method must be called in case the CN in the Certificate presented by the container hosting the published sts
* instance does not match the DNS name of this server. This check should not be relied-upon in production, and is
* only present to facilitate testing.
* @param stsClient The stsClient which will make the sts invocations
*/
private void handleSTSServerCertCNDNSMismatch(STSClient stsClient) throws SoapSTSConsumerException {
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
return true;
}
});
/*
CXF client also needs to have disabled the CN check in server-presented cert for TLS cases, if cert CN
does not match DNS
*/
TLSClientParameters tlsClientParameters = new TLSClientParameters();
tlsClientParameters.setDisableCNCheck(true);
try {
((HTTPConduit) stsClient.getClient().getConduit()).setTlsClientParameters(tlsClientParameters);
} catch (BusException | EndpointException e) {
throw new SoapSTSConsumerException(e.getMessage(), e);
}
}
use of org.apache.cxf.configuration.jsse.TLSClientParameters in project camel by apache.
the class AbstractHostnameVerifierEndpointConfigurer method setupHttpConduit.
protected void setupHttpConduit(HTTPConduit httpConduit) {
TLSClientParameters tlsClientParameters = tryToGetTLSClientParametersFromConduit(httpConduit);
tlsClientParameters.setHostnameVerifier(hostnameVerifier);
httpConduit.setTlsClientParameters(tlsClientParameters);
}
use of org.apache.cxf.configuration.jsse.TLSClientParameters in project camel by apache.
the class AbstractSslEndpointConfigurer method setupHttpConduit.
protected void setupHttpConduit(HTTPConduit httpConduit) {
TLSClientParameters tlsClientParameters = tryToGetTLSClientParametersFromConduit(httpConduit);
tlsClientParameters.setSSLSocketFactory(tryToGetSSLSocketFactory());
httpConduit.setTlsClientParameters(tlsClientParameters);
}
Aggregations