Package com.sun.enterprise.security.acl
Class RoleMapper
- java.lang.Object
-
- com.sun.enterprise.security.acl.RoleMapper
-
- All Implemented Interfaces:
Serializable,SecurityRoleMapper
public class RoleMapper extends Object implements Serializable, SecurityRoleMapper
This class maintains a mapping of users and groups to application specific roles.Using this class the mapping information can be maintained and queried at a later time.
- Author:
- Harpreet Singh
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RoleMapper(RoleMapper r)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassignRole(Principal p, Role r, RootDeploymentDescriptor rdd)Assigns a Principal to the specified role.Enumeration<Group>getGroupsAssignedTo(Role r)Returns an enumeration of Groups assigned to the given roleStringgetName()Iterator<String>getRoles()Returns an enumeration of roles for this rolemapper.Map<String,Subject>getRoleToSubjectMapping()Returns the RoleToSubjectMapping for the RoleMappingEnumeration<Principal>getUsersAssignedTo(Role r)Returns an enumeration of Principals assigned to the given rolevoidsetName(String name)Set the role mapper application nameStringtoString()voidunassignPrincipalFromRole(Role role, Principal principal)Remove the given role-principal mappingvoidunassignRole(Role r)Remove all the role mapping information for this role
-
-
-
Constructor Detail
-
RoleMapper
public RoleMapper(RoleMapper r)
Copy constructor. This is called from the JSR88 implementation. This is not stored into the internal rolemapper maps.
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceSecurityRoleMapper- Returns:
- The application/module name for this RoleMapper
-
setName
public void setName(String name)
Description copied from interface:SecurityRoleMapperSet the role mapper application name- Specified by:
setNamein interfaceSecurityRoleMapper- Parameters:
name- The application/module name
-
unassignPrincipalFromRole
public void unassignPrincipalFromRole(Role role, Principal principal)
Remove the given role-principal mapping- Specified by:
unassignPrincipalFromRolein interfaceSecurityRoleMapper- Parameters:
role- , Role objectprincipal- , the principal
-
getRoleToSubjectMapping
public Map<String,Subject> getRoleToSubjectMapping()
Returns the RoleToSubjectMapping for the RoleMapping- Specified by:
getRoleToSubjectMappingin interfaceSecurityRoleMapper- Returns:
- Map of role->subject mapping
-
assignRole
public void assignRole(Principal p, Role r, RootDeploymentDescriptor rdd)
Assigns a Principal to the specified role. This method delegates work to internalAssignRole() after checking for conflicts. RootDeploymentDescriptor added as a fix for: https://glassfish.dev.java.net/issues/show_bug.cgi?id=2475 The first time this is called, a new Mapping object is created to store the role mapping information. When called again from a different module, the old mapping information is checked and stored and a new Mapping object is created.- Specified by:
assignRolein interfaceSecurityRoleMapper- Parameters:
p- The principal that needs to be assigned to the role.r- The Role the principal is being assigned to.rdd- The descriptor of the module containing the role mapping
-
getRoles
public Iterator<String> getRoles()
Returns an enumeration of roles for this rolemapper.- Specified by:
getRolesin interfaceSecurityRoleMapper- Returns:
- an iterator on all the assigned roles
-
getGroupsAssignedTo
public Enumeration<Group> getGroupsAssignedTo(Role r)
Returns an enumeration of Groups assigned to the given role- Specified by:
getGroupsAssignedToin interfaceSecurityRoleMapper- Parameters:
The- Role to which the groups are assigned to.
-
getUsersAssignedTo
public Enumeration<Principal> getUsersAssignedTo(Role r)
Returns an enumeration of Principals assigned to the given role- Specified by:
getUsersAssignedToin interfaceSecurityRoleMapper- Parameters:
The- Role to which the principals are assigned to.
-
unassignRole
public void unassignRole(Role r)
Description copied from interface:SecurityRoleMapperRemove all the role mapping information for this role- Specified by:
unassignRolein interfaceSecurityRoleMapper- Parameters:
r- , the role object
-
-