You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by mi...@apache.org on 2025/01/16 17:28:34 UTC
(kafka) branch 4.0 updated: KAFKA-18556: Remove JaasModule#zkDigestModule, JaasTestUtils#zkSections (#18568)
This is an automated email from the ASF dual-hosted git repository.
mimaison pushed a commit to branch 4.0
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/4.0 by this push:
new e4aa44ec576 KAFKA-18556: Remove JaasModule#zkDigestModule, JaasTestUtils#zkSections (#18568)
e4aa44ec576 is described below
commit e4aa44ec576e2b7c65512598d36206d921f2fa0e
Author: TengYao Chi <ki...@gmail.com>
AuthorDate: Fri Jan 17 01:17:06 2025 +0800
KAFKA-18556: Remove JaasModule#zkDigestModule, JaasTestUtils#zkSections (#18568)
Reviewers: Mickael Maison <mi...@gmail.com>
---
core/src/test/java/kafka/security/JaasModule.java | 9 ---------
.../src/test/java/kafka/security/JaasTestUtils.java | 21 ---------------------
.../scala/integration/kafka/api/SaslSetup.scala | 10 ++--------
...ipleListenersWithAdditionalJaasContextTest.scala | 3 +--
4 files changed, 3 insertions(+), 40 deletions(-)
diff --git a/core/src/test/java/kafka/security/JaasModule.java b/core/src/test/java/kafka/security/JaasModule.java
index 46527b18609..b4901cc7933 100644
--- a/core/src/test/java/kafka/security/JaasModule.java
+++ b/core/src/test/java/kafka/security/JaasModule.java
@@ -23,15 +23,6 @@ import java.util.Optional;
import java.util.stream.Collectors;
public class JaasModule {
- public static JaasModule zkDigestModule(boolean debug, Map<String, String> entries) {
- String name = "org.apache.zookeeper.server.auth.DigestLoginModule";
- return new JaasModule(
- name,
- debug,
- entries
- );
- }
-
public static JaasModule krb5LoginModule(boolean useKeyTab, boolean storeKey, String keyTab, String principal, boolean debug, Optional<String> serviceName, boolean isIbmSecurity) {
String name = isIbmSecurity ? "com.ibm.security.auth.module.Krb5LoginModule" : "com.sun.security.auth.module.Krb5LoginModule";
diff --git a/core/src/test/java/kafka/security/JaasTestUtils.java b/core/src/test/java/kafka/security/JaasTestUtils.java
index 73e8a7245bc..201a43313d6 100644
--- a/core/src/test/java/kafka/security/JaasTestUtils.java
+++ b/core/src/test/java/kafka/security/JaasTestUtils.java
@@ -31,7 +31,6 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -72,12 +71,6 @@ public class JaasTestUtils {
private static final boolean IS_IBM_SECURITY = Java.isIbmJdk() && !Java.isIbmJdkSemeru();
- private static final String ZK_SERVER_CONTEXT_NAME = "Server";
- private static final String ZK_CLIENT_CONTEXT_NAME = "Client";
- private static final String ZK_USER_SUPER_PASSWD = "adminpasswd";
- private static final String ZK_USER = "fpj";
- private static final String ZK_USER_PASSWORD = "fpjsecret";
-
public static final String KAFKA_SERVER_CONTEXT_NAME = "KafkaServer";
public static final String KAFKA_SERVER_PRINCIPAL_UNQUALIFIED_NAME = "kafka";
private static final String KAFKA_SERVER_PRINCIPAL = KAFKA_SERVER_PRINCIPAL_UNQUALIFIED_NAME + "/localhost@EXAMPLE.COM";
@@ -172,20 +165,6 @@ public class JaasTestUtils {
return JaasModule.scramLoginModule(tokenId, password, false, tokenProps).toString();
}
- public static List<JaasSection> zkSections() {
- Map<String, String> zkServerEntries = new HashMap<>();
- zkServerEntries.put("user_super", ZK_USER_SUPER_PASSWD);
- zkServerEntries.put("user_" + ZK_USER, ZK_USER_PASSWORD);
- JaasSection zkServerSection = new JaasSection(ZK_SERVER_CONTEXT_NAME, Collections.singletonList(JaasModule.zkDigestModule(false, zkServerEntries)));
-
- Map<String, String> zkClientEntries = new HashMap<>();
- zkClientEntries.put("username", ZK_USER);
- zkClientEntries.put("password", ZK_USER_PASSWORD);
- JaasSection zkClientSection = new JaasSection(ZK_CLIENT_CONTEXT_NAME, Collections.singletonList(JaasModule.zkDigestModule(false, zkClientEntries)));
-
- return Arrays.asList(zkServerSection, zkClientSection);
- }
-
public static JaasSection kafkaServerSection(String contextName, List<String> mechanisms, Optional<File> keytabLocation) {
List<JaasModule> modules = new ArrayList<>();
for (String mechanism : mechanisms) {
diff --git a/core/src/test/scala/integration/kafka/api/SaslSetup.scala b/core/src/test/scala/integration/kafka/api/SaslSetup.scala
index 84eb0ae4aaa..c62ce796d8c 100644
--- a/core/src/test/scala/integration/kafka/api/SaslSetup.scala
+++ b/core/src/test/scala/integration/kafka/api/SaslSetup.scala
@@ -104,14 +104,8 @@ trait SaslSetup {
(kafkaServerSaslMechanisms.contains("GSSAPI") || kafkaClientSaslMechanism.contains("GSSAPI"))
if (hasKerberos)
maybeCreateEmptyKeytabFiles()
- mode match {
- case ZkSasl => JaasTestUtils.zkSections.asScala
- case KafkaSasl =>
- Seq(JaasTestUtils.kafkaServerSection(kafkaServerEntryName, kafkaServerSaslMechanisms.asJava, serverKeytabFile.toJava),
- JaasTestUtils.kafkaClientSection(kafkaClientSaslMechanism.toJava, clientKeytabFile.toJava))
- case Both => Seq(JaasTestUtils.kafkaServerSection(kafkaServerEntryName, kafkaServerSaslMechanisms.asJava, serverKeytabFile.toJava),
- JaasTestUtils.kafkaClientSection(kafkaClientSaslMechanism.toJava, clientKeytabFile.toJava)) ++ JaasTestUtils.zkSections.asScala
- }
+ Seq(JaasTestUtils.kafkaServerSection(kafkaServerEntryName, kafkaServerSaslMechanisms.asJava, serverKeytabFile.toJava),
+ JaasTestUtils.kafkaClientSection(kafkaClientSaslMechanism.toJava, clientKeytabFile.toJava))
}
private def writeJaasConfigurationToFile(jaasSections: Seq[JaasSection]): Unit = {
diff --git a/core/src/test/scala/integration/kafka/server/MultipleListenersWithAdditionalJaasContextTest.scala b/core/src/test/scala/integration/kafka/server/MultipleListenersWithAdditionalJaasContextTest.scala
index de07e044fc0..8bf7860d151 100644
--- a/core/src/test/scala/integration/kafka/server/MultipleListenersWithAdditionalJaasContextTest.scala
+++ b/core/src/test/scala/integration/kafka/server/MultipleListenersWithAdditionalJaasContextTest.scala
@@ -32,8 +32,7 @@ class MultipleListenersWithAdditionalJaasContextTest extends MultipleListenersWi
override def staticJaasSections: Seq[JaasSection] = {
val (serverKeytabFile, _) = maybeCreateEmptyKeytabFiles()
- JaasTestUtils.zkSections.asScala :+
- JaasTestUtils.kafkaServerSection("secure_external.KafkaServer", kafkaServerSaslMechanisms(SecureExternal).asJava, Some(serverKeytabFile).toJava)
+ Seq(JaasTestUtils.kafkaServerSection("secure_external.KafkaServer", kafkaServerSaslMechanisms(SecureExternal).asJava, Some(serverKeytabFile).toJava))
}
override protected def dynamicJaasSections: Properties = {