浏览代码

AMBARI-16868. Insert Statement in Hive View is giving error in Kerberised cluster.(Gaurav Nagar via pallavkul)

Pallav Kulshreshtha 9 年之前
父节点
当前提交
41813bc011
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. 14 14
      contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/ConnectionFactory.java

+ 14 - 14
contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/ConnectionFactory.java

@@ -129,22 +129,22 @@ public class ConnectionFactory implements UserLocalFactory<Connection> {
     return params;
   }
 
-  private Map<String,String> getDefaultAuthParams(){
-    Map<String,String> params = new HashMap<String,String>();
-    String auth = getProperty(HIVE_SITE,HIVE_SERVER2_AUTHENTICATION);
-    params.put("auth",auth);
-
-    if(auth.equalsIgnoreCase("KERBEROS")){
-      params.put("principal",getProperty(HIVE_SITE,HIVE_SERVER2_KERBEROS_PRINCIPAL));
-      params.put(Utils.HiveAuthenticationParams.HS2_PROXY_USER,"${username}");
-    } else if(auth.equalsIgnoreCase("LDAP") || auth.equalsIgnoreCase("CUSTOM")){
-      params.put("auth","NONE");
-      params.put("password","${ask_password}");
+  private Map<String, String> getDefaultAuthParams() {
+    Map<String, String> params = new HashMap<String, String>();
+    String auth = getProperty(HIVE_SITE, HIVE_SERVER2_AUTHENTICATION);
+    params.put("auth", auth);
+
+    if (auth.equalsIgnoreCase("KERBEROS")) {
+      params.put("principal", getProperty(HIVE_SITE, HIVE_SERVER2_KERBEROS_PRINCIPAL));
+      params.put(Utils.HiveAuthenticationParams.HS2_PROXY_USER, context.getUsername());
+    } else if (auth.equalsIgnoreCase("LDAP") || auth.equalsIgnoreCase("CUSTOM")) {
+      params.put("auth", "NONE");
+      params.put("password", "${ask_password}");
     }
 
-    String qop = getProperty(HIVE_SITE,HIVE_SASL_QOP);
-    if(qop != null && !qop.equals("auth")){
-      params.put(Utils.HiveAuthenticationParams.AUTH_QOP,qop);
+    String qop = getProperty(HIVE_SITE, HIVE_SASL_QOP);
+    if (qop != null && !qop.equals("auth")) {
+      params.put(Utils.HiveAuthenticationParams.AUTH_QOP, qop);
     }
     return params;
   }