The security context provides access to security-related information about the current user. SecurityContext consists of five methods, as follows:
- getCallerPrincipal: If the current user is authenticated, this method returns the container-specific principal to the user.
- getPrincipalsByType: Returns all the principals of the given type.
- isCallerInRole: Returns true if the current user is part of the role sent as a parameter.
- hasAccessToWebResource: Determines whether the current user has access to the web resource passed as a parameter.
- authenticate: Triggers the authentication method set up for the application.