You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ju...@apache.org on 2015/11/14 02:36:12 UTC

kafka git commit: KAFKA-2838; Allow comma in super users, allow comma in CLI authz prop…

Repository: kafka
Updated Branches:
  refs/heads/trunk 5d87eac85 -> 8e6bae21c


KAFKA-2838; Allow comma in super users, allow comma in CLI authz prop…

…erties.

Author: Parth Brahmbhatt <br...@gmail.com>

Reviewers: Sriharsha Chintalapani <ha...@hortonworks.com>, Jun Rao <ju...@gmail.com>

Closes #529 from Parth-Brahmbhatt/KAFKA-2838


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/8e6bae21
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/8e6bae21
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/8e6bae21

Branch: refs/heads/trunk
Commit: 8e6bae21c64699245cf24dbaac3942f32a2a241b
Parents: 5d87eac
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Fri Nov 13 17:36:09 2015 -0800
Committer: Jun Rao <ju...@gmail.com>
Committed: Fri Nov 13 17:36:09 2015 -0800

----------------------------------------------------------------------
 core/src/main/scala/kafka/admin/AclCommand.scala                 | 4 +---
 .../src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala | 2 +-
 .../scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/8e6bae21/core/src/main/scala/kafka/admin/AclCommand.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/admin/AclCommand.scala b/core/src/main/scala/kafka/admin/AclCommand.scala
index 3a6986f..377315d 100644
--- a/core/src/main/scala/kafka/admin/AclCommand.scala
+++ b/core/src/main/scala/kafka/admin/AclCommand.scala
@@ -257,12 +257,10 @@ object AclCommand {
       .defaultsTo(classOf[SimpleAclAuthorizer].getName)
 
     val authorizerPropertiesOpt = parser.accepts("authorizer-properties", "REQUIRED: properties required to configure an instance of Authorizer. " +
-      "These are comma separated key=val pairs. For the default authorizer the example values are: " +
-      "zookeeper.connect=localhost:2181")
+      "These are key=val pairs. For the default authorizer the example values are: zookeeper.connect=localhost:2181")
       .withRequiredArg
       .describedAs("authorizer-properties")
       .ofType(classOf[String])
-      .withValuesSeparatedBy(Delimiter)
 
     val topicOpt = parser.accepts("topic", "Comma separated list of topic to which acls should be added or removed. " +
       "A value of * indicates acl should apply to all topics.")

http://git-wip-us.apache.org/repos/asf/kafka/blob/8e6bae21/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
index 7bfb092..76645da 100644
--- a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
+++ b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
@@ -84,7 +84,7 @@ class SimpleAclAuthorizer extends Authorizer with Logging {
     val kafkaConfig = KafkaConfig.fromProps(props)
 
     superUsers = configs.get(SimpleAclAuthorizer.SuperUsersProp).collect {
-      case str: String if str.nonEmpty => str.split(",").map(s => KafkaPrincipal.fromString(s.trim)).toSet
+      case str: String if str.nonEmpty => str.split(";").map(s => KafkaPrincipal.fromString(s.trim)).toSet
     }.getOrElse(Set.empty[KafkaPrincipal])
 
     shouldAllowEveryoneIfNoAclIsFound = configs.get(SimpleAclAuthorizer.AllowEveryoneIfNoAclIsFoundProp).map(_.toString.toBoolean).getOrElse(false)

http://git-wip-us.apache.org/repos/asf/kafka/blob/8e6bae21/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala b/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
index 6238f6d..76a768a 100644
--- a/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
+++ b/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
@@ -34,7 +34,7 @@ class SimpleAclAuthorizerTest extends ZooKeeperTestHarness {
   val testHostName = "test.host.com"
   var session = new Session(testPrincipal, testHostName)
   var resource: Resource = null
-  val superUsers = "User:superuser1, User:superuser2"
+  val superUsers = "User:superuser1; User:superuser2"
   val username = "alice"
   var config: KafkaConfig = null