org.apache.hadoop.security
Class ShellBasedUnixGroupsNetgroupMapping

java.lang.Object
  extended by org.apache.hadoop.security.ShellBasedUnixGroupsMapping
      extended by org.apache.hadoop.security.ShellBasedUnixGroupsNetgroupMapping

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
protected static Map<String,Set<String>> netgroupToUsersMap
           
protected static boolean netgroupToUsersMapUpdated
           
protected static Map<String,Set<String>> userToNetgroupsMap
           
 
Constructor Summary
ShellBasedUnixGroupsNetgroupMapping()
           
 
Method Summary
 void cacheGroupsAdd(List<String> groups)
          Caches the group user information
 void cacheGroupsRefresh()
          Refresh the cache of groups and user mapping
protected  void cacheNetgroup(String group)
           
protected  String execShellGetUnixGroups(String user)
           
protected  String execShellGetUserForNetgroup(String netgroup)
           
 List<String> getGroups(String user)
          Get all various group memberships of a given user.
protected  void getNetgroups(String user, List<String> groups)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

netgroupToUsersMapUpdated

protected static boolean netgroupToUsersMapUpdated

netgroupToUsersMap

protected static Map<String,Set<String>> netgroupToUsersMap

userToNetgroupsMap

protected static Map<String,Set<String>> userToNetgroupsMap
Constructor Detail

ShellBasedUnixGroupsNetgroupMapping

public ShellBasedUnixGroupsNetgroupMapping()
Method Detail

getGroups

public List<String> getGroups(String user)
                       throws IOException
Get all various group memberships of a given user. Returns EMPTY list in case of non-existing user

Overrides:
getGroups in class ShellBasedUnixGroupsMapping
Parameters:
user - User's name
Returns:
group memberships of user
Throws:
IOException

cacheGroupsRefresh

public void cacheGroupsRefresh()
                        throws IOException
Refresh the cache of groups and user mapping

Overrides:
cacheGroupsRefresh in class ShellBasedUnixGroupsMapping
Throws:
IOException

cacheGroupsAdd

public void cacheGroupsAdd(List<String> groups)
                    throws IOException
Caches the group user information

Overrides:
cacheGroupsAdd in class ShellBasedUnixGroupsMapping
Parameters:
groups - list of groups to add to cache
Throws:
IOException

cacheNetgroup

protected void cacheNetgroup(String group)
                      throws IOException
Throws:
IOException

getNetgroups

protected void getNetgroups(String user,
                            List<String> groups)
                     throws IOException
Throws:
IOException

execShellGetUnixGroups

protected String execShellGetUnixGroups(String user)
                                 throws IOException
Throws:
IOException

execShellGetUserForNetgroup

protected String execShellGetUserForNetgroup(String netgroup)
                                      throws IOException
Throws:
IOException


Copyright © 2009 The Apache Software Foundation