fr.cnes.sitools.security.authentication
Class SitoolsRealm

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

public abstract class SitoolsRealm
extends org.restlet.security.Realm

SitoolsRealm based on a memory Role management

Author:
jp.boignard (AKKA Technologies)

Constructor Summary
SitoolsRealm(SitoolsStore<Role> storeRoles, SitoolsSettings settings)
          Constructor
 
Method Summary
abstract  java.util.Set<org.restlet.security.Group> findGroups(org.restlet.security.User user)
          Find the List of Group containing the given User
 java.util.Set<org.restlet.security.Role> findRoles(org.restlet.security.Group userGroup)
          Finds the roles mapped to given user group.
 java.util.Set<org.restlet.security.Role> findRoles(java.util.Set<org.restlet.security.Group> userGroups)
          Finds the roles mapped to given user groups.
 java.util.Set<org.restlet.security.Role> findRoles(org.restlet.security.User user)
          Finds the roles mapped to a given user.
abstract  org.restlet.security.User findUser(java.lang.String userIdentifier)
          Find a user from its identifier
 org.restlet.security.Role getPublicRole()
          Public Role
 java.util.concurrent.ConcurrentHashMap<java.lang.String,org.restlet.security.Role> getReferenceRoles()
          Get the role map
 SitoolsSettings getSettings()
          Gets the settings.
 SitoolsStore<Role> getStoreRoles()
          Gets the role store
abstract  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.
abstract  void refreshUsersAndGroups()
          Refresh users and group in the Realm when a user or group is created or deleted mappings need to be refreshed
abstract  void removeGroup(java.lang.String groupName)
          Remove a Group from the Realm when a group is removed role mappings need to be refreshed
 void removeRole(java.lang.String roleName)
          Remove Role from realm
abstract  void removeUser(java.lang.String userIdentifier)
          Remove a user from the Realm when a user is removed role mappings need to be refreshed
 
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

SitoolsRealm

public SitoolsRealm(SitoolsStore<Role> storeRoles,
                    SitoolsSettings settings)
Constructor

Parameters:
storeRoles - the store of Role
settings - the SitoolsSettings
Method Detail

getStoreRoles

public SitoolsStore<Role> getStoreRoles()
Gets the role store

Returns:
a map of roles

getReferenceRoles

public java.util.concurrent.ConcurrentHashMap<java.lang.String,org.restlet.security.Role> getReferenceRoles()
Get the role map

Returns:
a map of roles

getPublicRole

public org.restlet.security.Role getPublicRole()
Public Role

Returns:
Role

removeRole

public void removeRole(java.lang.String roleName)
Remove Role from realm

Parameters:
roleName - Role identifier

refreshRoleMappings

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

Parameters:
roleStore - fr.cnes.sitools.role.model.Role

findRoles

public java.util.Set<org.restlet.security.Role> findRoles(java.util.Set<org.restlet.security.Group> userGroups)
Finds the roles mapped to given user groups.

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

findRoles

public java.util.Set<org.restlet.security.Role> findRoles(org.restlet.security.User user)
Finds the roles mapped to a given user.

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

findRoles

public java.util.Set<org.restlet.security.Role> findRoles(org.restlet.security.Group userGroup)
Finds the roles mapped to given user group.

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

findUser

public abstract org.restlet.security.User findUser(java.lang.String userIdentifier)
Find a user from its identifier

Parameters:
userIdentifier - the user identifier
Returns:
the User

findGroups

public abstract java.util.Set<org.restlet.security.Group> findGroups(org.restlet.security.User user)
Find the List of Group containing the given User

Parameters:
user - the User
Returns:
the list of Group containing the given User

removeUser

public abstract void removeUser(java.lang.String userIdentifier)
Remove a user from the Realm

when a user is removed role mappings need to be refreshed

Parameters:
userIdentifier - the user identifier

removeGroup

public abstract void removeGroup(java.lang.String groupName)
Remove a Group from the Realm

when a group is removed role mappings need to be refreshed

Parameters:
groupName - the Name of the group

refreshUsersAndGroups

public abstract void refreshUsersAndGroups()
Refresh users and group in the Realm

when a user or group is created or deleted mappings need to be refreshed


onVerify

public abstract boolean onVerify(boolean result,
                                 User user)
Verifiers can call this event after the verification is done

Parameters:
result - the result
user - the user
Returns:
true if the verification is successful, false otherwise

getSettings

public SitoolsSettings getSettings()
Gets the settings.

Returns:
the settings


Copyright © 2010-2013 CNES. All Rights Reserved.