Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(kafka): upgrade 3.9 client for SASL authentication on newer JDKs

t8y233f212a452e8
diff --git a/agents/drivers/kafka/build.gradle b/agents/drivers/kafka/build.gradle
index cbea97ab7d..4c854c47ce 100644
--- a/agents/drivers/kafka/build.gradle
+++ b/agents/drivers/kafka/build.gradle
@@ -1,6 +1,6 @@
dependencies {
implementation 'com.google.code.gson:gson:2.12.1'
- implementation 'org.apache.kafka:kafka-clients:3.9.0'
+ implementation 'org.apache.kafka:kafka-clients:3.9.1'
implementation('org.apache.zookeeper:zookeeper:3.8.4') {
exclude group: 'log4j', module: 'log4j'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
diff --git a/agents/drivers/kafka/src/test/java/com/dbx/agent/kafka/KafkaClientCompatibilityTest.java b/agents/drivers/kafka/src/test/java/com/dbx/agent/kafka/KafkaClientCompatibilityTest.java
new file mode 100644
index 0000000000..7043e53bba
--- /dev/null
+++ b/agents/drivers/kafka/src/test/java/com/dbx/agent/kafka/KafkaClientCompatibilityTest.java
@@ -0,0 +1,40 @@
+package com.dbx.agent.kafka;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.List;
+import java.util.Map;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import org.apache.kafka.common.internals.SecurityManagerCompatibility;
+import org.apache.kafka.common.security.authenticator.SaslClientCallbackHandler;
+import org.junit.jupiter.api.Test;
+
+class KafkaClientCompatibilityTest {
+ @Test
+ void passwordSaslCallbacksUseTheCurrentSubject() {
+ // KAFKA-17078 routes Subject access through this shim when newer JDKs
+ // disable the legacy Subject.getSubject API.
+ Subject subject = new Subject();
+ subject.getPublicCredentials().add("dbx-user");
+ subject.getPrivateCredentials().add("dbx-password");
+
+ for (String mechanism : List.of("PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512")) {
+ SaslClientCallbackHandler handler = new SaslClientCallbackHandler();
+ handler.configure(Map.of(), mechanism, List.of());
+ NameCallback name = new NameCallback("username");
+ PasswordCallback password = new PasswordCallback("password", false);
+
+ assertDoesNotThrow(() -> SecurityManagerCompatibility.get().callAs(subject, () -> {
+ handler.handle(new Callback[] { name, password });
+ return null;
+ }));
+ assertEquals("dbx-user", name.getName());
+ assertArrayEquals("dbx-password".toCharArray(), password.getPassword());
+ }
+ }
+}