Package org.apache.hadoop.security
Class ShellBasedUnixGroupsNetgroupMapping
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.security.ShellBasedUnixGroupsMapping
org.apache.hadoop.security.ShellBasedUnixGroupsNetgroupMapping
- All Implemented Interfaces:
Configurable,GroupMappingServiceProvider
@LimitedPrivate({"HDFS","MapReduce"})
@Evolving
public class ShellBasedUnixGroupsNetgroupMapping
extends ShellBasedUnixGroupsMapping
A simple shell-based implementation of
GroupMappingServiceProvider
that exec's the groups shell command to fetch the group
memberships of a given user.-
Field Summary
Fields inherited from interface org.apache.hadoop.security.GroupMappingServiceProvider
GROUP_MAPPING_CONFIG_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheGroupsAdd(List<String> groups) Add a group to cache, only netgroups are cachedvoidRefresh the netgroup cacheprotected StringexecShellGetUserForNetgroup(String netgroup) Calls shell to get users for a netgroup by calling getent netgroup, this is a low level function that just returns string thatGet unix groups (parent) and netgroups for given usergetUsersForNetgroup(String netgroup) Gets users for a netgroupMethods inherited from class org.apache.hadoop.security.ShellBasedUnixGroupsMapping
createGroupExecutor, createGroupIDExecutor, getGroupsForUserCommand, getGroupsIDForUserCommand, getGroupsSet, resolveFullGroupNames, setConfMethods inherited from class org.apache.hadoop.conf.Configured
getConf
-
Constructor Details
-
ShellBasedUnixGroupsNetgroupMapping
public ShellBasedUnixGroupsNetgroupMapping()
-
-
Method Details
-
getGroups
Get unix groups (parent) and netgroups for given user- Specified by:
getGroupsin interfaceGroupMappingServiceProvider- Overrides:
getGroupsin classShellBasedUnixGroupsMapping- Parameters:
user- get groups and netgroups for this user- Returns:
- groups and netgroups for user
- Throws:
IOException- raised on errors performing I/O.
-
cacheGroupsRefresh
Refresh the netgroup cache- Specified by:
cacheGroupsRefreshin interfaceGroupMappingServiceProvider- Overrides:
cacheGroupsRefreshin classShellBasedUnixGroupsMapping- Throws:
IOException- raised on errors performing I/O.
-
cacheGroupsAdd
Add a group to cache, only netgroups are cached- Specified by:
cacheGroupsAddin interfaceGroupMappingServiceProvider- Overrides:
cacheGroupsAddin classShellBasedUnixGroupsMapping- Parameters:
groups- list of group names to add to cache- Throws:
IOException- raised on errors performing I/O.
-
getUsersForNetgroup
Gets users for a netgroup- Parameters:
netgroup- return users for this netgroup- Returns:
- list of users for a given netgroup
- Throws:
IOException- raised on errors performing I/O.
-
execShellGetUserForNetgroup
Calls shell to get users for a netgroup by calling getent netgroup, this is a low level function that just returns string that- Parameters:
netgroup- get users for this netgroup- Returns:
- string of users for a given netgroup in getent netgroups format
- Throws:
IOException- raised on errors performing I/O.
-