use of org.apache.camel.util.jsse.KeyManagersParameters in project camel by apache.
the class SslContextParametersCometdProducerConsumerTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("jsse/localhost.ks");
ksp.setPassword("changeit");
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword("changeit");
kmp.setKeyStore(ksp);
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
sslContextParameters.setTrustManagers(tmp);
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslContextParameters(sslContextParameters);
from("direct:input").to(uri);
from(uri).to("mock:test");
}
};
}
use of org.apache.camel.util.jsse.KeyManagersParameters in project camel by apache.
the class SslContextParametersInUriCometdProducerConsumerTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("jsse/localhost.ks");
ksp.setPassword("changeit");
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword("changeit");
kmp.setKeyStore(ksp);
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
sslContextParameters.setTrustManagers(tmp);
JndiRegistry registry = super.createRegistry();
registry.bind("sslContextParameters", sslContextParameters);
return registry;
}
use of org.apache.camel.util.jsse.KeyManagersParameters in project camel by apache.
the class AbstractKeyManagersParametersFactoryBean method createInstance.
protected KeyManagersParameters createInstance() throws Exception {
KeyManagersParameters newInstance = new KeyManagersParameters();
newInstance.setAlgorithm(algorithm);
newInstance.setKeyPassword(keyPassword);
if (getKeyStore() != null) {
getKeyStore().setCamelContext(getCamelContext());
newInstance.setKeyStore(getKeyStore().getObject());
}
newInstance.setProvider(provider);
newInstance.setCamelContext(getCamelContext());
return newInstance;
}
use of org.apache.camel.util.jsse.KeyManagersParameters in project camel by apache.
the class MailTestHelper method createSslContextParameters.
public static SSLContextParameters createSslContextParameters() {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(MailTestHelper.class.getClassLoader().getResource("jsse/localhost.ks").toString());
ksp.setPassword(KEY_STORE_PASSWORD);
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(KEY_STORE_PASSWORD);
kmp.setKeyStore(ksp);
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
sslContextParameters.setTrustManagers(tmp);
return sslContextParameters;
}
use of org.apache.camel.util.jsse.KeyManagersParameters in project camel by apache.
the class BaseMina2Test method addSslContextParametersToRegistry.
protected void addSslContextParametersToRegistry(JndiRegistry registry) {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
ksp.setPassword(KEY_STORE_PASSWORD);
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword(KEY_STORE_PASSWORD);
kmp.setKeyStore(ksp);
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
// NOTE: Needed since the client uses a loose trust configuration when no ssl context
// is provided. We turn on WANT client-auth to prefer using authentication
SSLContextServerParameters scsp = new SSLContextServerParameters();
scsp.setClientAuthentication(ClientAuthentication.WANT.name());
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
sslContextParameters.setTrustManagers(tmp);
sslContextParameters.setServerParameters(scsp);
registry.bind("sslContextParameters", sslContextParameters);
}
Aggregations