Class DefaultAuditContext
- All Implemented Interfaces:
AuditContext
- Direct Known Subclasses:
DefaultBalpAuditContext
The ContextRegistry returned by getContextRegistry() will always contain an instance
of Slf4jThreadLocalAccessor in order to propagate MDC context to an
potentially asynchronous auditor.
- Since:
- 3.5
- Author:
- Christian Ohr
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns audit metadata e.g. for populating the RFC 5424 headerintReturns a value that is used when an otherwise mandatory attribute for an audit record in missing (e.g. a participant object ID).io.micrometer.context.ContextRegistryReturns a registry ofThreadLocalAccessorinstances that are used to propagate context when asynchronously queuing audit records.<T extends FhirAuditDatasetEnricher>
TNames of the HTTP headers that may carry the id correlating the audit records the two ends of a transaction write about it, most preferred first.Participant object ID type to record the correlation id under, whichever ofAuditContext.getRequestIdHeaderNames()it was found in.<T extends WsAuditDatasetEnricher>
TbooleanbooleanDetermines whether participant object records shall be added to the audit message that are derived from the response of a request.voidsetAuditEnabled(boolean auditEnabled) voidsetAuditEnterpriseSiteId(String auditEnterpriseSiteId) voidsetAuditExceptionHandler(AuditExceptionHandler auditExceptionHandler) voidsetAuditMessagePostProcessor(AuditMessagePostProcessor auditMessagePostProcessor) voidsetAuditMessageQueue(AuditMessageQueue auditMessageQueue) voidsetAuditMetadataProvider(AuditMetadataProvider auditMetadataProvider) voidsetAuditRepositoryContextPath(String auditRepositoryContextPath) voidsetAuditRepositoryHost(String host) voidsetAuditRepositoryHostName(String auditRepositoryHostName) voidsetAuditRepositoryPort(int auditRepositoryPort) voidsetAuditRepositoryTransport(String transport) voidsetAuditSource(AuditSource auditSource) voidsetAuditSourceId(String auditSourceId) voidsetAuditTransmissionProtocol(AuditTransmissionProtocol auditTransmissionProtocol) voidsetAuditValueIfMissing(String auditValueIfMissing) voidsetFhirAuditDatasetEnricher(FhirAuditDatasetEnricher fhirAuditDatasetEnricher) voidsetIncludeParticipantsFromResponse(boolean includeParticipantsFromResponse) voidsetJwtExtractorProperties(JwtExtractorProperties jwtExtractorProperties) voidsetRequestIdHeaderNames(List<String> requestIdHeaderNames) voidsetRequestIdType(ParticipantObjectIdType requestIdType) voidsetSerializationStrategy(SerializationStrategy serializationStrategy) voidsetTlsParameters(TlsParameters tlsParameters) voidsetWsAuditDatasetEnricher(WsAuditDatasetEnricher wsAuditDatasetEnricher) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AuditContext
audit
-
Constructor Details
-
DefaultAuditContext
public DefaultAuditContext()
-
-
Method Details
-
getAuditRepositoryTransport
-
setAuditRepositoryHost
-
setAuditRepositoryTransport
-
getSendingApplication
- Specified by:
getSendingApplicationin interfaceAuditContext- Returns:
- sending application
-
getAuditRepositoryAddress
- Specified by:
getAuditRepositoryAddressin interfaceAuditContext- Returns:
- address of the audit repository
-
getWsAuditDatasetEnricher
- Specified by:
getWsAuditDatasetEnricherin interfaceAuditContext- Returns:
- Audit dataset enricher for Web Service based transactions.
-
getFhirAuditDatasetEnricher
- Specified by:
getFhirAuditDatasetEnricherin interfaceAuditContext- Returns:
- Audit dataset enricher for FHIR based transactions.
-
getAuditRepositoryContextPath
- Specified by:
getAuditRepositoryContextPathin interfaceAuditContext- Returns:
- context path of the audit repository, for transports that address it over HTTP. Empty unless the audit repository is reached through one.
-
setAuditRepositoryContextPath
-
getJwtExtractorProperties
- Specified by:
getJwtExtractorPropertiesin interfaceAuditContext- Returns:
- where to find the claims in an access token the audited request carried. Not tied to any audit format; the defaults point at the standard JWT claims and the IHE IUA/BPPC extensions.
-
setJwtExtractorProperties
-
getRequestIdHeaderNames
Description copied from interface:AuditContextNames of the HTTP headers that may carry the id correlating the audit records the two ends of a transaction write about it, most preferred first. The first header the request actually carries wins; a request carrying none is audited without such an id.IHE BALP asks for
RequestIdHeaders.X_REQUEST_IDand reports it as the transaction entity of an AuditEvent, which is why that is the default. A deployment that already propagates a trace can name its headers here instead --RequestIdHeaders.TRACEPARENTfor W3C Trace Context,RequestIdHeaders.B3andRequestIdHeaders.X_B3_TRACE_IDfor the single-header and multi-header flavours of B3 -- and the id is reported in the same place. Naming both B3 headers is the way to accept whichever flavour a caller happens to use; they yield the same id.Any other name works too and is then taken at face value; see
RequestIdHeadersfor the headers whose value needs more than that.- Specified by:
getRequestIdHeaderNamesin interfaceAuditContext- Returns:
- the header names to look for, most preferred first. Empty disables the lookup.
-
setRequestIdHeaderNames
-
getRequestIdType
Description copied from interface:AuditContextParticipant object ID type to record the correlation id under, whichever ofAuditContext.getRequestIdHeaderNames()it was found in. Set this only to flatten the distinction: by default the type follows the header, so that the audit record says which propagation format the id came from -- seeRequestIdHeaders.participantObjectIdType(String).A deployment whose audit repository only understands
ParticipantObjectIdTypeCode.XRequestIdwould name that one here.- Specified by:
getRequestIdTypein interfaceAuditContext- Returns:
- the participant object ID type to force, or null to let it follow the header
-
setRequestIdType
-
getAuditRepositoryHostName
- Specified by:
getAuditRepositoryHostNamein interfaceAuditContext- Returns:
- hostname of the audit repository
-
setAuditRepositoryHostName
-
getAuditRepositoryPort
public int getAuditRepositoryPort()- Specified by:
getAuditRepositoryPortin interfaceAuditContext- Returns:
- port of the audit repository
-
setAuditRepositoryPort
public void setAuditRepositoryPort(int auditRepositoryPort) -
isAuditEnabled
public boolean isAuditEnabled()- Specified by:
isAuditEnabledin interfaceAuditContext- Returns:
- true if auditing is enabled, false otherwise
-
setAuditEnabled
public void setAuditEnabled(boolean auditEnabled) -
getAuditTransmissionProtocol
- Specified by:
getAuditTransmissionProtocolin interfaceAuditContext- Returns:
- the wire protocol to be used
-
setAuditTransmissionProtocol
-
getAuditMessageQueue
- Specified by:
getAuditMessageQueuein interfaceAuditContext- Returns:
- the queue implementation to be used
-
setAuditMessageQueue
-
getAuditSourceId
- Specified by:
getAuditSourceIdin interfaceAuditContext- Returns:
- Source ID attribute of the audit event
-
setAuditSourceId
-
getAuditEnterpriseSiteId
- Specified by:
getAuditEnterpriseSiteIdin interfaceAuditContext- Returns:
- Enterprise site ID attribute of the audit event
-
setAuditEnterpriseSiteId
-
getAuditSource
- Specified by:
getAuditSourcein interfaceAuditContext- Returns:
- type of audit source
-
setAuditSource
-
getSerializationStrategy
- Specified by:
getSerializationStrategyin interfaceAuditContext- Returns:
- the serialization strategy (defaults to the latest relevant DICOM version)
-
setSerializationStrategy
-
getAuditMessagePostProcessor
- Specified by:
getAuditMessagePostProcessorin interfaceAuditContext- Returns:
- a post-processor for audit messages (defaults to a NO-OP implementation
-
setAuditMessagePostProcessor
-
getAuditExceptionHandler
- Specified by:
getAuditExceptionHandlerin interfaceAuditContext- Returns:
- exception handler
-
setAuditExceptionHandler
-
getAuditMetadataProvider
Description copied from interface:AuditContextReturns audit metadata e.g. for populating the RFC 5424 header- Specified by:
getAuditMetadataProviderin interfaceAuditContext- Returns:
- audit metadata
-
setAuditMetadataProvider
-
getTlsParameters
- Specified by:
getTlsParametersin interfaceAuditContext- Returns:
- the SSL socket factory to be used for TLS-based connections
-
setTlsParameters
-
isIncludeParticipantsFromResponse
public boolean isIncludeParticipantsFromResponse()Description copied from interface:AuditContextDetermines whether participant object records shall be added to the audit message that are derived from the response of a request. This specifically applies to query results. The DICOM audit specification states that this should not be the case, however, project and legal requirements sometimes mandate that e.g. patient identifiers being retrieved shall be audited.- Specified by:
isIncludeParticipantsFromResponsein interfaceAuditContext- Returns:
- true if participant object records shall be added, otherwise false
-
setIncludeParticipantsFromResponse
public void setIncludeParticipantsFromResponse(boolean includeParticipantsFromResponse) -
getAuditValueIfMissing
Description copied from interface:AuditContextReturns a value that is used when an otherwise mandatory attribute for an audit record in missing (e.g. a participant object ID). In this case, we can still write an audit record (e.g. documenting a failed request due to the missing attribute).This can also be set to null at the risk that building the audit record might throw an exception.
- Specified by:
getAuditValueIfMissingin interfaceAuditContext- Returns:
- a value that is used when an otherwise mandatory attribute for an audit record in missing
-
setAuditValueIfMissing
-
setWsAuditDatasetEnricher
-
setFhirAuditDatasetEnricher
-
getContextRegistry
public io.micrometer.context.ContextRegistry getContextRegistry()Description copied from interface:AuditContextReturns a registry ofThreadLocalAccessorinstances that are used to propagate context when asynchronously queuing audit records.- Specified by:
getContextRegistryin interfaceAuditContext- Returns:
- context registry
-