HBASE-12045 REST proxy users configuration in hbase-site.xml is ignored (Aditya Kishore)

This commit is contained in:
Andrew Purtell 2014-09-22 17:37:19 -07:00
parent 0153a353b2
commit 411991cf1d
2 changed files with 10 additions and 1 deletions

View File

@ -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) {

View File

@ -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();