org.restlet.security
Class MemoryRealm

java.lang.Object
  extended by org.restlet.security.Realm
      extended by org.restlet.security.MemoryRealm

public class MemoryRealm
extends Realm

Security realm based on a memory model. The model is composed of root groups, users and mapping to associated roles.

Author:
Jerome Louvel

Constructor Summary
MemoryRealm()
          Constructor.
 
Method Summary
 Set<Group> findGroups(User user)
          Finds the set of groups where a given user is a member.
 Set<Group> findGroups(User user, boolean inheritOnly)
          Finds the set of groups where a given user is a member.
 Set<Role> findRoles(Group userGroup)
          Finds the roles mapped to given user group.
 Set<Role> findRoles(Set<Group> userGroups)
          Finds the roles mapped to given user groups.
 Set<Role> findRoles(User user)
          Finds the roles mapped to a given user.
 User findUser(String userIdentifier)
          Finds a user in the organization based on its identifier.
 List<Group> getRootGroups()
          Returns the modifiable list of root groups.
 List<User> getUsers()
          Returns the modifiable list of users.
 void map(Group group, Role role)
          Maps a group defined in a component to a role defined in the application.
 void map(User user, Role role)
          Maps a user defined in a component to a role defined in the application.
 void setRootGroups(List<Group> rootGroups)
          Sets the modifiable list of root groups.
 void setUsers(List<User> users)
          Sets the modifiable list of users.
 void unmap(Group group, Role role)
          Unmaps a group defined in a component from a role defined in the application.
 void unmap(User user, Role role)
          Unmaps a user defined in a component from a role defined in the application.
 
Methods inherited from class org.restlet.security.Realm
getEnroler, getName, getParameters, getVerifier, isStarted, isStopped, setEnroler, setName, setParameters, setVerifier, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryRealm

public MemoryRealm()
Constructor.

Method Detail

findGroups

public Set<Group> findGroups(User user)
Finds the set of groups where a given user is a member. Note that inheritable ancestors groups are also returned.

Parameters:
user - The member user.
Returns:
The set of groups.

findGroups

public Set<Group> findGroups(User user,
                             boolean inheritOnly)
Finds the set of groups where a given user is a member.

Parameters:
user - The member user.
inheritOnly - Indicates if only the ancestors groups that have their "inheritRoles" property enabled should be added.
Returns:
The set of groups.

findRoles

public Set<Role> findRoles(Group userGroup)
Finds the roles mapped to given user group.

Parameters:
userGroup - The user group.
Returns:
The roles found.

findRoles

public Set<Role> findRoles(Set<Group> userGroups)
Finds the roles mapped to given user groups.

Parameters:
userGroups - The user groups.
Returns:
The roles found.

findRoles

public Set<Role> findRoles(User user)
Finds the roles mapped to a given user.

Parameters:
user - The user.
Returns:
The roles found.

findUser

public User findUser(String userIdentifier)
Finds a user in the organization based on its identifier.

Parameters:
userIdentifier - The identifier to match.
Returns:
The matched user or null.

getRootGroups

public List<Group> getRootGroups()
Returns the modifiable list of root groups.

Returns:
The modifiable list of root groups.

getUsers

public List<User> getUsers()
Returns the modifiable list of users.

Returns:
The modifiable list of users.

map

public void map(Group group,
                Role role)
Maps a group defined in a component to a role defined in the application.

Parameters:
group - The source group.
role - The target role.

map

public void map(User user,
                Role role)
Maps a user defined in a component to a role defined in the application.

Parameters:
user - The source user.
role - The target role.

setRootGroups

public void setRootGroups(List<Group> rootGroups)
Sets the modifiable list of root groups. This method clears the current list and adds all entries in the parameter list.

Parameters:
rootGroups - A list of root groups.

setUsers

public void setUsers(List<User> users)
Sets the modifiable list of users. This method clears the current list and adds all entries in the parameter list.

Parameters:
users - A list of users.

unmap

public void unmap(Group group,
                  Role role)
Unmaps a group defined in a component from a role defined in the application.

Parameters:
group - The source group.
role - The target role.

unmap

public void unmap(User user,
                  Role role)
Unmaps a user defined in a component from a role defined in the application.

Parameters:
user - The source user.
role - The target role.


Copyright © 2005-2013 Restlet.