diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 5c1b283..b963de7 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -708,7 +708,7 @@ // HiveServer2 auth configuration - HIVE_SERVER2_AUTHENTICATION("hive.server2.authentication", "NONE"), + HIVE_SERVER2_AUTHENTICATION("hive.server2.authentication", "PLAINSASL"), HIVE_SERVER2_KERBEROS_KEYTAB("hive.server2.authentication.kerberos.keytab", ""), HIVE_SERVER2_KERBEROS_PRINCIPAL("hive.server2.authentication.kerberos.principal", ""), HIVE_SERVER2_PLAIN_LDAP_URL("hive.server2.authentication.ldap.url", null), diff --git conf/hive-default.xml.template conf/hive-default.xml.template index 6d2526c..6f9f5b1 100644 --- conf/hive-default.xml.template +++ conf/hive-default.xml.template @@ -1806,6 +1806,7 @@ Client authentication types. NONE: no authentication check + PLAINSASL: User/password based authentication LDAP: LDAP/AD based authentication KERBEROS: Kerberos/GSSAPI authentication CUSTOM: Custom authentication provider diff --git jdbc/build.xml jdbc/build.xml index 45100a1..315a846 100644 --- jdbc/build.xml +++ jdbc/build.xml @@ -33,11 +33,25 @@ - + + + + + + + + + + + + sessConf ) - throws SQLException { + private void openTransport(String uri, String host, int port, Map sessConf) + throws SQLException { transport = new TSocket(host, port); - // handle secure connection if specified - if (!sessConf.containsKey(HIVE_AUTH_TYPE) - || !sessConf.get(HIVE_AUTH_TYPE).equals(HIVE_AUTH_SIMPLE)){ + // Default behavior is to use a plain SASL transport unless otherwise specified. + if (! sessConf.containsKey(HIVE_AUTH_TYPE) + || ! sessConf.get(HIVE_AUTH_TYPE).equalsIgnoreCase(HIVE_AUTH_NONE)) { try { - if (sessConf.containsKey(HIVE_AUTH_PRINCIPAL)) { + if (sessConf.containsKey(HIVE_KERBEROS_PRINCIPAL)) { transport = KerberosSaslHelper.getKerberosTransport( - sessConf.get(HIVE_AUTH_PRINCIPAL), host, transport); + sessConf.get(HIVE_KERBEROS_PRINCIPAL), host, transport); } else { - String userName = sessConf.get(HIVE_AUTH_USER); + String userName = sessConf.get(HIVE_PLAIN_USER); if ((userName == null) || userName.isEmpty()) { userName = HIVE_ANONYMOUS_USER; } - String passwd = sessConf.get(HIVE_AUTH_PASSWD); + String passwd = sessConf.get(HIVE_PLAIN_PASSWD); if ((passwd == null) || passwd.isEmpty()) { passwd = HIVE_ANONYMOUS_PASSWD; } @@ -146,7 +148,7 @@ private void openTransport(String uri, String host, int port, Map