Package org.apache.hadoop.hbase.security
Class User.SecureHadoopUser
java.lang.Object
org.apache.hadoop.hbase.security.User
org.apache.hadoop.hbase.security.User.SecureHadoopUser
- Enclosing class:
- User
Bridges
User
invocations to underlying calls to
UserGroupInformation
for secure Hadoop 0.20 and versions
0.21 and above.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.security.User
User.SecureHadoopUser, User.TestingGroups
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
private final String
Cache value of this instance'stoString()
value.Fields inherited from class org.apache.hadoop.hbase.security.User
HBASE_SECURITY_AUTHORIZATION_CONF_KEY, HBASE_SECURITY_CONF_KEY, ugi
-
Constructor Summary
ConstructorDescriptionSecureHadoopUser
(org.apache.hadoop.security.UserGroupInformation ugi) SecureHadoopUser
(org.apache.hadoop.security.UserGroupInformation ugi, org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<String, String[]> cache) -
Method Summary
Modifier and TypeMethodDescriptionstatic User
createUserForTesting
(org.apache.hadoop.conf.Configuration conf, String name, String[] groups) Create a user for testing.String[]
Returns the list of groups of which this user is a member.Returns the shortened version of the user name -- the portion that maps to an operating system user name.static boolean
Returns the result ofUserGroupInformation.isSecurityEnabled()
.static void
Login through configured keytab and pricipal.static void
login
(org.apache.hadoop.conf.Configuration conf, String fileConfKey, String principalConfKey, String localhost) Obtain credentials for the current process using the configured Kerberos keytab file and principal.<T> T
runAs
(PrivilegedAction<T> action) Executes the given action within the context of this user.<T> T
runAs
(PrivilegedExceptionAction<T> action) Executes the given action within the context of this user.toString()
Methods inherited from class org.apache.hadoop.hbase.security.User
addToken, create, equals, getCurrent, getName, getToken, getTokens, getUGI, hashCode, isHBaseSecurityEnabled, isLoginFromKeytab, runAsLoginUser, shouldLoginFromKeytab
-
Field Details
-
shortName
-
cache
-
toString
Cache value of this instance'stoString()
value. Computing this value is expensive. Assumes the UGI is never updated. See HBASE-27708.
-
-
Constructor Details
-
SecureHadoopUser
- Throws:
IOException
-
SecureHadoopUser
-
SecureHadoopUser
public SecureHadoopUser(org.apache.hadoop.security.UserGroupInformation ugi, org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<String, String[]> cache)
-
-
Method Details
-
getShortName
Description copied from class:User
Returns the shortened version of the user name -- the portion that maps to an operating system user name.- Specified by:
getShortName
in classUser
- Returns:
- Short name
-
getGroupNames
Description copied from class:User
Returns the list of groups of which this user is a member. On secure Hadoop this returns the group information for the user as resolved on the server. For 0.20 based Hadoop, the group names are passed from the client.- Overrides:
getGroupNames
in classUser
-
runAs
Description copied from class:User
Executes the given action within the context of this user. -
runAs
Description copied from class:User
Executes the given action within the context of this user.- Specified by:
runAs
in classUser
- Throws:
IOException
InterruptedException
-
toString
-
createUserForTesting
public static User createUserForTesting(org.apache.hadoop.conf.Configuration conf, String name, String[] groups) Create a user for testing. -
login
public static void login(org.apache.hadoop.conf.Configuration conf, String fileConfKey, String principalConfKey, String localhost) throws IOException Obtain credentials for the current process using the configured Kerberos keytab file and principal.- Parameters:
conf
- the Configuration to usefileConfKey
- Configuration property key used to store the path to the keytab fileprincipalConfKey
- Configuration property key used to store the principal name to login aslocalhost
- the local hostname- Throws:
IOException
- See Also:
-
login
Login through configured keytab and pricipal.- Parameters:
keytabLocation
- location of keytabprincipalName
- principal in keytab- Throws:
IOException
- exception from UserGroupInformation.loginUserFromKeytab
-
isSecurityEnabled
Returns the result ofUserGroupInformation.isSecurityEnabled()
.
-