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 void
assignRole(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 roleString
getName()
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 rolevoid
setName(String name)
Set the role mapper application nameString
toString()
void
unassignPrincipalFromRole(Role role, Principal principal)
Remove the given role-principal mappingvoid
unassignRole(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:
getName
in interfaceSecurityRoleMapper
- Returns:
- The application/module name for this RoleMapper
-
setName
public void setName(String name)
Description copied from interface:SecurityRoleMapper
Set the role mapper application name- Specified by:
setName
in interfaceSecurityRoleMapper
- Parameters:
name
- The application/module name
-
unassignPrincipalFromRole
public void unassignPrincipalFromRole(Role role, Principal principal)
Remove the given role-principal mapping- Specified by:
unassignPrincipalFromRole
in interfaceSecurityRoleMapper
- Parameters:
role
- , Role objectprincipal
- , the principal
-
getRoleToSubjectMapping
public Map<String,Subject> getRoleToSubjectMapping()
Returns the RoleToSubjectMapping for the RoleMapping- Specified by:
getRoleToSubjectMapping
in 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:
assignRole
in 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:
getRoles
in 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:
getGroupsAssignedTo
in 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:
getUsersAssignedTo
in interfaceSecurityRoleMapper
- Parameters:
The
- Role to which the principals are assigned to.
-
unassignRole
public void unassignRole(Role r)
Description copied from interface:SecurityRoleMapper
Remove all the role mapping information for this role- Specified by:
unassignRole
in interfaceSecurityRoleMapper
- Parameters:
r
- , the role object
-
-