From 062cd08c77254c6f7027f625bb58329f02fee1d7 Mon Sep 17 00:00:00 2001 From: madlnu Date: Fri, 13 Sep 2024 03:10:40 +0530 Subject: [PATCH] KYUUBI #6689 [FEATURE] Extract kyuubiClientPrincipal/kyuubiClientKeytab/kyuubiServerPrincipal/Principal from JDBC connection properties --- .../org/apache/kyuubi/jdbc/hive/Utils.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java index b9f256f69bf..633c21e6595 100644 --- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java +++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java @@ -348,6 +348,36 @@ public static JdbcConnectionParams extractURLComponents(String uri, Properties i } } + if (!connParams.getSessionVars().containsKey(AUTH_KYUUBI_CLIENT_PRINCIPAL)) { + if (info.containsKey(AUTH_KYUUBI_CLIENT_PRINCIPAL)) { + connParams + .getSessionVars() + .put(AUTH_KYUUBI_CLIENT_PRINCIPAL, info.getProperty(AUTH_KYUUBI_CLIENT_PRINCIPAL)); + } + } + + if (!connParams.getSessionVars().containsKey(AUTH_KYUUBI_CLIENT_KEYTAB)) { + if (info.containsKey(AUTH_KYUUBI_CLIENT_KEYTAB)) { + connParams + .getSessionVars() + .put(AUTH_KYUUBI_CLIENT_KEYTAB, info.getProperty(AUTH_KYUUBI_CLIENT_KEYTAB)); + } + } + + if (!connParams.getSessionVars().containsKey(AUTH_KYUUBI_SERVER_PRINCIPAL)) { + if (info.containsKey(AUTH_KYUUBI_SERVER_PRINCIPAL)) { + connParams + .getSessionVars() + .put(AUTH_KYUUBI_SERVER_PRINCIPAL, info.getProperty(AUTH_KYUUBI_SERVER_PRINCIPAL)); + } + } + + if (!connParams.getSessionVars().containsKey(AUTH_PRINCIPAL)) { + if (info.containsKey(AUTH_PRINCIPAL)) { + connParams.getSessionVars().put(AUTH_PRINCIPAL, info.getProperty(AUTH_PRINCIPAL)); + } + } + if (info.containsKey(AUTH_TYPE)) { connParams.getSessionVars().put(AUTH_TYPE, info.getProperty(AUTH_TYPE)); }