Interface SecurityContext
public interface SecurityContext
Security context in which an endpoint is being invoked.
- Since:
- 2.0.0
- Author:
- Andy Wilkinson
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the currently authenticatedPrincipal
ornull
.boolean
isUserInRole
(String role) Returnstrue
if the currently authenticated user is in the givenrole
, or false otherwise.
-
Field Details
-
NONE
Empty security context.
-
-
Method Details
-
getPrincipal
Principal getPrincipal()Return the currently authenticatedPrincipal
ornull
.- Returns:
- the principal or
null
-
isUserInRole
Returnstrue
if the currently authenticated user is in the givenrole
, or false otherwise.- Parameters:
role
- name of the role- Returns:
true
if the user is in the given role
-