Class DelegatingConsentService
- java.lang.Object
-
- ca.uhn.fhir.rest.server.interceptor.consent.DelegatingConsentService
-
- All Implemented Interfaces:
IConsentService
public class DelegatingConsentService extends Object implements IConsentService
Implementation ofIConsentServicethat forwards to another implementation ofIConsentService. This class is mostly provided for testing purposes.
-
-
Constructor Summary
Constructors Constructor Description DelegatingConsentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConsentOutcomecanSeeResource(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResource, IConsentContextServices theContextServices)This method is called if a user may potentially see a resource via READ operations, SEARCH operations, etc.voidcompleteOperationFailure(RequestDetails theRequestDetails, ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException theException, IConsentContextServices theContextServices)This method is called when an operation is complete.voidcompleteOperationSuccess(RequestDetails theRequestDetails, IConsentContextServices theContextServices)This method is called when an operation is complete.voidsetTarget(IConsentService theTarget)ConsentOutcomestartOperation(RequestDetails theRequestDetails, IConsentContextServices theContextServices)This method is called when an operation is initially beginning, before any significant processing occurs.ConsentOutcomewillSeeResource(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResource, IConsentContextServices theContextServices)This method is called if a user is about to see a resource, either completely or partially.
-
-
-
Constructor Detail
-
DelegatingConsentService
public DelegatingConsentService()
-
-
Method Detail
-
startOperation
public ConsentOutcome startOperation(RequestDetails theRequestDetails, IConsentContextServices theContextServices)
Description copied from interface:IConsentServiceThis method is called when an operation is initially beginning, before any significant processing occurs. The service may use this method to decide whether the request needs to be reviewed further or not.- Specified by:
startOperationin interfaceIConsentService- Parameters:
theRequestDetails- Contains details about the operation that is beginning, including details about the request type, URL, etc. Note that the RequestDetails has a generic Map (seeRequestDetails.getUserData()) that can be used to store information and state to be passed between methods in the consent service.theContextServices- An object passed in by the consent framework that provides utility functions relevant to acting on consent directives.- Returns:
- An outcome object. See
ConsentOutcome
-
canSeeResource
public ConsentOutcome canSeeResource(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResource, IConsentContextServices theContextServices)
Description copied from interface:IConsentServiceThis method is called if a user may potentially see a resource via READ operations, SEARCH operations, etc. This method may make decisions about whether or not the user should be permitted to see the resource.Implementations should make no attempt to modify the returned result within this method. For modification use cases (e.g. masking for consent rules) the user should use the
Performance note: Note that this method should be efficient, since it will be called once for every resource potentially returned (e.g. by searches). If this method takes a significant amount of time to execute, performance on the server will suffer.IConsentService.willSeeResource(RequestDetails, IBaseResource, IConsentContextServices)method to actually make changes. This method is intended to only to make decisions.- Specified by:
canSeeResourcein interfaceIConsentService- Parameters:
theRequestDetails- Contains details about the operation that is beginning, including details about the request type, URL, etc. Note that the RequestDetails has a generic Map (seeRequestDetails.getUserData()) that can be used to store information and state to be passed between methods in the consent service.theResource- The resource that will be exposedtheContextServices- An object passed in by the consent framework that provides utility functions relevant to acting on consent directives.- Returns:
- An outcome object. See
ConsentOutcome
-
willSeeResource
public ConsentOutcome willSeeResource(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResource, IConsentContextServices theContextServices)
Description copied from interface:IConsentServiceThis method is called if a user is about to see a resource, either completely or partially. In other words, if the user is going to see any part of this resource via READ operations, SEARCH operations, etc., this method is called. This method may modify the resource in order to filter/mask aspects of the contents, or even to enrich it.The returning
ConsentOutcomemay optionally replace the resource with a different resource (including an OperationOutcome) by calling the resource property on theConsentOutcome.In addition, the
ConsentOutcomemust return one of the following statuses:ConsentOperationStatusEnum.AUTHORIZED: The resource will be returned to the client.ConsentOperationStatusEnum.PROCEED: The resource will be returned to the client. Any embedded resources contained within the resource will also be checked byIConsentService.willSeeResource(RequestDetails, IBaseResource, IConsentContextServices).ConsentOperationStatusEnum.REJECT: The resource will not be returned to the client. If the resource supplied to the
- Specified by:
willSeeResourcein interfaceIConsentService- Parameters:
theRequestDetails- Contains details about the operation that is beginning, including details about the request type, URL, etc. Note that the RequestDetails has a generic Map (seeRequestDetails.getUserData()) that can be used to store information and state to be passed between methods in the consent service.theResource- The resource that will be exposedtheContextServices- An object passed in by the consent framework that provides utility functions relevant to acting on consent directives.- Returns:
- An outcome object. See method documentation for a description.
-
completeOperationSuccess
public void completeOperationSuccess(RequestDetails theRequestDetails, IConsentContextServices theContextServices)
Description copied from interface:IConsentServiceThis method is called when an operation is complete. It can be used to perform any necessary cleanup, flush audit events, etc.This method is not called if the request failed.
IConsentService.completeOperationFailure(RequestDetails, BaseServerResponseException, IConsentContextServices)will be called instead in that case.- Specified by:
completeOperationSuccessin interfaceIConsentService- Parameters:
theRequestDetails- Contains details about the operation that is beginning, including details about the request type, URL, etc. Note that the RequestDetails has a generic Map (seeRequestDetails.getUserData()) that can be used to store information and state to be passed between methods in the consent service.theContextServices- An object passed in by the consent framework that provides utility functions relevant to acting on consent directives.- See Also:
IConsentService.completeOperationFailure(RequestDetails, BaseServerResponseException, IConsentContextServices)
-
completeOperationFailure
public void completeOperationFailure(RequestDetails theRequestDetails, ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException theException, IConsentContextServices theContextServices)
Description copied from interface:IConsentServiceThis method is called when an operation is complete. It can be used to perform any necessary cleanup, flush audit events, etc.This method will be called if the request did not complete successfully, instead of
IConsentService.completeOperationSuccess(RequestDetails, IConsentContextServices). Typically this means that the operation failed and a failure is being returned to the client.- Specified by:
completeOperationFailurein interfaceIConsentService- Parameters:
theRequestDetails- Contains details about the operation that is beginning, including details about the request type, URL, etc. Note that the RequestDetails has a generic Map (seeRequestDetails.getUserData()) that can be used to store information and state to be passed between methods in the consent service.theContextServices- An object passed in by the consent framework that provides utility functions relevant to acting on consent directives.- See Also:
IConsentService.completeOperationSuccess(RequestDetails, IConsentContextServices)
-
setTarget
public void setTarget(IConsentService theTarget)
-
-