Author: prasadm
Date: Fri Mar 21 19:14:25 2014
New Revision: 1580023
URL: http://svn.apache.org/r1580023
Log:
HIVE-6625: HiveServer2 running in http mode should support trusted proxy access
(Vaibhav Gumashta via Prasad Mujumdar)
Modified:
hive/branches/branch-0.13/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
Modified:
hive/branches/branch-0.13/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
URL:
http://svn.apache.org/viewvc/hive/branches/branch-0.13/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java?rev=1580023&r1=1580022&r2=1580023&view=diff
==============================================================================
---
hive/branches/branch-0.13/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
(original)
+++
hive/branches/branch-0.13/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
Fri Mar 21 19:14:25 2014
@@ -42,6 +42,7 @@ import org.apache.hive.service.cli.Opera
import org.apache.hive.service.cli.RowSet;
import org.apache.hive.service.cli.SessionHandle;
import org.apache.hive.service.cli.TableSchema;
+import org.apache.hive.service.cli.session.SessionManager;
import org.apache.thrift.TException;
import org.apache.thrift.server.TServer;
@@ -208,11 +209,19 @@ public abstract class ThriftCLIService e
private String getUserName(TOpenSessionReq req) throws HiveSQLException {
String userName = null;
+ // Kerberos
if (hiveAuthFactory != null) {
- userName = hiveAuthFactory.getRemoteUser(); // kerberos
+ userName = hiveAuthFactory.getRemoteUser();
}
+ // Except kerberos, NOSASL
if (userName == null) {
- userName = TSetIpAddressProcessor.getUserName(); // except kerberos,
nosasl
+ userName = TSetIpAddressProcessor.getUserName();
+ }
+ // Http transport mode.
+ // We set the thread local username, in ThriftHttpServlet.
+ if (cliService.getHiveConf().getVar(
+ ConfVars.HIVE_SERVER2_TRANSPORT_MODE).equalsIgnoreCase("http")) {
+ userName = SessionManager.getUserName();
}
if (userName == null) {
userName = req.getUsername();