pan3793 commented on code in PR #5710:
URL: https://github.com/apache/kyuubi/pull/5710#discussion_r1395923056
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -570,4 +572,45 @@ public static synchronized String getVersion() {
}
return KYUUBI_CLIENT_VERSION;
}
+
+ /**
+ * Method to get the password from the credential provider
+ *
+ * @param providerPath provider path
+ * @param key alias name
+ * @return password
+ */
+ private static String getPasswordFromCredentialProvider(String providerPath,
String key) {
+ try {
+ if (providerPath != null) {
+ Configuration conf = new Configuration();
+ conf.set("hadoop.security.credential.provider.path", providerPath);
+ char[] password = conf.getPassword(key);
+ if (password != null) {
+ return new String(password);
+ }
+ }
+ } catch (IOException exception) {
+ LOG.warn("Could not retrieve password for " + key, exception);
+ }
+ return null;
+ }
+
+ /**
+ * Method to get the password from the configuration map if available.
Otherwise, get it from the
+ * credential provider
+ *
+ * @param confMap configuration map
+ * @param key param
+ * @return password
+ */
+ public static String getPassword(Map<String, String> confMap, String key) {
+ String password = confMap.get(key);
+ if (password == null) {
Review Comment:
Use reflection to check if CredentialProvider class present
```suggestion
if (password == null && hadoopCredentialProviderAvailable) {
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]