use of org.apache.camel.util.jsse.CipherSuitesParameters in project camel by apache.
the class KafkaConfiguration method applySslConfiguration.
/**
* Uses the standard camel {@link SSLContextParameters} object to fill the Kafka SSL properties
*
* @param props Kafka properties
* @param sslContextParameters SSL configuration
*/
private void applySslConfiguration(Properties props, SSLContextParameters sslContextParameters) {
if (sslContextParameters != null) {
addPropertyIfNotNull(props, SslConfigs.SSL_PROTOCOL_CONFIG, sslContextParameters.getSecureSocketProtocol());
addPropertyIfNotNull(props, SslConfigs.SSL_PROVIDER_CONFIG, sslContextParameters.getProvider());
CipherSuitesParameters cipherSuites = sslContextParameters.getCipherSuites();
if (cipherSuites != null) {
addCommaSeparatedList(props, SslConfigs.SSL_CIPHER_SUITES_CONFIG, cipherSuites.getCipherSuite());
}
SecureSocketProtocolsParameters secureSocketProtocols = sslContextParameters.getSecureSocketProtocols();
if (secureSocketProtocols != null) {
addCommaSeparatedList(props, SslConfigs.SSL_ENABLED_PROTOCOLS_CONFIG, secureSocketProtocols.getSecureSocketProtocol());
}
KeyManagersParameters keyManagers = sslContextParameters.getKeyManagers();
if (keyManagers != null) {
addPropertyIfNotNull(props, SslConfigs.SSL_KEYMANAGER_ALGORITHM_CONFIG, keyManagers.getAlgorithm());
addPropertyIfNotNull(props, SslConfigs.SSL_KEY_PASSWORD_CONFIG, keyManagers.getKeyPassword());
KeyStoreParameters keyStore = keyManagers.getKeyStore();
if (keyStore != null) {
addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_TYPE_CONFIG, keyStore.getType());
addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, keyStore.getResource());
addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, keyStore.getPassword());
}
}
TrustManagersParameters trustManagers = sslContextParameters.getTrustManagers();
if (trustManagers != null) {
addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTMANAGER_ALGORITHM_CONFIG, trustManagers.getAlgorithm());
KeyStoreParameters keyStore = trustManagers.getKeyStore();
if (keyStore != null) {
addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG, keyStore.getType());
addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, keyStore.getResource());
addPropertyIfNotNull(props, SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, keyStore.getPassword());
}
}
}
}
use of org.apache.camel.util.jsse.CipherSuitesParameters in project camel by apache.
the class AbstractBaseSSLContextParametersFactoryBean method createInstanceInternal.
private T createInstanceInternal() throws Exception {
T newInstance = createInstance();
newInstance.setCamelContext(getCamelContext());
if (cipherSuites != null) {
CipherSuitesParameters cipherSuitesInstance = new CipherSuitesParameters();
cipherSuitesInstance.setCipherSuite(cipherSuites.getCipherSuite());
newInstance.setCipherSuites(cipherSuitesInstance);
}
if (cipherSuitesFilter != null) {
newInstance.setCipherSuitesFilter(createFilterParameters(cipherSuitesFilter));
}
if (secureSocketProtocols != null) {
SecureSocketProtocolsParameters secureSocketProtocolsInstance = new SecureSocketProtocolsParameters();
secureSocketProtocolsInstance.setSecureSocketProtocol(secureSocketProtocols.getSecureSocketProtocol());
newInstance.setSecureSocketProtocols(secureSocketProtocolsInstance);
}
if (secureSocketProtocolsFilter != null) {
newInstance.setSecureSocketProtocolsFilter(createFilterParameters(secureSocketProtocolsFilter));
}
if (sessionTimeout != null) {
newInstance.setSessionTimeout(sessionTimeout);
}
return newInstance;
}
Aggregations