From 4bfc15f2b9f9dd11baaaa887530b40f8a5fb1c65 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 15 Aug 2013 19:07:46 +0000 Subject: [PATCH] HBASE-9227 RESTServer should handle the loginUser correctly git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1514440 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/hadoop/hbase/rest/RESTServer.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java index 231ba2c7e19..f0e5d9c148a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java @@ -101,16 +101,13 @@ public class RESTServer implements Constants { String principalConfig = conf.get(REST_KERBEROS_PRINCIPAL); Preconditions.checkArgument(principalConfig != null && !principalConfig.isEmpty(), REST_KERBEROS_PRINCIPAL + " should be set if security is enabled"); - String principalName = SecurityUtil.getServerPrincipal(principalConfig, machineName); - UserGroupInformation loginUser = - UserGroupInformation.loginUserFromKeytabAndReturnUGI( - principalName, keytabFilename); + User.login(conf, REST_KEYTAB_FILE, REST_KERBEROS_PRINCIPAL, machineName); + realUser = User.getCurrent().getUGI(); if (conf.get(REST_AUTHENTICATION_TYPE) != null) { containerClass = RESTServletContainer.class; authFilter = new FilterHolder(); authFilter.setClassName(AuthFilter.class.getName()); authFilter.setName("AuthenticationFilter"); - realUser = loginUser; } }