Java Code Examples for org.apache.kafka.common.security.auth.SecurityProtocol#SSL

The following examples show how to use org.apache.kafka.common.security.auth.SecurityProtocol#SSL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CCKafkaIntegrationTestHarness.java    From cruise-control with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * returns the list of broker configs for all brokers created by this test
 * (as determined by clusterSize()
 * @return list of broker configs, one config map per broker to be created
 */
protected List<Map<Object, Object>> buildBrokerConfigs() {
  List<Map<Object, Object>> configs = new ArrayList<>();
  for (int i = 0; i < clusterSize(); i++) {
    CCEmbeddedBrokerBuilder builder = new CCEmbeddedBrokerBuilder();
    builder.zkConnect(zookeeper());
    builder.nodeId(i);
    builder.enable(securityProtocol());
    if (securityProtocol() == SecurityProtocol.SSL) {
      if (trustStoreFile() != null) {
        builder.trustStore(trustStoreFile());
      }
    } else {
      if (trustStoreFile() != null) {
        throw new AssertionError("security protocol not set yet trust store file provided");
      }
    }
    Map<Object, Object> config = builder.buildConfig();
    config.putAll(overridingProps());
    configs.add(config);
  }
  return configs;
}
 
Example 2
Source File: CCKafkaClientsIntegrationTestHarness.java    From cruise-control with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected void setSecurityConfigs(Properties clientProps, String certAlias) {
  SecurityProtocol protocol = securityProtocol();
  if (protocol == SecurityProtocol.SSL) {
    File trustStoreFile = trustStoreFile();
    if (trustStoreFile == null) {
      throw new AssertionError("ssl set but no trust store provided");
    }
    clientProps.setProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, protocol.name);
    clientProps.setProperty(KafkaConfig.SslEndpointIdentificationAlgorithmProp(), "");
    try {
      clientProps.putAll(TestSslUtils.createSslConfig(true, true, Mode.CLIENT, trustStoreFile, certAlias));
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
}
 
Example 3
Source File: AbstractKafkaIntegrationTestHarness.java    From li-apache-kafka-clients with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * returns the list of broker configs for all brokers created by this test
 * (as determined by clusterSize()
 * @return list of broker configs, one config map per broker to be created
 */
protected List<Map<Object, Object>> buildBrokerConfigs() {
  List<Map<Object, Object>> configs = new ArrayList<>();
  for (int i = 0; i < clusterSize(); i++) {
    EmbeddedBrokerBuilder builder = new EmbeddedBrokerBuilder();
    builder.zkConnect(zookeeper());
    builder.nodeId(i);
    builder.enable(securityProtocol());
    if (securityProtocol() == SecurityProtocol.SSL) {
      if (trustStoreFile() != null) {
        builder.trustStore(trustStoreFile());
      }
    } else {
      if (trustStoreFile() != null) {
        throw new AssertionError("security protocol not set yet trust store file provided");
      }
    }
    Map<Object, Object> config = builder.buildConfig();
    config.putAll(overridingProps());
    configs.add(config);
  }
  return configs;
}
 
Example 4
Source File: AbstractKafkaClientsIntegrationTestHarness.java    From li-apache-kafka-clients with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected void setSecurityConfigs(Properties clientProps, String certAlias) {
  SecurityProtocol protocol = securityProtocol();
  if (protocol == SecurityProtocol.SSL) {
    File trustStoreFile = trustStoreFile();
    if (trustStoreFile == null) {
      throw new AssertionError("ssl set but no trust store provided");
    }
    clientProps.setProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, protocol.name);
    try {
      clientProps.putAll(TestSslUtils.createSslConfig(true, true, Mode.CLIENT, trustStoreFile, certAlias));
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
}
 
Example 5
Source File: SSLClusterTestHarness.java    From kcache with Apache License 2.0 4 votes vote down vote up
@Override
protected SecurityProtocol getSecurityProtocol() {
    return SecurityProtocol.SSL;
}
 
Example 6
Source File: CruiseControlMetricsReporterSslTest.java    From cruise-control with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public SecurityProtocol securityProtocol() {
  return SecurityProtocol.SSL;
}
 
Example 7
Source File: LiKafkaProducerSSLIntegrationTest.java    From li-apache-kafka-clients with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public SecurityProtocol securityProtocol() {
  return SecurityProtocol.SSL;
}
 
Example 8
Source File: LiKafkaConsumerSSLIntegrationTest.java    From li-apache-kafka-clients with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public SecurityProtocol securityProtocol() {
  return SecurityProtocol.SSL;
}