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
This commit is contained in:
parent
11b7da45ec
commit
4bfc15f2b9
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue