Skip to content

Commit

Permalink
Remove deprecated isSecured (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bert-R authored May 2, 2023
1 parent de70bd4 commit ae9ab2b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
12 changes: 0 additions & 12 deletions src/main/java/kafdrop/Kafdrop.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,9 @@ public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {

LOG.info("Initializing JAAS config");
final String env = environment.getProperty("kafka.env");
final boolean isSecured = environment.getProperty("kafka.isSecured", Boolean.class);
LOG.info("env: {} .isSecured kafka: {}", env, isSecured);
if (isSecured && Strings.isNullOrEmpty(env)) {
throw new IllegalArgumentException("Value of 'env' cannot be null if connecting to secured kafka.");
}

LOG.info("Env: {}", env);
String path;

if (isSecured) {
path = environment.getProperty("user.dir") + "/kaas_" + env.toLowerCase() + "_jaas.conf";
LOG.info("PATH: {}", path);
System.setProperty("java.security.auth.login.config", path);
}

if (environment.containsProperty(SM_CONFIG_DIR)) {
Stream.of("kafdrop", "global")
.map(name -> readProperties(environment, name))
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/kafdrop/config/KafkaConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public final class KafkaConfiguration {
private static final Logger LOG = LoggerFactory.getLogger(KafkaConfiguration.class);

private String brokerConnect;
private boolean isSecured = false;
private String saslMechanism;
private String securityProtocol;
private String truststoreFile;
Expand All @@ -31,12 +30,8 @@ public final class KafkaConfiguration {

public void applyCommon(Properties properties) {
properties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, brokerConnect);
if (isSecured) {
LOG.warn("The 'isSecured' property is deprecated; consult README.md on the preferred way to configure security");
properties.put(SaslConfigs.SASL_MECHANISM, saslMechanism);
}

if (isSecured || securityProtocol.equals("SSL")) {
if (securityProtocol.equals("SSL")) {
properties.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, securityProtocol);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ kafdrop.monitor:

kafka:
brokerConnect: localhost:9092
isSecured: false
saslMechanism: "PLAIN"
securityProtocol: "SASL_PLAINTEXT"
truststoreFile: "${KAFKA_TRUSTSTORE_FILE:kafka.truststore.jks}"
Expand Down

0 comments on commit ae9ab2b

Please sign in to comment.