Package org.ehrbase.application.abac
Class CustomMethodSecurityExpressionRoot
java.lang.Object
org.springframework.security.access.expression.SecurityExpressionRoot
org.ehrbase.application.abac.CustomMethodSecurityExpressionRoot
- All Implemented Interfaces:
org.springframework.security.access.expression.method.MethodSecurityExpressionOperations,org.springframework.security.access.expression.SecurityExpressionOperations
public class CustomMethodSecurityExpressionRoot
extends org.springframework.security.access.expression.SecurityExpressionRoot
implements org.springframework.security.access.expression.method.MethodSecurityExpressionOperations
Implementation of custom security expression, to be used in e.g. @PreAuthorize(..) to allow ABAC
requests.
- Since:
- 1.0
- Author:
- Jake Smolka
-
Field Summary
Fields inherited from class org.springframework.security.access.expression.SecurityExpressionRoot
admin, create, delete, denyAll, permitAll, read, write -
Constructor Summary
ConstructorsConstructorDescriptionCustomMethodSecurityExpressionRoot(org.springframework.security.core.Authentication authentication, AbacConfig abacConfig, AbacConfig.AbacCheck abacCheck) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAbacPost(String type, String subject, Object payload, String contentType) Custom SpEL expression to be used to check if the remote ABAC allows the operation by given data.booleancheckAbacPostQuery(Object payload) booleancheckAbacPre(String type, String subject) booleancheckAbacPre(String type, String subject, Object payload, String contentType) Custom SpEL expression to be used to check if the remote ABAC allows the operation by given data.getThis()voidsetCompositionService(CompositionService compositionService) voidsetContributionService(ContributionService contributionService) voidsetEhrService(EhrService ehrService) voidsetFilterObject(Object filterObject) voidsetReturnObject(Object returnObject) Methods inherited from class org.springframework.security.access.expression.SecurityExpressionRoot
denyAll, getAuthentication, getPrincipal, hasAnyAuthority, hasAnyRole, hasAuthority, hasPermission, hasPermission, hasRole, isAnonymous, isAuthenticated, isFullyAuthenticated, isRememberMe, permitAll, setDefaultRolePrefix, setPermissionEvaluator, setRoleHierarchy, setTrustResolverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.access.expression.SecurityExpressionOperations
denyAll, getAuthentication, hasAnyAuthority, hasAnyRole, hasAuthority, hasPermission, hasPermission, hasRole, isAnonymous, isAuthenticated, isFullyAuthenticated, isRememberMe, permitAll
-
Constructor Details
-
CustomMethodSecurityExpressionRoot
public CustomMethodSecurityExpressionRoot(org.springframework.security.core.Authentication authentication, AbacConfig abacConfig, AbacConfig.AbacCheck abacCheck)
-
-
Method Details
-
setCompositionService
-
setContributionService
-
setEhrService
-
checkAbacPost
public boolean checkAbacPost(String type, String subject, Object payload, String contentType) throws IOException Custom SpEL expression to be used to check if the remote ABAC allows the operation by given data. For @PostAuthorize cases.- Parameters:
type- Type of scope's resourcesubject- Subject ID from the current EHR contextpayload- Payload object, either request's input or response's outputcontentType- Content type from the scope- Returns:
- True if ABAC authorizes given attributes
- Throws:
IOException- On parsing error
-
checkAbacPostQuery
- Throws:
IOException
-
checkAbacPre
public boolean checkAbacPre(String type, String subject, Object payload, String contentType) throws IOException Custom SpEL expression to be used to check if the remote ABAC allows the operation by given data. For @PreAuthorize cases.- Parameters:
type- Type of scope's resourcesubject- Subject ID from the current EHR contextpayload- Payload object, either request's input or response's outputcontentType- Content type from the scope- Returns:
- True if ABAC authorizes given attributes
- Throws:
IOException- On parsing error
-
checkAbacPre
- Throws:
IOException
-
getFilterObject
- Specified by:
getFilterObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
setFilterObject
- Specified by:
setFilterObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
getReturnObject
- Specified by:
getReturnObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
setReturnObject
- Specified by:
setReturnObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
getThis
- Specified by:
getThisin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-