diff --git a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala index 42bfebf61ab..72f79d5aba4 100644 --- a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala +++ b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala @@ -161,15 +161,15 @@ class SimpleAclAuthorizer extends Authorizer with Logging { } private def aclMatch(session: Session, operations: Operation, resource: Resource, principal: KafkaPrincipal, host: String, permissionType: PermissionType, acls: Set[Acl]): Boolean = { - acls.find ( acl => - acl.permissionType == permissionType - && (acl.principal == principal || acl.principal == Acl.WildCardPrincipal) - && (operations == acl.operation || acl.operation == All) - && (acl.host == host || acl.host == Acl.WildCardHost) - ).map { acl: Acl => + acls.find { acl => + acl.permissionType == permissionType && + (acl.principal == principal || acl.principal == Acl.WildCardPrincipal) && + (operations == acl.operation || acl.operation == All) && + (acl.host == host || acl.host == Acl.WildCardHost) + }.exists { acl => authorizerLogger.debug(s"operation = $operations on resource = $resource from host = $host is $permissionType based on acl = $acl") true - }.getOrElse(false) + } } override def addAcls(acls: Set[Acl], resource: Resource) {