Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
chia7712 commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2027901054 @nizhikov thanks for this migration!! -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
chia7712 merged PR #15572: URL: https://github.com/apache/kafka/pull/15572 -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
nizhikov commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2027422531 @ijuma Please, ignore my last question, I misread your statement :) -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
nizhikov commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2027411004 @ijuma Are you suggesting to move `AclAuthorizer` in this PR? Or it could be postponed until all dependencies are ready? -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
ijuma commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2027407574 > AclAuthorizer We should not move this since it will be deleted as part of ZK removal. I would focus on moving classes that we don't intend to delete soon. -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
chia7712 commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2027038241 the flaky of `ReplicaManagerTest` is related to #15373 see https://github.com/apache/kafka/pull/15373/files#r1544335647 -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
chia7712 commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2026944004 ``` ./gradlew cleanTest :metadata:test --tests QuorumControllerMetricsIntegrationTest.testClosingQuorumControllerClosesMetrics --tests QuorumControllerTest.testFenceMultipleBrokers :connect:mirror:test --tests MirrorConnectorsWithCustomForwardingAdminIntegrationTest.testReplicateSourceDefault :core:test --tests DelegationTokenEndToEndAuthorizationWithOwnerTest.testProduceConsumeWithPrefixedAcls --tests ReplicaManagerTest.testFetcherAreNotRestartedIfLeaderEpochIsNotBumpedWithKRaftPath --tests ReplicaManagerTest.testRemoteFetchExpiresPerSecMetric --tests ReplicaManagerTest.testDeltaFollowerToNotReplica --tests ReplicaManagerTest.testDeltaFollowerWithNoChange --tests ReplicaManagerTest.testDeltaFollowerRemovedTopic --tests ReplicaManagerTest.testDeltaFollowerStopFetcherBeforeCreatingInitialFetchOffset --tests ReplicaManagerTest.testDeltaFromLeaderToFollower --tests ReplicaManagerTest.testDeltaFromFollowerToLeader --tests PlaintextConsumerTest.testPartitionPauseAndResume --tests LogDirFai lureTest.testIOExceptionDuringLogRoll --tests LogDirFailureTest.testIOExceptionDuringCheckpoint --tests SslConsumerTest.testClusterResourceListener ``` pass on my local also. will merge it tomorrow -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
nizhikov commented on PR #15572: URL: https://github.com/apache/kafka/pull/15572#issuecomment-2026879663 Tests looks OK for me. I've checked locally and `kafka.server.ReplicaManagerTest` fails with the same error in trunk. -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
nizhikov commented on code in PR #15572: URL: https://github.com/apache/kafka/pull/15572#discussion_r1543177295 ## server/src/main/java/org/apache/kafka/security/authorizer/AclEntry.java: ## @@ -0,0 +1,209 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.security.authorizer; + +import org.apache.kafka.common.acl.AccessControlEntry; +import org.apache.kafka.common.acl.AclOperation; +import org.apache.kafka.common.acl.AclPermissionType; +import org.apache.kafka.common.protocol.Errors; +import org.apache.kafka.common.resource.ResourcePattern; +import org.apache.kafka.common.resource.ResourceType; +import org.apache.kafka.common.security.auth.KafkaPrincipal; +import org.apache.kafka.common.utils.SecurityUtils; +import org.apache.kafka.common.utils.Utils; +import org.apache.kafka.server.util.Json; +import org.apache.kafka.server.util.json.DecodeJson; +import org.apache.kafka.server.util.json.JsonObject; +import org.apache.kafka.server.util.json.JsonValue; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.apache.kafka.common.acl.AclOperation.ALTER; +import static org.apache.kafka.common.acl.AclOperation.ALTER_CONFIGS; +import static org.apache.kafka.common.acl.AclOperation.CLUSTER_ACTION; +import static org.apache.kafka.common.acl.AclOperation.CREATE; +import static org.apache.kafka.common.acl.AclOperation.CREATE_TOKENS; +import static org.apache.kafka.common.acl.AclOperation.DELETE; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE_CONFIGS; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE_TOKENS; +import static org.apache.kafka.common.acl.AclOperation.IDEMPOTENT_WRITE; +import static org.apache.kafka.common.acl.AclOperation.READ; +import static org.apache.kafka.common.acl.AclOperation.WRITE; + +public class AclEntry extends AccessControlEntry { +private static final DecodeJson.DecodeInteger INT = new DecodeJson.DecodeInteger(); +private static final DecodeJson.DecodeString STRING = new DecodeJson.DecodeString(); + +public static final KafkaPrincipal WILDCARD_PRINCIPAL = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, "*"); +public static final String WILDCARD_PRINCIPAL_STRING = WILDCARD_PRINCIPAL.toString(); +public static final String WILDCARD_HOST = "*"; +public static final String WILDCARD_RESOURCE = ResourcePattern.WILDCARD_RESOURCE; +public static final String RESOURCE_SEPARATOR = ":"; +public static final Set RESOURCE_TYPES = Arrays.stream(ResourceType.values()) +.filter(t -> !(t == ResourceType.UNKNOWN || t == ResourceType.ANY)) +.collect(Collectors.toSet()); +public static final Set ACL_OPERATIONS = Arrays.stream(AclOperation.values()) +.filter(t -> !(t == AclOperation.UNKNOWN || t == AclOperation.ANY)) +.collect(Collectors.toSet()); + +private static final String PRINCIPAL_KEY = "principal"; +private static final String PERMISSION_TYPE_KEY = "permissionType"; +private static final String OPERATION_KEY = "operation"; +private static final String HOSTS_KEY = "host"; +public static final String VERSION_KEY = "version"; +public static final int CURRENT_VERSION = 1; +private static final String ACLS_KEY = "acls"; + +public final AccessControlEntry ace; +public final KafkaPrincipal kafkaPrincipal; + +public AclEntry(AccessControlEntry ace) { +super(ace.principal(), ace.host(), ace.operation(), ace.permissionType()); +this.ace = ace; + +kafkaPrincipal = ace.principal() == null +? null +: SecurityUtils.parseKafkaPrincipal(ace.principal()); +} + +/** + * Parse JSON representation of ACLs + * @param bytes of acls json string + * + * +{ +"version": 1, +"acls": [ +{ +"host":"host1", +"permissionType":
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
chia7712 commented on code in PR #15572: URL: https://github.com/apache/kafka/pull/15572#discussion_r1543172408 ## server/src/main/java/org/apache/kafka/security/authorizer/AclEntry.java: ## @@ -0,0 +1,209 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.security.authorizer; + +import org.apache.kafka.common.acl.AccessControlEntry; +import org.apache.kafka.common.acl.AclOperation; +import org.apache.kafka.common.acl.AclPermissionType; +import org.apache.kafka.common.protocol.Errors; +import org.apache.kafka.common.resource.ResourcePattern; +import org.apache.kafka.common.resource.ResourceType; +import org.apache.kafka.common.security.auth.KafkaPrincipal; +import org.apache.kafka.common.utils.SecurityUtils; +import org.apache.kafka.common.utils.Utils; +import org.apache.kafka.server.util.Json; +import org.apache.kafka.server.util.json.DecodeJson; +import org.apache.kafka.server.util.json.JsonObject; +import org.apache.kafka.server.util.json.JsonValue; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.apache.kafka.common.acl.AclOperation.ALTER; +import static org.apache.kafka.common.acl.AclOperation.ALTER_CONFIGS; +import static org.apache.kafka.common.acl.AclOperation.CLUSTER_ACTION; +import static org.apache.kafka.common.acl.AclOperation.CREATE; +import static org.apache.kafka.common.acl.AclOperation.CREATE_TOKENS; +import static org.apache.kafka.common.acl.AclOperation.DELETE; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE_CONFIGS; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE_TOKENS; +import static org.apache.kafka.common.acl.AclOperation.IDEMPOTENT_WRITE; +import static org.apache.kafka.common.acl.AclOperation.READ; +import static org.apache.kafka.common.acl.AclOperation.WRITE; + +public class AclEntry extends AccessControlEntry { +private static final DecodeJson.DecodeInteger INT = new DecodeJson.DecodeInteger(); +private static final DecodeJson.DecodeString STRING = new DecodeJson.DecodeString(); + +public static final KafkaPrincipal WILDCARD_PRINCIPAL = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, "*"); +public static final String WILDCARD_PRINCIPAL_STRING = WILDCARD_PRINCIPAL.toString(); +public static final String WILDCARD_HOST = "*"; +public static final String WILDCARD_RESOURCE = ResourcePattern.WILDCARD_RESOURCE; +public static final String RESOURCE_SEPARATOR = ":"; +public static final Set RESOURCE_TYPES = Arrays.stream(ResourceType.values()) +.filter(t -> !(t == ResourceType.UNKNOWN || t == ResourceType.ANY)) +.collect(Collectors.toSet()); +public static final Set ACL_OPERATIONS = Arrays.stream(AclOperation.values()) +.filter(t -> !(t == AclOperation.UNKNOWN || t == AclOperation.ANY)) +.collect(Collectors.toSet()); + +private static final String PRINCIPAL_KEY = "principal"; +private static final String PERMISSION_TYPE_KEY = "permissionType"; +private static final String OPERATION_KEY = "operation"; +private static final String HOSTS_KEY = "host"; +public static final String VERSION_KEY = "version"; +public static final int CURRENT_VERSION = 1; +private static final String ACLS_KEY = "acls"; + +public final AccessControlEntry ace; +public final KafkaPrincipal kafkaPrincipal; + +public AclEntry(AccessControlEntry ace) { +super(ace.principal(), ace.host(), ace.operation(), ace.permissionType()); +this.ace = ace; + +kafkaPrincipal = ace.principal() == null +? null +: SecurityUtils.parseKafkaPrincipal(ace.principal()); +} + +/** + * Parse JSON representation of ACLs + * @param bytes of acls json string + * + * +{ +"version": 1, +"acls": [ +{ +"host":"host1", +"permissionType":
Re: [PR] KAFKA-15899 [1/2] Move kafka.security package from core to server module [kafka]
OmniaGM commented on code in PR #15572: URL: https://github.com/apache/kafka/pull/15572#discussion_r1543154424 ## server/src/main/java/org/apache/kafka/security/authorizer/AclEntry.java: ## @@ -0,0 +1,209 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.security.authorizer; + +import org.apache.kafka.common.acl.AccessControlEntry; +import org.apache.kafka.common.acl.AclOperation; +import org.apache.kafka.common.acl.AclPermissionType; +import org.apache.kafka.common.protocol.Errors; +import org.apache.kafka.common.resource.ResourcePattern; +import org.apache.kafka.common.resource.ResourceType; +import org.apache.kafka.common.security.auth.KafkaPrincipal; +import org.apache.kafka.common.utils.SecurityUtils; +import org.apache.kafka.common.utils.Utils; +import org.apache.kafka.server.util.Json; +import org.apache.kafka.server.util.json.DecodeJson; +import org.apache.kafka.server.util.json.JsonObject; +import org.apache.kafka.server.util.json.JsonValue; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.apache.kafka.common.acl.AclOperation.ALTER; +import static org.apache.kafka.common.acl.AclOperation.ALTER_CONFIGS; +import static org.apache.kafka.common.acl.AclOperation.CLUSTER_ACTION; +import static org.apache.kafka.common.acl.AclOperation.CREATE; +import static org.apache.kafka.common.acl.AclOperation.CREATE_TOKENS; +import static org.apache.kafka.common.acl.AclOperation.DELETE; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE_CONFIGS; +import static org.apache.kafka.common.acl.AclOperation.DESCRIBE_TOKENS; +import static org.apache.kafka.common.acl.AclOperation.IDEMPOTENT_WRITE; +import static org.apache.kafka.common.acl.AclOperation.READ; +import static org.apache.kafka.common.acl.AclOperation.WRITE; + +public class AclEntry extends AccessControlEntry { +private static final DecodeJson.DecodeInteger INT = new DecodeJson.DecodeInteger(); +private static final DecodeJson.DecodeString STRING = new DecodeJson.DecodeString(); + +public static final KafkaPrincipal WILDCARD_PRINCIPAL = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, "*"); +public static final String WILDCARD_PRINCIPAL_STRING = WILDCARD_PRINCIPAL.toString(); +public static final String WILDCARD_HOST = "*"; +public static final String WILDCARD_RESOURCE = ResourcePattern.WILDCARD_RESOURCE; +public static final String RESOURCE_SEPARATOR = ":"; +public static final Set RESOURCE_TYPES = Arrays.stream(ResourceType.values()) +.filter(t -> !(t == ResourceType.UNKNOWN || t == ResourceType.ANY)) +.collect(Collectors.toSet()); +public static final Set ACL_OPERATIONS = Arrays.stream(AclOperation.values()) +.filter(t -> !(t == AclOperation.UNKNOWN || t == AclOperation.ANY)) +.collect(Collectors.toSet()); + +private static final String PRINCIPAL_KEY = "principal"; +private static final String PERMISSION_TYPE_KEY = "permissionType"; +private static final String OPERATION_KEY = "operation"; +private static final String HOSTS_KEY = "host"; +public static final String VERSION_KEY = "version"; +public static final int CURRENT_VERSION = 1; +private static final String ACLS_KEY = "acls"; + +public final AccessControlEntry ace; +public final KafkaPrincipal kafkaPrincipal; + +public AclEntry(AccessControlEntry ace) { +super(ace.principal(), ace.host(), ace.operation(), ace.permissionType()); +this.ace = ace; + +kafkaPrincipal = ace.principal() == null +? null +: SecurityUtils.parseKafkaPrincipal(ace.principal()); +} + +/** + * Parse JSON representation of ACLs + * @param bytes of acls json string + * + * +{ +"version": 1, +"acls": [ +{ +"host":"host1", +"permissionType":