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: I think "isInstanceOf" will still return true if the `baseAuthorizer` is a subclass extending SimpleAclAuthorizer. class Father { } class Son extends Father { } val father = new Father val son = new Son println(son.isInstanceOf[Father]) println(son.getClass == classOf[Father]) println(son.getClass == classOf[Son]) > true >false >true ---------------------------------------------------------------- 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