From a60e6738524d5fe3b376cacb4d740b67992b672b Mon Sep 17 00:00:00 2001 From: E046899 Date: Thu, 12 Oct 2023 12:06:20 +0200 Subject: [PATCH] fix confluent user ids --- .../executors/AccessControlEntryAsyncExecutor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/michelin/ns4kafka/services/executors/AccessControlEntryAsyncExecutor.java b/src/main/java/com/michelin/ns4kafka/services/executors/AccessControlEntryAsyncExecutor.java index a032703f..08cf6670 100644 --- a/src/main/java/com/michelin/ns4kafka/services/executors/AccessControlEntryAsyncExecutor.java +++ b/src/main/java/com/michelin/ns4kafka/services/executors/AccessControlEntryAsyncExecutor.java @@ -26,12 +26,14 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.admin.Admin; +import org.apache.kafka.common.acl.AccessControlEntryFilter; import org.apache.kafka.common.acl.AclBinding; import org.apache.kafka.common.acl.AclBindingFilter; import org.apache.kafka.common.acl.AclOperation; import org.apache.kafka.common.acl.AclPermissionType; import org.apache.kafka.common.resource.PatternType; import org.apache.kafka.common.resource.ResourcePattern; +import org.apache.kafka.common.resource.ResourcePatternFilter; import org.apache.kafka.common.resource.ResourceType; /** @@ -179,8 +181,14 @@ private List collectBrokerAcls(boolean managedUsersOnly) List validResourceTypes = List.of(ResourceType.TOPIC, ResourceType.GROUP, ResourceType.TRANSACTIONAL_ID); + AccessControlEntryFilter accessControlEntryFilter = new AccessControlEntryFilter( + managedClusterProperties.getProvider() + .equals(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD) ? "UserV2:*" : null, + null, AclOperation.ANY, AclPermissionType.ANY); + AclBindingFilter aclBindingFilter = new AclBindingFilter(ResourcePatternFilter.ANY, accessControlEntryFilter); + List userAcls = getAdminClient() - .describeAcls(AclBindingFilter.ANY) + .describeAcls(aclBindingFilter) .values().get(10, TimeUnit.SECONDS) .stream() .filter(aclBinding -> validResourceTypes.contains(aclBinding.pattern().resourceType()))