Class DefaultAuditContext

java.lang.Object
org.openehealth.ipf.commons.audit.DefaultAuditContext
All Implemented Interfaces:
AuditContext
Direct Known Subclasses:
DefaultBalpAuditContext

public class DefaultAuditContext extends Object implements AuditContext
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 Details

    • DefaultAuditContext

      public DefaultAuditContext()
  • Method Details

    • getAuditRepositoryTransport

      public String getAuditRepositoryTransport()
    • setAuditRepositoryHost

      public void setAuditRepositoryHost(String host)
    • setAuditRepositoryTransport

      public void setAuditRepositoryTransport(String transport)
    • getSendingApplication

      public String getSendingApplication()
      Specified by:
      getSendingApplication in interface AuditContext
      Returns:
      sending application
    • getAuditRepositoryAddress

      public InetAddress getAuditRepositoryAddress()
      Specified by:
      getAuditRepositoryAddress in interface AuditContext
      Returns:
      address of the audit repository
    • getWsAuditDatasetEnricher

      public <T extends WsAuditDatasetEnricher> T getWsAuditDatasetEnricher()
      Specified by:
      getWsAuditDatasetEnricher in interface AuditContext
      Returns:
      Audit dataset enricher for Web Service based transactions.
    • getFhirAuditDatasetEnricher

      public <T extends FhirAuditDatasetEnricher> T getFhirAuditDatasetEnricher()
      Specified by:
      getFhirAuditDatasetEnricher in interface AuditContext
      Returns:
      Audit dataset enricher for FHIR based transactions.
    • getAuditRepositoryHostName

      public String getAuditRepositoryHostName()
      Specified by:
      getAuditRepositoryHostName in interface AuditContext
      Returns:
      hostname of the audit repository
    • setAuditRepositoryHostName

      public void setAuditRepositoryHostName(String auditRepositoryHostName)
    • getAuditRepositoryPort

      public int getAuditRepositoryPort()
      Specified by:
      getAuditRepositoryPort in interface AuditContext
      Returns:
      port of the audit repository
    • setAuditRepositoryPort

      public void setAuditRepositoryPort(int auditRepositoryPort)
    • isAuditEnabled

      public boolean isAuditEnabled()
      Specified by:
      isAuditEnabled in interface AuditContext
      Returns:
      true if auditing is enabled, false otherwise
    • setAuditEnabled

      public void setAuditEnabled(boolean auditEnabled)
    • getAuditTransmissionProtocol

      public AuditTransmissionProtocol getAuditTransmissionProtocol()
      Specified by:
      getAuditTransmissionProtocol in interface AuditContext
      Returns:
      the wire protocol to be used
    • setAuditTransmissionProtocol

      public void setAuditTransmissionProtocol(AuditTransmissionProtocol auditTransmissionProtocol)
    • getAuditMessageQueue

      public AuditMessageQueue getAuditMessageQueue()
      Specified by:
      getAuditMessageQueue in interface AuditContext
      Returns:
      the queue implementation to be used
    • setAuditMessageQueue

      public void setAuditMessageQueue(AuditMessageQueue auditMessageQueue)
    • getAuditSourceId

      public String getAuditSourceId()
      Specified by:
      getAuditSourceId in interface AuditContext
      Returns:
      Source ID attribute of the audit event
    • setAuditSourceId

      public void setAuditSourceId(String auditSourceId)
    • getAuditEnterpriseSiteId

      public String getAuditEnterpriseSiteId()
      Specified by:
      getAuditEnterpriseSiteId in interface AuditContext
      Returns:
      Enterprise site ID attribute of the audit event
    • setAuditEnterpriseSiteId

      public void setAuditEnterpriseSiteId(String auditEnterpriseSiteId)
    • getAuditSource

      public AuditSource getAuditSource()
      Specified by:
      getAuditSource in interface AuditContext
      Returns:
      type of audit source
    • setAuditSource

      public void setAuditSource(AuditSource auditSource)
    • getSerializationStrategy

      public SerializationStrategy getSerializationStrategy()
      Specified by:
      getSerializationStrategy in interface AuditContext
      Returns:
      the serialization strategy (defaults to the latest relevant DICOM version)
    • setSerializationStrategy

      public void setSerializationStrategy(SerializationStrategy serializationStrategy)
    • getAuditMessagePostProcessor

      public AuditMessagePostProcessor getAuditMessagePostProcessor()
      Specified by:
      getAuditMessagePostProcessor in interface AuditContext
      Returns:
      a post-processor for audit messages (defaults to a NO-OP implementation
    • setAuditMessagePostProcessor

      public void setAuditMessagePostProcessor(AuditMessagePostProcessor auditMessagePostProcessor)
    • getAuditExceptionHandler

      public AuditExceptionHandler getAuditExceptionHandler()
      Specified by:
      getAuditExceptionHandler in interface AuditContext
      Returns:
      exception handler
    • setAuditExceptionHandler

      public void setAuditExceptionHandler(AuditExceptionHandler auditExceptionHandler)
    • getAuditMetadataProvider

      public AuditMetadataProvider getAuditMetadataProvider()
      Description copied from interface: AuditContext
      Returns audit metadata e.g. for populating the RFC 5424 header
      Specified by:
      getAuditMetadataProvider in interface AuditContext
      Returns:
      audit metadata
    • setAuditMetadataProvider

      public void setAuditMetadataProvider(AuditMetadataProvider auditMetadataProvider)
    • getTlsParameters

      public TlsParameters getTlsParameters()
      Specified by:
      getTlsParameters in interface AuditContext
      Returns:
      the SSL socket factory to be used for TLS-based connections
    • setTlsParameters

      public void setTlsParameters(TlsParameters tlsParameters)
    • 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 interface AuditContext
      Returns:
      true if participant object records shall be added, otherwise false
    • setIncludeParticipantsFromResponse

      public void setIncludeParticipantsFromResponse(boolean includeParticipantsFromResponse)
    • getAuditValueIfMissing

      public String 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 interface AuditContext
      Returns:
      a value that is used when an otherwise mandatory attribute for an audit record in missing
    • setAuditValueIfMissing

      public void setAuditValueIfMissing(String auditValueIfMissing)
    • setWsAuditDatasetEnricher

      public void setWsAuditDatasetEnricher(WsAuditDatasetEnricher wsAuditDatasetEnricher)
    • setFhirAuditDatasetEnricher

      public void setFhirAuditDatasetEnricher(FhirAuditDatasetEnricher fhirAuditDatasetEnricher)
    • getContextRegistry

      public io.micrometer.context.ContextRegistry getContextRegistry()
      Description copied from interface: AuditContext
      Returns a registry of ThreadLocalAccessor instances that are used to propagate context when asynchronously queuing audit records.
      Specified by:
      getContextRegistry in interface AuditContext
      Returns:
      context registry