Class AuthorizationInterceptor
java.lang.Object
ca.uhn.fhir.rest.server.interceptor.auth.AuthorizationInterceptor
- All Implemented Interfaces:
IRuleApplier
This class is a base class for interceptors which can be used to
inspect requests and responses to determine whether the calling user
has permission to perform the given action.
See the HAPI FHIR Documentation on Server Security for information on how to use this interceptor.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructorAuthorizationInterceptor(PolicyEnum theDefaultPolicy) Constructor -
Method Summary
Modifier and TypeMethodDescriptionapplyRulesAndReturnDecision(ca.uhn.fhir.rest.api.RestOperationTypeEnum theOperation, RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theInputResource, org.hl7.fhir.instance.model.api.IIdType theInputResourceId, org.hl7.fhir.instance.model.api.IBaseResource theOutputResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) buildRuleList(RequestDetails theRequestDetails) Subclasses should override this method to supply the set of rules to be applied to this individual request.The default policy if no rules have been found to apply.getFlags()This property configures any flags affecting how authorization is applied.org.slf4j.Loggerca.uhn.fhir.context.support.IValidationSupportprotected voidhandleDeny(RequestDetails theRequestDetails, AuthorizationInterceptor.Verdict decision) Handle an access control verdict ofPolicyEnum.DENY.protected voidhandleDeny(AuthorizationInterceptor.Verdict decision) This method should not be overridden.voidhookCascadeDeleteForConflict(RequestDetails theRequestDetails, ca.uhn.fhir.interceptor.api.Pointcut thePointcut, org.hl7.fhir.instance.model.api.IBaseResource theResourceToDelete) voidhookDeleteExpunge(RequestDetails theRequestDetails, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidhookOutgoingResponse(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResponseObject, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidhookPreShow(RequestDetails theRequestDetails, IPreResourceShowDetails theDetails, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidhookResourcePreCreate(RequestDetails theRequest, org.hl7.fhir.instance.model.api.IBaseResource theResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidhookResourcePreDelete(RequestDetails theRequest, org.hl7.fhir.instance.model.api.IBaseResource theResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidhookResourcePreUpdate(RequestDetails theRequest, org.hl7.fhir.instance.model.api.IBaseResource theOldResource, org.hl7.fhir.instance.model.api.IBaseResource theNewResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidincomingRequestPreHandled(RequestDetails theRequest, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) voidinitiateBulkExport(RequestDetails theRequestDetails, BulkDataExportOptions theBulkExportOptions, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) setDefaultPolicy(PolicyEnum theDefaultPolicy) The default policy if no rules have been found to apply.setFlags(AuthorizationFlagsEnum... theFlags) This property configures any flags affecting how authorization is applied.setFlags(Collection<AuthorizationFlagsEnum> theFlags) This property configures any flags affecting how authorization is applied.voidsetTroubleshootingLog(org.slf4j.Logger theTroubleshootingLog) setValidationSupport(ca.uhn.fhir.context.support.IValidationSupport theValidationSupport) Sets a validation support module that will be used for terminology-based rules
-
Field Details
-
REQUEST_ATTRIBUTE_BULK_DATA_EXPORT_OPTIONS
-
-
Constructor Details
-
AuthorizationInterceptor
public AuthorizationInterceptor()Constructor -
AuthorizationInterceptor
Constructor- Parameters:
theDefaultPolicy- The default policy if no rules apply (must not be null)
-
-
Method Details
-
getTroubleshootingLog
- Specified by:
getTroubleshootingLogin interfaceIRuleApplier
-
setTroubleshootingLog
-
applyRulesAndReturnDecision
public AuthorizationInterceptor.Verdict applyRulesAndReturnDecision(ca.uhn.fhir.rest.api.RestOperationTypeEnum theOperation, RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theInputResource, org.hl7.fhir.instance.model.api.IIdType theInputResourceId, org.hl7.fhir.instance.model.api.IBaseResource theOutputResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) - Specified by:
applyRulesAndReturnDecisionin interfaceIRuleApplier
-
getValidationSupport
- Specified by:
getValidationSupportin interfaceIRuleApplier- Since:
- 6.0.0
-
setValidationSupport
public AuthorizationInterceptor setValidationSupport(ca.uhn.fhir.context.support.IValidationSupport theValidationSupport) Sets a validation support module that will be used for terminology-based rules- Parameters:
theValidationSupport- The validation support. Null is also acceptable (this is the default), in which case the validation support module associated with theFhirContextwill be used.- Since:
- 6.0.0
-
buildRuleList
Subclasses should override this method to supply the set of rules to be applied to this individual request.Typically this is done by examining
theRequestDetailsto find out who the current user is and then using aRuleBuilderto create an appropriate rule chain.- Parameters:
theRequestDetails- The individual request currently being applied
-
getDefaultPolicy
The default policy if no rules have been found to apply. Default value for this setting isPolicyEnum.DENY -
setDefaultPolicy
The default policy if no rules have been found to apply. Default value for this setting isPolicyEnum.DENY- Parameters:
theDefaultPolicy- The policy (must not benull)
-
getFlags
This property configures any flags affecting how authorization is applied. By default no flags are applied.- See Also:
-
setFlags
This property configures any flags affecting how authorization is applied. By default no flags are applied.- Parameters:
theFlags- The flags (must not be null)- See Also:
-
setFlags
This property configures any flags affecting how authorization is applied. By default no flags are applied.- Parameters:
theFlags- The flags (must not be null)- See Also:
-
handleDeny
protected void handleDeny(RequestDetails theRequestDetails, AuthorizationInterceptor.Verdict decision) Handle an access control verdict ofPolicyEnum.DENY.Subclasses may override to implement specific behaviour, but default is to throw
ForbiddenOperationException(HTTP 403) with error message citing the rule name which trigered failure- Since:
- HAPI FHIR 3.6.0
-
handleDeny
This method should not be overridden. As of HAPI FHIR 3.6.0, you should overridehandleDeny(RequestDetails, Verdict)instead. This method will be removed in the future. -
incomingRequestPreHandled
public void incomingRequestPreHandled(RequestDetails theRequest, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
hookPreShow
public void hookPreShow(RequestDetails theRequestDetails, IPreResourceShowDetails theDetails, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
hookOutgoingResponse
public void hookOutgoingResponse(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResponseObject, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
hookCascadeDeleteForConflict
public void hookCascadeDeleteForConflict(RequestDetails theRequestDetails, ca.uhn.fhir.interceptor.api.Pointcut thePointcut, org.hl7.fhir.instance.model.api.IBaseResource theResourceToDelete) -
hookDeleteExpunge
public void hookDeleteExpunge(RequestDetails theRequestDetails, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
initiateBulkExport
public void initiateBulkExport(RequestDetails theRequestDetails, BulkDataExportOptions theBulkExportOptions, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
hookResourcePreCreate
public void hookResourcePreCreate(RequestDetails theRequest, org.hl7.fhir.instance.model.api.IBaseResource theResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
hookResourcePreDelete
public void hookResourcePreDelete(RequestDetails theRequest, org.hl7.fhir.instance.model.api.IBaseResource theResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut) -
hookResourcePreUpdate
public void hookResourcePreUpdate(RequestDetails theRequest, org.hl7.fhir.instance.model.api.IBaseResource theOldResource, org.hl7.fhir.instance.model.api.IBaseResource theNewResource, ca.uhn.fhir.interceptor.api.Pointcut thePointcut)
-