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.MethodSecurityExpressionOperationsImplementation of custom security expression, to be used in e.g. @PreAuthorize(..) to allow ABAC requests.
-
-
Constructor Summary
Constructors Constructor Description CustomMethodSecurityExpressionRoot(org.springframework.security.core.Authentication authentication, AbacConfig abacConfig, AbacConfig.AbacCheck abacCheck)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckAbacPost(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.ObjectgetFilterObject()ObjectgetReturnObject()ObjectgetThis()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, setTrustResolver
-
-
-
-
Constructor Detail
-
CustomMethodSecurityExpressionRoot
public CustomMethodSecurityExpressionRoot(org.springframework.security.core.Authentication authentication, AbacConfig abacConfig, AbacConfig.AbacCheck abacCheck)
-
-
Method Detail
-
setCompositionService
public void setCompositionService(CompositionService compositionService)
-
setContributionService
public void setContributionService(ContributionService contributionService)
-
setEhrService
public void setEhrService(EhrService ehrService)
-
checkAbacPost
public boolean checkAbacPost(String type, String subject, Object payload, String contentType) throws IOException, InterruptedException
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 errorInterruptedException- On error while communicating with the ABAC server
-
checkAbacPostQuery
public boolean checkAbacPostQuery(Object payload) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
checkAbacPre
public boolean checkAbacPre(String type, String subject, Object payload, String contentType) throws IOException, InterruptedException
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 errorInterruptedException- On error while communicating with the ABAC server
-
checkAbacPre
public boolean checkAbacPre(String type, String subject) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
getFilterObject
public Object getFilterObject()
- Specified by:
getFilterObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
setFilterObject
public void setFilterObject(Object filterObject)
- Specified by:
setFilterObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
getReturnObject
public Object getReturnObject()
- Specified by:
getReturnObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
setReturnObject
public void setReturnObject(Object returnObject)
- Specified by:
setReturnObjectin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
getThis
public Object getThis()
- Specified by:
getThisin interfaceorg.springframework.security.access.expression.method.MethodSecurityExpressionOperations
-
-