Class MultiUserSecurityContext
java.lang.Object
org.deltava.security.MultiUserSecurityContext
- All Implemented Interfaces:
SecurityContext
A security context that allows user swapping to test access by multiple users to a single object.
- Since:
- 3.6
- Version:
- 8.6
- Author:
- Luke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current servlet request.getRoles()
Returns all the roles for the currently authenticated user.getUser()
Returns the currently authenticated user.boolean
Queries if the current user is authenticated or anonymous.boolean
isUserInRole
(String roleName) Returns if the user is a member of a particular security role.void
Overrides the user.
-
Constructor Details
-
MultiUserSecurityContext
Creates the context.- Parameters:
ctx
- the existing SecurityContext
-
-
Method Details
-
getUser
Description copied from interface:SecurityContext
Returns the currently authenticated user.- Specified by:
getUser
in interfaceSecurityContext
- Returns:
- the user's Person object, or null if anonymous
-
getRequest
Description copied from interface:SecurityContext
Returns the current servlet request. Some access controllers may need to examine attributes within the servlet request.- Specified by:
getRequest
in interfaceSecurityContext
- Returns:
- the HTTP servlet request
-
isAuthenticated
public boolean isAuthenticated()Description copied from interface:SecurityContext
Queries if the current user is authenticated or anonymous.- Specified by:
isAuthenticated
in interfaceSecurityContext
- Returns:
- TRUE if a user is logged in, otherwise FALSE
-
getRoles
Description copied from interface:SecurityContext
Returns all the roles for the currently authenticated user.- Specified by:
getRoles
in interfaceSecurityContext
- Returns:
- a Collection of role names, or an empty collection
-
isUserInRole
Description copied from interface:SecurityContext
Returns if the user is a member of a particular security role.- Specified by:
isUserInRole
in interfaceSecurityContext
- Parameters:
roleName
- the role name- Returns:
- TRUE if the user is a member of the role, otherwise FALSE
-
setUser
-