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.booleanQueries if the current user is authenticated or anonymous.booleanisUserInRole(String roleName) Returns if the user is a member of a particular security role.voidOverrides the user.
-
Constructor Details
-
MultiUserSecurityContext
Creates the context.- Parameters:
ctx- the existing SecurityContext
-
-
Method Details
-
getUser
Description copied from interface:SecurityContextReturns the currently authenticated user.- Specified by:
getUserin interfaceSecurityContext- Returns:
- the user's Person object, or null if anonymous
-
getRequest
Description copied from interface:SecurityContextReturns the current servlet request. Some access controllers may need to examine attributes within the servlet request.- Specified by:
getRequestin interfaceSecurityContext- Returns:
- the HTTP servlet request
-
isAuthenticated
public boolean isAuthenticated()Description copied from interface:SecurityContextQueries if the current user is authenticated or anonymous.- Specified by:
isAuthenticatedin interfaceSecurityContext- Returns:
- TRUE if a user is logged in, otherwise FALSE
-
getRoles
Description copied from interface:SecurityContextReturns all the roles for the currently authenticated user.- Specified by:
getRolesin interfaceSecurityContext- Returns:
- a Collection of role names, or an empty collection
-
isUserInRole
Description copied from interface:SecurityContextReturns if the user is a member of a particular security role.- Specified by:
isUserInRolein interfaceSecurityContext- Parameters:
roleName- the role name- Returns:
- TRUE if the user is a member of the role, otherwise FALSE
-
setUser
-