feat(kafka): improve topic management and Kerberos auth

This commit is contained in:
zipg authored and GitHub committed 2026-07-09 11:41:22 +08:00
1 parent b31d52c00c
commit 1317301bcd
18 files changed
+1096 -81

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import type { MqAuth, MqSystemKind } from "@/types/mq";
export type MqAuthKind = MqAuth["kind"];
export type MqUiAuthKind = MqAuthKind | "kerberos";
const KAFKA_AUTH_KINDS = new Set<MqUiAuthKind>(["none", "basic", "kerberos"]);
export function isMqAuthKindAllowedForSystem(systemKind: MqSystemKind, authKind: MqUiAuthKind): boolean {
if (systemKind === "kafka") return KAFKA_AUTH_KINDS.has(authKind);
return authKind !== "kerberos";
}
export function detectMqUiAuthKind({ systemKind, authKind, saslMechanism, jaasConfig }: { systemKind: MqSystemKind; authKind?: MqAuthKind; saslMechanism: string; jaasConfig: string }): MqUiAuthKind {
if (systemKind === "kafka") {
if (saslMechanism.toUpperCase() === "GSSAPI" && jaasConfig.includes("Krb5LoginModule")) {
return "kerberos";
}
return authKind === "basic" ? "basic" : "none";
}
return authKind || "none";
}