d8tltanc commented on a change in pull request #9485: URL: https://github.com/apache/kafka/pull/9485#discussion_r543087570
########## File path: core/src/main/scala/kafka/security/authorizer/AuthorizerWrapper.scala ########## @@ -71,15 +74,22 @@ object AuthorizerWrapper { } def convertToResource(resourcePattern: ResourcePattern): Resource = { - Resource(ResourceType.fromJava(resourcePattern.resourceType), resourcePattern.name, resourcePattern.patternType) + Resource(ResourceTypeLegacy.fromJava(resourcePattern.resourceType), resourcePattern.name, resourcePattern.patternType) } } @deprecated("Use kafka.security.authorizer.AclAuthorizer", "Since 2.5") class AuthorizerWrapper(private[kafka] val baseAuthorizer: kafka.security.auth.Authorizer) extends Authorizer { + var shouldAllowEveryoneIfNoAclIsFound = false + override def configure(configs: util.Map[String, _]): Unit = { baseAuthorizer.configure(configs) + shouldAllowEveryoneIfNoAclIsFound = (configs.asScala.get( + AclAuthorizer.AllowEveryoneIfNoAclIsFoundProp).exists(_.toString.toBoolean) + && baseAuthorizer.authorize( + new Session(KafkaPrincipal.ANONYMOUS, InetAddress.getByName("1.2.3.4")), + Read, new Resource(Topic, "hi", PatternType.LITERAL))) Review comment: So we have two approaches here: 1. use baseAuthorizer.getClass == classOf[SimpleAclAuthorizer] 2. use baseAuthorizer.isInstanceOf[SimpleAclAuthorizer] They are neither perfect. Approach 2 also seems better to me. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org