@InterfaceAudience.Private public class UserProvider extends BaseConfigurable
User
creation.Modifier and Type | Field and Description |
---|---|
private static org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningExecutorService |
executor |
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<String,String[]> |
groupCache |
(package private) static org.apache.hadoop.security.Groups |
groups |
private static String |
USER_PROVIDER_CONF_KEY |
Constructor and Description |
---|
UserProvider() |
Modifier and Type | Method and Description |
---|---|
User |
create(org.apache.hadoop.security.UserGroupInformation ugi)
Wraps an underlying
UserGroupInformation instance. |
User |
getCurrent() |
String |
getCurrentUserName() |
static UserProvider |
instantiate(org.apache.hadoop.conf.Configuration conf)
Instantiate the
UserProvider specified in the configuration and set the passed
configuration via setConf(Configuration) |
boolean |
isHadoopSecurityEnabled() |
boolean |
isHBaseSecurityEnabled() |
void |
login(String fileConfKey,
String principalConfKey,
String localhost)
Log in the current process using the given configuration keys for the credential file and login
principal.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
static void |
setUserProviderForTesting(org.apache.hadoop.conf.Configuration conf,
Class<? extends UserProvider> provider)
Set the
UserProvider in the given configuration that should be instantiated |
getConf
private static final String USER_PROVIDER_CONF_KEY
private static final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningExecutorService executor
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<String,String[]> groupCache
static org.apache.hadoop.security.Groups groups
public UserProvider()
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
setConf
in class BaseConfigurable
public static UserProvider instantiate(org.apache.hadoop.conf.Configuration conf)
UserProvider
specified in the configuration and set the passed
configuration via setConf(Configuration)
conf
- to read and set on the created UserProvider
UserProvider
ready for use.public static void setUserProviderForTesting(org.apache.hadoop.conf.Configuration conf, Class<? extends UserProvider> provider)
UserProvider
in the given configuration that should be instantiatedconf
- to updateprovider
- class of the provider to setpublic String getCurrentUserName() throws IOException
IOException
- if the underlying user cannot be obtainedpublic boolean isHBaseSecurityEnabled()
public boolean isHadoopSecurityEnabled()
false
. For secure Hadoop, it will return the value
from UserGroupInformation.isSecurityEnabled()
.public User getCurrent() throws IOException
IOException
- if the user cannot be loadedpublic User create(org.apache.hadoop.security.UserGroupInformation ugi)
UserGroupInformation
instance.ugi
- The base Hadoop userpublic void login(String fileConfKey, String principalConfKey, String localhost) throws IOException
This is only applicable when running on secure Hadoop -- see org.apache.hadoop.security.SecurityUtil#login(Configuration,String,String,String). On regular Hadoop (without security features), this will safely be ignored.
fileConfKey
- Property key used to configure path to the credential fileprincipalConfKey
- Property key used to configure login principallocalhost
- Current hostname to use in any credentialsIOException
- underlying exception from SecurityUtil.login() callCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.