Class DefaultAuditContext
java.lang.Object
org.openehealth.ipf.commons.audit.DefaultAuditContext
- All Implemented Interfaces:
AuditContext
- Direct Known Subclasses:
DefaultBalpAuditContext
Default implementation of an AuditContext. By default, audit is written to localhost:514 via UDP.
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
-
Method Summary
Modifier and TypeMethodDescriptionReturns audit metadata e.g. for populating the RFC 5424 headerint
Returns 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.ContextRegistry
Returns a registry ofThreadLocalAccessor
instances that are used to propagate context when asynchronously queuing audit records.<T extends FhirAuditDatasetEnricher>
T<T extends WsAuditDatasetEnricher>
Tboolean
boolean
Determines whether participant object records shall be added to the audit message that are derived from the response of a request.void
setAuditEnabled
(boolean auditEnabled) void
setAuditEnterpriseSiteId
(String auditEnterpriseSiteId) void
setAuditExceptionHandler
(AuditExceptionHandler auditExceptionHandler) void
setAuditMessagePostProcessor
(AuditMessagePostProcessor auditMessagePostProcessor) void
setAuditMessageQueue
(AuditMessageQueue auditMessageQueue) void
setAuditMetadataProvider
(AuditMetadataProvider auditMetadataProvider) void
setAuditRepositoryHost
(String host) void
setAuditRepositoryHostName
(String auditRepositoryHostName) void
setAuditRepositoryPort
(int auditRepositoryPort) void
setAuditRepositoryTransport
(String transport) void
setAuditSource
(AuditSource auditSource) void
setAuditSourceId
(String auditSourceId) void
setAuditTransmissionProtocol
(AuditTransmissionProtocol auditTransmissionProtocol) void
setAuditValueIfMissing
(String auditValueIfMissing) void
setFhirAuditDatasetEnricher
(FhirAuditDatasetEnricher fhirAuditDatasetEnricher) void
setIncludeParticipantsFromResponse
(boolean includeParticipantsFromResponse) void
setSerializationStrategy
(SerializationStrategy serializationStrategy) void
setTlsParameters
(TlsParameters tlsParameters) void
setWsAuditDatasetEnricher
(WsAuditDatasetEnricher wsAuditDatasetEnricher) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openehealth.ipf.commons.audit.AuditContext
audit
-
Constructor Details
-
DefaultAuditContext
public DefaultAuditContext()
-
-
Method Details
-
getAuditRepositoryTransport
-
setAuditRepositoryHost
-
setAuditRepositoryTransport
-
getSendingApplication
- Specified by:
getSendingApplication
in interfaceAuditContext
- Returns:
- sending application
-
getAuditRepositoryAddress
- Specified by:
getAuditRepositoryAddress
in interfaceAuditContext
- Returns:
- address of the audit repository
-
getWsAuditDatasetEnricher
- Specified by:
getWsAuditDatasetEnricher
in interfaceAuditContext
- Returns:
- Audit dataset enricher for Web Service based transactions.
-
getFhirAuditDatasetEnricher
- Specified by:
getFhirAuditDatasetEnricher
in interfaceAuditContext
- Returns:
- Audit dataset enricher for FHIR based transactions.
-
getAuditRepositoryHostName
- Specified by:
getAuditRepositoryHostName
in interfaceAuditContext
- Returns:
- hostname of the audit repository
-
setAuditRepositoryHostName
-
getAuditRepositoryPort
public int getAuditRepositoryPort()- Specified by:
getAuditRepositoryPort
in interfaceAuditContext
- Returns:
- port of the audit repository
-
setAuditRepositoryPort
public void setAuditRepositoryPort(int auditRepositoryPort) -
isAuditEnabled
public boolean isAuditEnabled()- Specified by:
isAuditEnabled
in interfaceAuditContext
- Returns:
- true if auditing is enabled, false otherwise
-
setAuditEnabled
public void setAuditEnabled(boolean auditEnabled) -
getAuditTransmissionProtocol
- Specified by:
getAuditTransmissionProtocol
in interfaceAuditContext
- Returns:
- the wire protocol to be used
-
setAuditTransmissionProtocol
-
getAuditMessageQueue
- Specified by:
getAuditMessageQueue
in interfaceAuditContext
- Returns:
- the queue implementation to be used
-
setAuditMessageQueue
-
getAuditSourceId
- Specified by:
getAuditSourceId
in interfaceAuditContext
- Returns:
- Source ID attribute of the audit event
-
setAuditSourceId
-
getAuditEnterpriseSiteId
- Specified by:
getAuditEnterpriseSiteId
in interfaceAuditContext
- Returns:
- Enterprise site ID attribute of the audit event
-
setAuditEnterpriseSiteId
-
getAuditSource
- Specified by:
getAuditSource
in interfaceAuditContext
- Returns:
- type of audit source
-
setAuditSource
-
getSerializationStrategy
- Specified by:
getSerializationStrategy
in interfaceAuditContext
- Returns:
- the serialization strategy (defaults to the latest relevant DICOM version)
-
setSerializationStrategy
-
getAuditMessagePostProcessor
- Specified by:
getAuditMessagePostProcessor
in interfaceAuditContext
- Returns:
- a post-processor for audit messages (defaults to a NO-OP implementation
-
setAuditMessagePostProcessor
-
getAuditExceptionHandler
- Specified by:
getAuditExceptionHandler
in interfaceAuditContext
- Returns:
- exception handler
-
setAuditExceptionHandler
-
getAuditMetadataProvider
Description copied from interface:AuditContext
Returns audit metadata e.g. for populating the RFC 5424 header- Specified by:
getAuditMetadataProvider
in interfaceAuditContext
- Returns:
- audit metadata
-
setAuditMetadataProvider
-
getTlsParameters
- Specified by:
getTlsParameters
in interfaceAuditContext
- Returns:
- the SSL socket factory to be used for TLS-based connections
-
setTlsParameters
-
isIncludeParticipantsFromResponse
public boolean isIncludeParticipantsFromResponse()Description copied from interface:AuditContext
Determines 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:
isIncludeParticipantsFromResponse
in interfaceAuditContext
- Returns:
- true if participant object records shall be added, otherwise false
-
setIncludeParticipantsFromResponse
public void setIncludeParticipantsFromResponse(boolean includeParticipantsFromResponse) -
getAuditValueIfMissing
Description copied from interface:AuditContext
Returns 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:
getAuditValueIfMissing
in 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:AuditContext
Returns a registry ofThreadLocalAccessor
instances that are used to propagate context when asynchronously queuing audit records.- Specified by:
getContextRegistry
in interfaceAuditContext
- Returns:
- context registry
-