public abstract class SecurityExpressionRoot extends Object implements SecurityExpressionOperations
| Modifier and Type | Field and Description |
|---|---|
String |
admin |
protected Authentication |
authentication |
String |
create |
String |
delete |
boolean |
denyAll
Allows "denyAll" expression
|
boolean |
permitAll
Allows "permitAll" expression
|
String |
read |
String |
write |
| Constructor and Description |
|---|
SecurityExpressionRoot(Authentication authentication)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
denyAll()
Always denies access
|
Authentication |
getAuthentication()
Gets the
Authentication used for evaluating the expressions |
Object |
getPrincipal()
Convenience method to access
Authentication.getPrincipal() from getAuthentication() |
boolean |
hasAnyAuthority(String... authorities)
Determines if the
SecurityExpressionOperations.getAuthentication() has any of the specified authorities within Authentication.getAuthorities(). |
boolean |
hasAnyRole(String... roles)
Determines if the
SecurityExpressionOperations.getAuthentication() has any of the specified authorities within Authentication.getAuthorities(). |
boolean |
hasAuthority(String authority)
Determines if the
SecurityExpressionOperations.getAuthentication() has a particular authority within Authentication.getAuthorities(). |
boolean |
hasPermission(Object target,
Object permission)
Determines if the
SecurityExpressionOperations.getAuthentication() has permission to access the target given the permission |
boolean |
hasPermission(Object targetId,
String targetType,
Object permission)
Determines if the
SecurityExpressionOperations.getAuthentication() has permission to access the domain object with a given id, type, and permission. |
boolean |
hasRole(String role)
Determines if the
SecurityExpressionOperations.getAuthentication() has a particular authority within Authentication.getAuthorities(). |
boolean |
isAnonymous()
Determines if the
SecurityExpressionOperations.getAuthentication() is anonymous |
boolean |
isAuthenticated()
Determines ifthe
SecurityExpressionOperations.getAuthentication() is authenticated |
boolean |
isFullyAuthenticated()
Determines if the
SecurityExpressionOperations.getAuthentication() authenticated without the use of remember me |
boolean |
isRememberMe()
Determines if the
SecurityExpressionOperations.getAuthentication() was authenticated using remember me |
boolean |
permitAll()
Always grants access.
|
void |
setPermissionEvaluator(PermissionEvaluator permissionEvaluator) |
void |
setRoleHierarchy(RoleHierarchy roleHierarchy) |
void |
setTrustResolver(AuthenticationTrustResolver trustResolver) |
protected final Authentication authentication
public final boolean permitAll
public final boolean denyAll
public final String read
public final String write
public final String create
public final String delete
public final String admin
public SecurityExpressionRoot(Authentication authentication)
authentication - the Authentication to use. Cannot be null.public final boolean hasAuthority(String authority)
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() has a particular authority within Authentication.getAuthorities(). This is a synonym for SecurityExpressionOperations.hasAuthority(String).hasAuthority in interface SecurityExpressionOperationsauthority - the authority to test (i.e. "ROLE_USER")public final boolean hasAnyAuthority(String... authorities)
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() has any of the specified authorities within Authentication.getAuthorities(). This is a synonym for SecurityExpressionOperations.hasAnyRole(String...).hasAnyAuthority in interface SecurityExpressionOperationsauthorities - the authorities to test (i.e. "ROLE_USER", "ROLE_ADMIN")public final boolean hasRole(String role)
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() has a particular authority within Authentication.getAuthorities(). This is a synonym for SecurityExpressionOperations.hasAuthority(String).hasRole in interface SecurityExpressionOperationspublic final boolean hasAnyRole(String... roles)
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() has any of the specified authorities within Authentication.getAuthorities(). This is a synonym for SecurityExpressionOperations.hasAnyAuthority(String...).hasAnyRole in interface SecurityExpressionOperationspublic final Authentication getAuthentication()
SecurityExpressionOperationsAuthentication used for evaluating the expressionsgetAuthentication in interface SecurityExpressionOperationsAuthentication for evaluating the expressionspublic final boolean permitAll()
SecurityExpressionOperationspermitAll in interface SecurityExpressionOperationspublic final boolean denyAll()
SecurityExpressionOperationsdenyAll in interface SecurityExpressionOperationspublic final boolean isAnonymous()
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() is anonymousisAnonymous in interface SecurityExpressionOperationspublic final boolean isAuthenticated()
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() is authenticatedisAuthenticated in interface SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() is authenticated, else falsepublic final boolean isRememberMe()
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() was authenticated using remember meisRememberMe in interface SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() authenticated using remember me, else falsepublic final boolean isFullyAuthenticated()
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() authenticated without the use of remember meisFullyAuthenticated in interface SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() authenticated without the use of remember me, else falsepublic Object getPrincipal()
Authentication.getPrincipal() from getAuthentication()public void setTrustResolver(AuthenticationTrustResolver trustResolver)
public void setRoleHierarchy(RoleHierarchy roleHierarchy)
public boolean hasPermission(Object target, Object permission)
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() has permission to access the target given the permissionhasPermission in interface SecurityExpressionOperationstarget - the target domain object to check permission onpermission - the permission to check on the domain object (i.e. "read", "write", etc).SecurityExpressionOperations.getAuthentication(), else falsepublic boolean hasPermission(Object targetId, String targetType, Object permission)
SecurityExpressionOperationsSecurityExpressionOperations.getAuthentication() has permission to access the domain object with a given id, type, and permission.hasPermission in interface SecurityExpressionOperationstargetId - 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)SecurityExpressionOperations.getAuthentication(), else falsepublic void setPermissionEvaluator(PermissionEvaluator permissionEvaluator)