Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9BFA81129E for ; Tue, 26 Aug 2014 18:44:18 +0000 (UTC) Received: (qmail 81769 invoked by uid 500); 26 Aug 2014 18:44:18 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 81726 invoked by uid 500); 26 Aug 2014 18:44:18 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 81715 invoked by uid 99); 26 Aug 2014 18:44:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Aug 2014 18:44:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Aug 2014 18:44:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DE3AC2388999; Tue, 26 Aug 2014 18:43:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1620689 - in /hive/trunk/service/src/java/org/apache/hive/service/cli: CLIService.java thrift/ThriftCLIService.java Date: Tue, 26 Aug 2014 18:43:56 -0000 To: commits@hive.apache.org From: vgumashta@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140826184356.DE3AC2388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vgumashta Date: Tue Aug 26 18:43:56 2014 New Revision: 1620689 URL: http://svn.apache.org/r1620689 Log: HIVE-7764: Support all JDBC-HiveServer2 authentication modes on a secure cluster (Vaibhav Gumashta reviewed by Thejas Nair) Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/CLIService.java hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/CLIService.java URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/CLIService.java?rev=1620689&r1=1620688&r2=1620689&view=diff ============================================================================== --- hive/trunk/service/src/java/org/apache/hive/service/cli/CLIService.java (original) +++ hive/trunk/service/src/java/org/apache/hive/service/cli/CLIService.java Tue Aug 26 18:43:56 2014 @@ -46,7 +46,6 @@ import org.apache.hive.service.Composite import org.apache.hive.service.ServiceException; import org.apache.hive.service.auth.HiveAuthFactory; import org.apache.hive.service.cli.operation.Operation; -import org.apache.hive.service.cli.session.HiveSession; import org.apache.hive.service.cli.session.SessionManager; import org.apache.hive.service.cli.thrift.TProtocolVersion; @@ -80,11 +79,8 @@ public class CLIService extends Composit this.hiveConf = hiveConf; sessionManager = new SessionManager(); addService(sessionManager); - /** - * If auth mode is Kerberos, do a kerberos login for the service from the keytab - */ - if (hiveConf.getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION).equalsIgnoreCase( - HiveAuthFactory.AuthTypes.KERBEROS.toString())) { + // If the hadoop cluster is secure, do a kerberos login for the service from the keytab + if (ShimLoader.getHadoopShims().isSecurityEnabled()) { try { HiveAuthFactory.loginFromKeytab(hiveConf); this.serviceUGI = ShimLoader.getHadoopShims().getUGIForConf(hiveConf); Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java?rev=1620689&r1=1620688&r2=1620689&view=diff ============================================================================== --- hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java (original) +++ hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java Tue Aug 26 18:43:56 2014 @@ -29,7 +29,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; -import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hive.service.AbstractService; import org.apache.hive.service.auth.HiveAuthFactory; import org.apache.hive.service.auth.TSetIpAddressProcessor; @@ -242,7 +241,9 @@ public abstract class ThriftCLIService e if (userName == null) { userName = req.getUsername(); } - return getProxyUser(userName, req.getConfiguration(), getIpAddress()); + String effectiveClientUser = getProxyUser(userName, req.getConfiguration(), getIpAddress()); + LOG.debug("Client's username: " + effectiveClientUser); + return effectiveClientUser; } /**