Interface SecurityContext
- All Known Implementing Classes:
CommandContext
,GenericServlet.ServletSecurityContext
,HTTPContext
,MultiUserSecurityContext
,ServiceContext
,SNSContext
public interface SecurityContext
An interface used by access controllers to query context data to determine access.
- Since:
- 1.0
- Version:
- 8.6
- Author:
- Luke
-
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.
-
Method Details
-
isAuthenticated
boolean isAuthenticated()Queries if the current user is authenticated or anonymous.- Returns:
- TRUE if a user is logged in, otherwise FALSE
-
getUser
Pilot getUser()Returns the currently authenticated user.- Returns:
- the user's Person object, or null if anonymous
-
getRoles
Collection<String> getRoles()Returns all the roles for the currently authenticated user.- Returns:
- a Collection of role names, or an empty collection
-
isUserInRole
Returns if the user is a member of a particular security role.- Parameters:
roleName
- the role name- Returns:
- TRUE if the user is a member of the role, otherwise FALSE
-
getRequest
HttpServletRequest getRequest()Returns the current servlet request. Some access controllers may need to examine attributes within the servlet request.- Returns:
- the HTTP servlet request
-