use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.
the class JettyHttpComponent method createConnector.
protected Connector createConnector(Server server, JettyHttpEndpoint endpoint) {
// now we just use the SelectChannelConnector as the default connector
SslContextFactory sslcf = null;
// Note that this was set on the endpoint when it was constructed. It was
// either explicitly set at the component or on the endpoint, but either way,
// the value is already set. We therefore do not need to look at the component
// level SSLContextParameters again in this method.
SSLContextParameters endpointSslContextParameters = endpoint.getSslContextParameters();
if (endpointSslContextParameters != null) {
try {
sslcf = createSslContextFactory(endpointSslContextParameters);
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
} else if ("https".equals(endpoint.getProtocol())) {
sslcf = new SslContextFactory();
String keystoreProperty = System.getProperty(JETTY_SSL_KEYSTORE);
if (keystoreProperty != null) {
sslcf.setKeyStorePath(keystoreProperty);
} else if (sslKeystore != null) {
sslcf.setKeyStorePath(sslKeystore);
}
String keystorePassword = System.getProperty(JETTY_SSL_KEYPASSWORD);
if (keystorePassword != null) {
sslcf.setKeyManagerPassword(keystorePassword);
} else if (sslKeyPassword != null) {
sslcf.setKeyManagerPassword(sslKeyPassword);
}
String password = System.getProperty(JETTY_SSL_PASSWORD);
if (password != null) {
sslcf.setKeyStorePassword(password);
} else if (sslPassword != null) {
sslcf.setKeyStorePassword(sslPassword);
}
}
return createConnectorJettyInternal(server, endpoint, sslcf);
}
use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.
the class ExplicitHttpsSslContextParametersRouteTest method createSslSocketConnector.
// START SNIPPET: e2
private Connector createSslSocketConnector(CamelContext context, int port) throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
ksp.setPassword(pwd);
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
//return sslSocketConnector;
return null;
}
use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.
the class HttpsRouteSslContextParametersInComponentTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
JettyHttpComponent jetty = getContext().getComponent("jetty", JettyHttpComponent.class);
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
ksp.setPassword(pwd);
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
jetty.setSslContextParameters(sslContextParameters);
// NOTE: These are here to check that they are properly ignored.
setSSLProps(jetty, "", "asdfasdfasdfdasfs", "sadfasdfasdfas");
from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("<b>Hello World</b>");
}
};
from("jetty:https://localhost:" + port1 + "/hello").process(proc);
from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.
the class HttpsRouteSslContextParametersInUriTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
ksp.setPassword(pwd);
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(pwd);
kmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
JndiRegistry registry = super.createRegistry();
registry.bind("sslContextParameters", sslContextParameters);
return registry;
}
use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.
the class FileToFtpsExplicitSSLWithoutClientAuthAndSSLContextParametersTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("server.jks");
ksp.setPassword("password");
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setSecureSocketProtocol("SSL");
sslContextParameters.setTrustManagers(tmp);
JndiRegistry registry = super.createRegistry();
registry.bind("sslContextParameters", sslContextParameters);
return registry;
}
Aggregations