hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [6/9] git commit: HBASE-12045 REST proxy users configuration in hbase-site.xml is ignored (Aditya Kishore)
Date Tue, 23 Sep 2014 00:37:42 GMT
HBASE-12045 REST proxy users configuration in hbase-site.xml is ignored (Aditya Kishore)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/07d2f160
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/07d2f160
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/07d2f160

Branch: refs/heads/branch-1
Commit: 07d2f160b20c6f2f75ebf4ca6c3a691b8f4d585a
Parents: 10afd11
Author: Andrew Purtell <apurtell@apache.org>
Authored: Mon Sep 22 17:37:17 2014 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon Sep 22 17:37:17 2014 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/rest/RESTServlet.java | 9 +++++++++
 .../org/apache/hadoop/hbase/rest/RESTServletContainer.java  | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/07d2f160/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
index 5e7038d..5439cde 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServlet.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.filter.ParseFilter;
 import org.apache.hadoop.hbase.security.UserProvider;
 import org.apache.hadoop.hbase.util.ConnectionCache;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authorize.ProxyUsers;
 import org.apache.log4j.Logger;
 
 /**
@@ -44,6 +45,7 @@ public class RESTServlet implements Constants {
 
   static final String CLEANUP_INTERVAL = "hbase.rest.connection.cleanup-interval";
   static final String MAX_IDLETIME = "hbase.rest.connection.max-idletime";
+  static final String HBASE_REST_SUPPORT_PROXYUSER = "hbase.rest.support.proxyuser";
 
   UserGroupInformation getRealUser() {
     return realUser;
@@ -91,6 +93,9 @@ public class RESTServlet implements Constants {
     int maxIdleTime = conf.getInt(MAX_IDLETIME, 10 * 60 * 1000);
     connectionCache = new ConnectionCache(
       conf, userProvider, cleanInterval, maxIdleTime);
+    if (supportsProxyuser()) {
+      ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
+    }
   }
 
   HBaseAdmin getAdmin() throws IOException {
@@ -125,6 +130,10 @@ public class RESTServlet implements Constants {
     connectionCache.setEffectiveUser(effectiveUser);
   }
 
+  boolean supportsProxyuser() {
+    return conf.getBoolean(HBASE_REST_SUPPORT_PROXYUSER, false);
+  }
+
   private void registerCustomFilter(Configuration conf) {
     String[] filterList = conf.getStrings(Constants.CUSTOM_FILTERS);
     if (filterList != null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/07d2f160/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
index c2f4e59..2c859bd 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
@@ -53,7 +53,7 @@ public class RESTServletContainer extends ServletContainer {
     RESTServlet servlet = RESTServlet.getInstance();
     if (doAsUserFromQuery != null) {
       Configuration conf = servlet.getConfiguration();
-      if (!conf.getBoolean("hbase.rest.support.proxyuser", false)) {
+      if (!servlet.supportsProxyuser()) {
         throw new ServletException("Support for proxyuser is not configured");
       }
       UserGroupInformation ugi = servlet.getRealUser();


Mime
View raw message