@InterfaceAudience.Private public class UserProvider extends BaseConfigurable
User creation.| Constructor and Description |
|---|
UserProvider() |
| Modifier and Type | Method and Description |
|---|---|
User |
create(UserGroupInformation ugi)
Wraps an underlying
UserGroupInformation instance. |
User |
getCurrent() |
java.lang.String |
getCurrentUserName() |
static UserProvider |
instantiate(Configuration conf)
Instantiate the
UserProvider specified in the configuration and set the passed
configuration via BaseConfigurable.setConf(Configuration) |
boolean |
isHadoopSecurityEnabled() |
boolean |
isHBaseSecurityEnabled() |
void |
login(java.lang.String fileConfKey,
java.lang.String principalConfKey,
java.lang.String localhost)
Log in the current process using the given configuration keys for the credential file and login
principal.
|
static void |
setUserProviderForTesting(Configuration conf,
java.lang.Class<? extends UserProvider> provider)
Set the
UserProvider in the given configuration that should be instantiated |
getConf, setConfpublic static UserProvider instantiate(Configuration conf)
UserProvider specified in the configuration and set the passed
configuration via BaseConfigurable.setConf(Configuration)conf - to read and set on the created UserProviderUserProvider ready for use.public static void setUserProviderForTesting(Configuration conf,
java.lang.Class<? extends UserProvider> provider)
UserProvider in the given configuration that should be instantiatedconf - to updateprovider - class of the provider to setpublic java.lang.String getCurrentUserName()
throws java.io.IOException
java.io.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 java.io.IOException
java.io.IOException - if the user cannot be loadedpublic User create(UserGroupInformation ugi)
UserGroupInformation instance.ugi - The base Hadoop userpublic void login(java.lang.String fileConfKey,
java.lang.String principalConfKey,
java.lang.String localhost)
throws java.io.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 credentialsjava.io.IOException - underlying exception from SecurityUtil.login() call