Interface SecurityLoader
- All Known Implementing Classes:
NullSecurityLoaderImpl
,SpringSecurityLoaderImpl
An instance of this class is responsible for serialising/deserialising security information to a persistent data store. The SecurityContext object will invoke methods in this class as appropriate. Initialisation properties can be passed to the SecurityLoader using a properties map in the SecurityContext constructor.
- Author:
- knoxg
-
Method Summary
Modifier and TypeMethodDescriptionvoid
initialise
(Map<String, Object> properties) Initialise this security loader.loadAllActivities
(String resourceName) Return a List of all activities in this security context for a given resource, identified by String.Return a List of all permissions in this security context, as Permission objects.Return a List of all resources in this security context, identified by String.Return a List of all roles in this security context.Return a structured list of application specific Permission objects which is used to preload the SecurityContext rolePermission cache.Return a List of all roles in this security context, identified by String.Return a List of all users in this security context.Return a list of User objects representing all users contained in this security context.loadRolePermissions
(String role) Return List of Permission objects associated with a particular roleloadUser
(long userId) Load a user.loadUserPermissions
(User user) Returns the list of permissions assigned to this user.loadUserRolePermissions
(User user) Return a list of Permission objects associated with the roles possessed by a particular user.loadUserRoles
(User user) Returns the list of roles assigned to this user.void
Informs any delegate security contexts to reset themselves.void
saveRolePermissions
(String role, List<Permission> rolePermissions) Persists the permission information for this role to the database.void
saveUserRolesAndPermissions
(User user, List<String> roles, List<Permission> userPermissions) Persists the role and permission information recorded for this user to the database.
-
Method Details
-
initialise
Initialise this security loader. This method will be invoked by the SecurityContext object on initialisation- Parameters:
properties
- Initialisation properties for this loader.
-
loadAllRolePermissions
Return a structured list of application specific Permission objects which is used to preload the SecurityContext rolePermission cache. Each permission returned must be a role-based Permission.- Throws:
IOException
-
loadRolePermissions
Return List of Permission objects associated with a particular role- Throws:
IOException
-
loadUserRolePermissions
Return a list of Permission objects associated with the roles possessed by a particular user. Equivalent to appending the results of callingloadRolePermissions(String)
for each role that a user is in.- Throws:
IOException
-
loadUserPermissions
Returns the list of permissions assigned to this user.- Throws:
IOException
-
loadUserRoles
Returns the list of roles assigned to this user.- Throws:
IOException
-
loadUser
Load a user. Will not load any role or permission data for that user.Will probably throw an IOException if the user doesn't exist.
- Returns:
- a User object.
- Throws:
IOException
-
loadAllUsers
Return a list of User objects representing all users contained in this security context. Permission information relating to that user is not populated unless the 'populatePermission' parameter is set to true.The information returned by this function may be cached, depending on the initialisation properties of the security context.
- Returns:
- A List of Users.
- Throws:
IOException
-
loadAllResources
Return a List of all resources in this security context, identified by String.The information returned by this function may be cached, depending on the initialisation properties of the security context.
- Returns:
- A List of resources.
- Throws:
IOException
-
loadAllActivities
Return a List of all activities in this security context for a given resource, identified by String.The information returned by this function may be cached, depending on the initialisation properties of the security context.
- Parameters:
resourceName
- The resource we wish to retrieve activities for- Returns:
- A List of activities.
- Throws:
IOException
-
loadAllRoles
Return a List of all roles in this security context, identified by String.The information returned by this function may be cached, depending on the initialisation properties of the security context.
- Returns:
- A List of Roles, just the name.
- Throws:
IOException
-
loadAllPermissions
Return a List of all permissions in this security context, as Permission objects. (User, role and criteria fields will be left blank in these objects).The information returned by this function may be cached, depending on the initialisation properties of the security context.
- Returns:
- A List of Permission objects available to this application
- Throws:
IOException
-
loadAllRoleDetails
Return a List of all roles in this security context. Each role is returned as a Map containing (by default) the keys roleId, roleName, description- Returns:
- A List of Roles, in Map format.
- Throws:
IOException
-
loadAllUserDetails
Return a List of all users in this security context. Each user is returned as a Map containing (by default) the keys userId, name- Returns:
- A List of Users, in Map format.
- Throws:
IOException
-
resetSecurityContext
Informs any delegate security contexts to reset themselves.- Throws:
IOException
-
saveUserRolesAndPermissions
void saveUserRolesAndPermissions(User user, List<String> roles, List<Permission> userPermissions) throws IOException Persists the role and permission information recorded for this user to the database. Existing role and permission information in the database will be removed.- Parameters:
user
- The user to persistpermissions
- The permissions for this user- Throws:
IOException
-
saveRolePermissions
Persists the permission information for this role to the database. Existing permission information in the database will be removed.- Parameters:
user
- The role to persistpermissions
- The permissions for this role- Throws:
IOException
-