fr.cnes.sitools.security.authentication
Class SitoolsMemoryRealm

java.lang.Object
  extended by org.restlet.security.Realm
      extended by fr.cnes.sitools.security.authentication.SitoolsRealm
          extended by fr.cnes.sitools.security.authentication.SitoolsMemoryRealm

public class SitoolsMemoryRealm
extends SitoolsRealm

Class for building a Realm with the store of users, groups and roles SitoolsMemoryRealm is a fixed and improved version of Restlet MemoryRealm

Author:
jp.boignard (AKKA Technologies)

Constructor Summary
SitoolsMemoryRealm(UsersAndGroupsStore storeUsersAndGroups, SitoolsStore<Role> storeRoles, SitoolsSettings settings)
          Constructor
 
Method Summary
 java.util.Set<org.restlet.security.Group> findGroups(org.restlet.security.User user)
          Finds the set of groups where a given user is a member.
 org.restlet.security.User findUser(java.lang.String userIdentifier)
          Finds a user in the organization based on its identifier.
 java.util.List<org.restlet.security.Group> getRootGroups()
          Returns the modifiable list of root groups.
 java.util.List<org.restlet.security.User> getUsers()
          Returns the modifiable list of users.
 boolean onVerify(boolean result, User user)
          Verifiers can call this event after the verification is done
 void refreshRoleMappings(Role roleStore)
          Reload Role from store and rebuild all mappings for groups and users.
 void refreshUsersAndGroups()
          Refresh users / groups
 void removeGroup(java.lang.String groupName)
          Remove Group from realm
 void removeUser(java.lang.String userIdentifier)
          Remove User from realm
 void setRootGroups(java.util.List<org.restlet.security.Group> rootGroups)
          Sets the modifiable list of root groups.
 void setUsers(java.util.List<org.restlet.security.User> users)
          Sets the modifiable list of users.
 
Methods inherited from class fr.cnes.sitools.security.authentication.SitoolsRealm
findRoles, findRoles, findRoles, getPublicRole, getReferenceRoles, getSettings, getStoreRoles, removeRole
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SitoolsMemoryRealm

public SitoolsMemoryRealm(UsersAndGroupsStore storeUsersAndGroups,
                          SitoolsStore<Role> storeRoles,
                          SitoolsSettings settings)
Constructor

Parameters:
storeUsersAndGroups - storage of users and groups
storeRoles - storage of roles
settings - the SitoolsSettings object where to find realm name, ...
Method Detail

findGroups

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

Specified by:
findGroups in class SitoolsRealm
Parameters:
user - The member user.
Returns:
The set of groups.

findUser

public org.restlet.security.User findUser(java.lang.String userIdentifier)
Finds a user in the organization based on its identifier.

Specified by:
findUser in class SitoolsRealm
Parameters:
userIdentifier - The identifier to match.
Returns:
The matched user or null.

getRootGroups

public java.util.List<org.restlet.security.Group> getRootGroups()
Returns the modifiable list of root groups.

Returns:
The modifiable list of root groups.

setRootGroups

public void setRootGroups(java.util.List<org.restlet.security.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.

getUsers

public java.util.List<org.restlet.security.User> getUsers()
Returns the modifiable list of users.

Returns:
The modifiable list of users.

setUsers

public void setUsers(java.util.List<org.restlet.security.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.

refreshUsersAndGroups

public void refreshUsersAndGroups()
Refresh users / groups

Specified by:
refreshUsersAndGroups in class SitoolsRealm

removeUser

public void removeUser(java.lang.String userIdentifier)
Remove User from realm

Specified by:
removeUser in class SitoolsRealm
Parameters:
userIdentifier - Group identifier

removeGroup

public void removeGroup(java.lang.String groupName)
Remove Group from realm

Specified by:
removeGroup in class SitoolsRealm
Parameters:
groupName - Group name

refreshRoleMappings

public void refreshRoleMappings(Role roleStore)
Reload Role from store and rebuild all mappings for groups and users.

Overrides:
refreshRoleMappings in class SitoolsRealm
Parameters:
roleStore - fr.cnes.sitools.role.model.Role

onVerify

public boolean onVerify(boolean result,
                        User user)
Description copied from class: SitoolsRealm
Verifiers can call this event after the verification is done

Specified by:
onVerify in class SitoolsRealm
Parameters:
result - the result
user - the user
Returns:
true if the verification is successful, false otherwise


Copyright © 2010-2013 CNES. All Rights Reserved.