Skip to content

Commit

Permalink
KREST-865 Remove string usages of the deprecated SimpleAclAuthorizer (c…
Browse files Browse the repository at this point in the history
…onfluentinc#835)

There are various test files and utilities that use the deprecated
class by having it set as a string property that gets loaded at runtime.
  • Loading branch information
dimitarndimitrov authored Apr 10, 2021
1 parent 6968325 commit 338ad58
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class SecureTestUtils {
public static void setProduceAcls(String zkConnect, String topic, String user) {
List<String> aclArgs = new ArrayList<>();

Collections.addAll(aclArgs, ("--authorizer kafka.security.auth.SimpleAclAuthorizer "
Collections.addAll(aclArgs, ("--authorizer kafka.security.authorizer.AclAuthorizer "
+ "--authorizer-properties zookeeper.connect=" + zkConnect
+ " --topic " + topic + " --add --producer "
+ " --allow-principal ").split("\\s+"));
Expand All @@ -38,7 +38,7 @@ public static void setProduceAcls(String zkConnect, String topic, String user) {
public static void removeProduceAcls(String zkConnect, String topic, String user) {
List<String> aclArgs = new ArrayList<>();

Collections.addAll(aclArgs, ("--authorizer kafka.security.auth.SimpleAclAuthorizer "
Collections.addAll(aclArgs, ("--authorizer kafka.security.authorizer.AclAuthorizer "
+ "--authorizer-properties zookeeper.connect=" + zkConnect
+ " --topic " + topic + " --remove --producer "
+ " --allow-principal ").split("\\s+"));
Expand All @@ -52,7 +52,7 @@ public static void setConsumerAcls(
) {
List<String> aclArgs = new ArrayList<>();

Collections.addAll(aclArgs, ("--authorizer kafka.security.auth.SimpleAclAuthorizer "
Collections.addAll(aclArgs, ("--authorizer kafka.security.authorizer.AclAuthorizer "
+ "--authorizer-properties zookeeper.connect=" + zkConnect
+ " --topic " + topic + " --add --consumer "
+ " --allow-principal ").split("\\s+"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected SecurityProtocol getBrokerSecurityProtocol() {

@Override
public Properties overrideBrokerProperties(int i, Properties props) {
props.put("authorizer.class.name", "kafka.security.auth.SimpleAclAuthorizer");
props.put("authorizer.class.name", "kafka.security.authorizer.AclAuthorizer");
props.put(
"listener.name.sasl_plaintext.plain.sasl.jaas.config",
"org.apache.kafka.common.security.plain.PlainLoginModule required "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private Properties getBrokerSecurityConfigs() {
"listener.name.internal.plain.sasl.jaas.config", getBrokerPlainSaslJaasConfig());
properties.setProperty("sasl.enabled.mechanisms", "PLAIN");
properties.setProperty("sasl.mechanism.inter.broker.protocol", "PLAIN");
properties.setProperty("authorizer.class.name", "kafka.security.auth.SimpleAclAuthorizer");
properties.setProperty("authorizer.class.name", "kafka.security.authorizer.AclAuthorizer");
}
properties.setProperty("super.users", getSuperUsers());
return properties;
Expand Down
6 changes: 3 additions & 3 deletions testing/environments/sasl_plain/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
- ./kafka-jaas.conf:/etc/kafka/kafka-jaas.conf
environment:
KAFKA_ADVERTISED_LISTENERS: "SASL_PLAINTEXT://kafka-1:9191,EXTERNAL://localhost:9291"
KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.auth.SimpleAclAuthorizer"
KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.authorizer.AclAuthorizer"
KAFKA_BROKER_ID: 1
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_INTER_BROKER_LISTENER_NAME: "SASL_PLAINTEXT"
Expand All @@ -62,7 +62,7 @@ services:
- ./kafka-jaas.conf:/etc/kafka/kafka-jaas.conf
environment:
KAFKA_ADVERTISED_LISTENERS: "SASL_PLAINTEXT://kafka-2:9192,EXTERNAL://localhost:9292"
KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.auth.SimpleAclAuthorizer"
KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.authorizer.AclAuthorizer"
KAFKA_BROKER_ID: 2
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_INTER_BROKER_LISTENER_NAME: "SASL_PLAINTEXT"
Expand All @@ -86,7 +86,7 @@ services:
- ./kafka-jaas.conf:/etc/kafka/kafka-jaas.conf
environment:
KAFKA_ADVERTISED_LISTENERS: "SASL_PLAINTEXT://kafka-3:9193,EXTERNAL://localhost:9293"
KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.auth.SimpleAclAuthorizer"
KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.authorizer.AclAuthorizer"
KAFKA_BROKER_ID: 3
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_INTER_BROKER_LISTENER_NAME: "SASL_PLAINTEXT"
Expand Down

0 comments on commit 338ad58

Please sign in to comment.