Interface SecurityExpressionOperations
- 
- All Known Subinterfaces:
 MethodSecurityExpressionOperations
- All Known Implementing Classes:
 MessageSecurityExpressionRoot,SecurityExpressionRoot,WebSecurityExpressionRoot
public interface SecurityExpressionOperationsStandard interface for expression root objects used with expression-based security.- Since:
 - 3.1.1
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleandenyAll()Always denies accessAuthenticationgetAuthentication()Gets theAuthenticationused for evaluating the expressionsbooleanhasAnyAuthority(java.lang.String... authorities)Determines if thegetAuthentication()has any of the specified authorities withinAuthentication.getAuthorities().booleanhasAnyRole(java.lang.String... roles)Determines if thegetAuthentication()has any of the specified authorities withinAuthentication.getAuthorities().booleanhasAuthority(java.lang.String authority)Determines if thegetAuthentication()has a particular authority withinAuthentication.getAuthorities().booleanhasPermission(java.lang.Object target, java.lang.Object permission)Determines if thegetAuthentication()has permission to access the target given the permissionbooleanhasPermission(java.lang.Object targetId, java.lang.String targetType, java.lang.Object permission)Determines if thegetAuthentication()has permission to access the domain object with a given id, type, and permission.booleanhasRole(java.lang.String role)Determines if thegetAuthentication()has a particular authority withinAuthentication.getAuthorities().booleanisAnonymous()Determines if thegetAuthentication()is anonymousbooleanisAuthenticated()Determines ifthegetAuthentication()is authenticatedbooleanisFullyAuthenticated()Determines if thegetAuthentication()authenticated without the use of remember mebooleanisRememberMe()Determines if thegetAuthentication()was authenticated using remember mebooleanpermitAll()Always grants access. 
 - 
 
- 
- 
Method Detail
- 
getAuthentication
Authentication getAuthentication()
Gets theAuthenticationused for evaluating the expressions- Returns:
 - the 
Authenticationfor evaluating the expressions 
 
- 
hasAuthority
boolean hasAuthority(java.lang.String authority)
Determines if thegetAuthentication()has a particular authority withinAuthentication.getAuthorities().- Parameters:
 authority- the authority to test (i.e. "ROLE_USER")- Returns:
 - true if the authority is found, else false
 
 
- 
hasAnyAuthority
boolean hasAnyAuthority(java.lang.String... authorities)
Determines if thegetAuthentication()has any of the specified authorities withinAuthentication.getAuthorities().- Parameters:
 authorities- the authorities to test (i.e. "ROLE_USER", "ROLE_ADMIN")- Returns:
 - true if any of the authorities is found, else false
 
 
- 
hasRole
boolean hasRole(java.lang.String role)
Determines if the
getAuthentication()has a particular authority withinAuthentication.getAuthorities().This is similar to
hasAuthority(String)except that this method implies that the String passed in is a role. For example, if "USER" is passed in the implementation may convert it to use "ROLE_USER" instead. The way in which the role is converted may depend on the implementation settings.- Parameters:
 role- the authority to test (i.e. "USER")- Returns:
 - true if the authority is found, else false
 
 
- 
hasAnyRole
boolean hasAnyRole(java.lang.String... roles)
Determines if the
getAuthentication()has any of the specified authorities withinAuthentication.getAuthorities().This is a similar to hasAnyAuthority except that this method implies that the String passed in is a role. For example, if "USER" is passed in the implementation may convert it to use "ROLE_USER" instead. The way in which the role is converted may depend on the implementation settings.
- Parameters:
 roles- the authorities to test (i.e. "USER", "ADMIN")- Returns:
 - true if any of the authorities is found, else false
 
 
- 
permitAll
boolean permitAll()
Always grants access.- Returns:
 - true
 
 
- 
denyAll
boolean denyAll()
Always denies access- Returns:
 - false
 
 
- 
isAnonymous
boolean isAnonymous()
Determines if thegetAuthentication()is anonymous- Returns:
 - true if the user is anonymous, else false
 
 
- 
isAuthenticated
boolean isAuthenticated()
Determines ifthegetAuthentication()is authenticated- Returns:
 - true if the 
getAuthentication()is authenticated, else false 
 
- 
isRememberMe
boolean isRememberMe()
Determines if thegetAuthentication()was authenticated using remember me- Returns:
 - true if the 
getAuthentication()authenticated using remember me, else false 
 
- 
isFullyAuthenticated
boolean isFullyAuthenticated()
Determines if thegetAuthentication()authenticated without the use of remember me- Returns:
 - true if the 
getAuthentication()authenticated without the use of remember me, else false 
 
- 
hasPermission
boolean hasPermission(java.lang.Object target, java.lang.Object permission)Determines if thegetAuthentication()has permission to access the target given the permission- Parameters:
 target- the target domain object to check permission onpermission- the permission to check on the domain object (i.e. "read", "write", etc).- Returns:
 - true if permission is granted to the 
getAuthentication(), else false 
 
- 
hasPermission
boolean hasPermission(java.lang.Object targetId, java.lang.String targetType, java.lang.Object permission)Determines if thegetAuthentication()has permission to access the domain object with a given id, type, and permission.- Parameters:
 targetId- the identifier of the domain object to determine accesstargetType- the type (i.e. com.example.domain.Message)permission- the perission to check on the domain object (i.e. "read", "write", etc)- Returns:
 - true if permission is granted to the 
getAuthentication(), else false 
 
 - 
 
 -