Class MultiUserSecurityContext

java.lang.Object
org.deltava.security.MultiUserSecurityContext
All Implemented Interfaces:
SecurityContext

public class MultiUserSecurityContext extends Object implements 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 Details

    • MultiUserSecurityContext

      public MultiUserSecurityContext(SecurityContext ctx)
      Creates the context.
      Parameters:
      ctx - the existing SecurityContext
  • Method Details

    • getUser

      public Pilot getUser()
      Description copied from interface: SecurityContext
      Returns the currently authenticated user.
      Specified by:
      getUser in interface SecurityContext
      Returns:
      the user's Person object, or null if anonymous
    • getRequest

      public HttpServletRequest 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 interface SecurityContext
      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 interface SecurityContext
      Returns:
      TRUE if a user is logged in, otherwise FALSE
    • getRoles

      public Collection<String> getRoles()
      Description copied from interface: SecurityContext
      Returns all the roles for the currently authenticated user.
      Specified by:
      getRoles in interface SecurityContext
      Returns:
      a Collection of role names, or an empty collection
    • isUserInRole

      public boolean isUserInRole(String roleName)
      Description copied from interface: SecurityContext
      Returns if the user is a member of a particular security role.
      Specified by:
      isUserInRole in interface SecurityContext
      Parameters:
      roleName - the role name
      Returns:
      TRUE if the user is a member of the role, otherwise FALSE
    • setUser

      public void setUser(Pilot usr)
      Overrides the user.
      Parameters:
      usr - the User object