{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/38926011","id":38926011,"diff_hunk":"@@ -0,0 +1,264 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package kafka.security.auth\n+\n+import java.util\n+import java.util.concurrent.TimeUnit\n+import java.util.concurrent.locks.ReentrantReadWriteLock\n+\n+import kafka.network.RequestChannel.Session\n+import kafka.server.KafkaConfig\n+import kafka.utils.CoreUtils.{inReadLock, inWriteLock}\n+import kafka.utils._\n+import org.I0Itec.zkclient.{IZkDataListener, ZkClient}\n+import org.apache.kafka.common.security.auth.KafkaPrincipal\n+import scala.collection.JavaConverters._\n+\n+object SimpleAclAuthorizer {\n+  //the zookeeper cluster where acls will be stored, defaults to value specified for \"zkConnect\"\n+  val ZkUrlProp = \"zookeeper.url\"\n+  //List of users that will be treated as super users and will have access to all the resources for all actions from all hosts, defaults to no super users.\n+  val SuperUsersProp = \"super.users\"\n+  //If set to true when no acls are found for a resource , authorizer allows access to everyone. Defaults to false.\n+  val AllowEveryoneIfNoAclIsFoundProp = \"allow.everyone.if.no.acl.found\"\n+\n+  val AclZkPath = \"/kafka-acl\"\n+  val AclChangedZkPath = \"/kafka-acl-changed\"\n+}\n+\n+class SimpleAclAuthorizer extends Authorizer with Logging {\n+  private var superUsers: Set[KafkaPrincipal] = Set.empty\n+  private var shouldAllowEveryoneIfNoAclIsFound = false\n+  private var zkClient: ZkClient = null\n+  private val scheduler: KafkaScheduler = new KafkaScheduler(threads = 1, threadNamePrefix = \"authorizer\")","path":"core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala","position":47,"original_position":47,"commit_id":"a7684bfc3958d4e9222c02ffb7e84f1ed4150cea","original_commit_id":"a7684bfc3958d4e9222c02ffb7e84f1ed4150cea","user":{"login":"ijuma","id":24747,"avatar_url":"https://avatars.githubusercontent.com/u/24747?v=3","gravatar_id":"","url":"https://api.github.com/users/ijuma","html_url":"https://github.com/ijuma","followers_url":"https://api.github.com/users/ijuma/followers","following_url":"https://api.github.com/users/ijuma/following{/other_user}","gists_url":"https://api.github.com/users/ijuma/gists{/gist_id}","starred_url":"https://api.github.com/users/ijuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijuma/subscriptions","organizations_url":"https://api.github.com/users/ijuma/orgs","repos_url":"https://api.github.com/users/ijuma/repos","events_url":"https://api.github.com/users/ijuma/events{/privacy}","received_events_url":"https://api.github.com/users/ijuma/received_events","type":"User","site_admin":false},"body":"Type annotation is redundant in cases like this.","created_at":"2015-09-08T13:41:01Z","updated_at":"2015-09-08T13:41:01Z","html_url":"https://github.com/apache/kafka/pull/195#discussion_r38926011","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/195","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/38926011"},"html":{"href":"https://github.com/apache/kafka/pull/195#discussion_r38926011"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/195"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/195","id":44267004,"html_url":"https://github.com/apache/kafka/pull/195","diff_url":"https://github.com/apache/kafka/pull/195.diff","patch_url":"https://github.com/apache/kafka/pull/195.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/195","number":195,"state":"open","locked":false,"title":"KAFKA-2211: Adding simpleAclAuthorizer implementation and test cases.","user":{"login":"Parth-Brahmbhatt","id":6914358,"avatar_url":"https://avatars.githubusercontent.com/u/6914358?v=3","gravatar_id":"","url":"https://api.github.com/users/Parth-Brahmbhatt","html_url":"https://github.com/Parth-Brahmbhatt","followers_url":"https://api.github.com/users/Parth-Brahmbhatt/followers","following_url":"https://api.github.com/users/Parth-Brahmbhatt/following{/other_user}","gists_url":"https://api.github.com/users/Parth-Brahmbhatt/gists{/gist_id}","starred_url":"https://api.github.com/users/Parth-Brahmbhatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parth-Brahmbhatt/subscriptions","organizations_url":"https://api.github.com/users/Parth-Brahmbhatt/orgs","repos_url":"https://api.github.com/users/Parth-Brahmbhatt/repos","events_url":"https://api.github.com/users/Parth-Brahmbhatt/events{/privacy}","received_events_url":"https://api.github.com/users/Parth-Brahmbhatt/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-04T22:23:12Z","updated_at":"2015-09-08T13:41:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d15883ae23bc1ccb2431709724d1951b06e096b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/195/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/195/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/195/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/a7684bfc3958d4e9222c02ffb7e84f1ed4150cea","head":{"label":"Parth-Brahmbhatt:KAFKA-2211","ref":"KAFKA-2211","sha":"a7684bfc3958d4e9222c02ffb7e84f1ed4150cea","user":{"login":"Parth-Brahmbhatt","id":6914358,"avatar_url":"https://avatars.githubusercontent.com/u/6914358?v=3","gravatar_id":"","url":"https://api.github.com/users/Parth-Brahmbhatt","html_url":"https://github.com/Parth-Brahmbhatt","followers_url":"https://api.github.com/users/Parth-Brahmbhatt/followers","following_url":"https://api.github.com/users/Parth-Brahmbhatt/following{/other_user}","gists_url":"https://api.github.com/users/Parth-Brahmbhatt/gists{/gist_id}","starred_url":"https://api.github.com/users/Parth-Brahmbhatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parth-Brahmbhatt/subscriptions","organizations_url":"https://api.github.com/users/Parth-Brahmbhatt/orgs","repos_url":"https://api.github.com/users/Parth-Brahmbhatt/repos","events_url":"https://api.github.com/users/Parth-Brahmbhatt/events{/privacy}","received_events_url":"https://api.github.com/users/Parth-Brahmbhatt/received_events","type":"User","site_admin":false},"repo":{"id":34346413,"name":"kafka","full_name":"Parth-Brahmbhatt/kafka","owner":{"login":"Parth-Brahmbhatt","id":6914358,"avatar_url":"https://avatars.githubusercontent.com/u/6914358?v=3","gravatar_id":"","url":"https://api.github.com/users/Parth-Brahmbhatt","html_url":"https://github.com/Parth-Brahmbhatt","followers_url":"https://api.github.com/users/Parth-Brahmbhatt/followers","following_url":"https://api.github.com/users/Parth-Brahmbhatt/following{/other_user}","gists_url":"https://api.github.com/users/Parth-Brahmbhatt/gists{/gist_id}","starred_url":"https://api.github.com/users/Parth-Brahmbhatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parth-Brahmbhatt/subscriptions","organizations_url":"https://api.github.com/users/Parth-Brahmbhatt/orgs","repos_url":"https://api.github.com/users/Parth-Brahmbhatt/repos","events_url":"https://api.github.com/users/Parth-Brahmbhatt/events{/privacy}","received_events_url":"https://api.github.com/users/Parth-Brahmbhatt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Parth-Brahmbhatt/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka","forks_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/forks","keys_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/teams","hooks_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/hooks","issue_events_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/events","assignees_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/tags","blobs_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/languages","stargazers_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/stargazers","contributors_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/contributors","subscribers_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/subscribers","subscription_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/subscription","commits_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/merges","archive_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/downloads","issues_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/labels{/name}","releases_url":"https://api.github.com/repos/Parth-Brahmbhatt/kafka/releases{/id}","created_at":"2015-04-21T19:00:48Z","updated_at":"2015-04-21T19:00:51Z","pushed_at":"2015-09-04T23:22:19Z","git_url":"git://github.com/Parth-Brahmbhatt/kafka.git","ssh_url":"git@github.com:Parth-Brahmbhatt/kafka.git","clone_url":"https://github.com/Parth-Brahmbhatt/kafka.git","svn_url":"https://github.com/Parth-Brahmbhatt/kafka","homepage":null,"size":22394,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"0.8.2"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"f25731265ef63e5440a188b3e5553c31fb9a397b","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","created_at":"2011-08-15T18:06:16Z","updated_at":"2015-09-08T06:41:32Z","pushed_at":"2015-09-07T03:28:08Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":32458,"stargazers_count":1886,"watchers_count":1886,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1135,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":78,"forks":1135,"open_issues":78,"watchers":1886,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/195"},"html":{"href":"https://github.com/apache/kafka/pull/195"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/195"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/195/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/195/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/195/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/a7684bfc3958d4e9222c02ffb7e84f1ed4150cea"}}}}