Package org.apache.drill.exec.util
Class ImpersonationUtil
java.lang.Object
org.apache.drill.exec.util.ImpersonationUtil
Utilities for impersonation purpose.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DrillFileSystemcreateFileSystem(String proxyUserName, org.apache.hadoop.conf.Configuration fsConf) Create DrillFileSystem for given proxyUserName and configuration.static org.apache.hadoop.security.UserGroupInformationcreateProxyUgi(String proxyUserName) Create and return proxy userUserGroupInformationfor given user name.static org.apache.hadoop.security.UserGroupInformationcreateProxyUgi(String opUserName, String queryUserName) Create and return proxy userUserGroupInformationof operator owner if operator owner is valid.static String[]Return the list of groups to which the process user belongs.static StringReturn the name of the user who is running the Drillbit.static org.apache.hadoop.security.UserGroupInformationReturn theUserGroupInformationof user who is running the Drillbit.static booleanhasAdminPrivileges(String userName, String adminUsers, String adminGroups) Given admin user/group list, finds whether the given username has admin privileges.static StringresolveUserName(String userName) If the given user name is empty, return the current process user name.
-
Method Details
-
createProxyUgi
public static org.apache.hadoop.security.UserGroupInformation createProxyUgi(String opUserName, String queryUserName) Create and return proxy userUserGroupInformationof operator owner if operator owner is valid. Otherwise create and return proxy userUserGroupInformationfor query user.- Parameters:
opUserName- Name of the user whom to impersonate while setting up the operator.queryUserName- Name of the user who issues the query. If opUserName is invalid, then this parameter must be valid user name.
-
createProxyUgi
Create and return proxy userUserGroupInformationfor given user name.- Parameters:
proxyUserName- Proxy user name (must be valid)
-
resolveUserName
If the given user name is empty, return the current process user name. This is a temporary change to avoid modifying long list of tests files which have GroupScan operator with no user name property.- Parameters:
userName- User name found in GroupScan POP definition.
-
getProcessUserName
Return the name of the user who is running the Drillbit.- Returns:
- Drillbit process user.
-
getProcessUserGroupNames
Return the list of groups to which the process user belongs.- Returns:
- Drillbit process user group names
-
getProcessUserUGI
public static org.apache.hadoop.security.UserGroupInformation getProcessUserUGI()Return theUserGroupInformationof user who is running the Drillbit.- Returns:
- Drillbit process user
UserGroupInformation.
-
createFileSystem
public static DrillFileSystem createFileSystem(String proxyUserName, org.apache.hadoop.conf.Configuration fsConf) Create DrillFileSystem for given proxyUserName and configuration.- Parameters:
proxyUserName- Name of the user whom to impersonate while accessing the FileSystem contents.fsConf- FileSystem configuration.
-
hasAdminPrivileges
Given admin user/group list, finds whether the given username has admin privileges.- Parameters:
userName- User who is checked for administrative privileges.adminUsers- Comma separated list of admin usernames,adminGroups- Comma separated list of admin usergroups- Returns:
- True if the user has admin priveleges. False otherwise.
-