Class AuditEventPublisherImpl

  • All Implemented Interfaces:
    AuditEventPublisher

    @Singleton
    public class AuditEventPublisherImpl
    extends Object
    implements AuditEventPublisher
    Responsible for publishing locally created audit events to the AuditService.
    Since:
    13.0.0
    • Constructor Detail

      • AuditEventPublisherImpl

        @Inject
        public AuditEventPublisherImpl​(AuditServiceProvider auditServiceProvider)
        Constructs a new AuditEventPublisher.
        Parameters:
        auditServiceProvider - A AuditServiceProvider instance.
    • Method Detail

      • tryPublish

        public void tryPublish​(String topic,
                               org.forgerock.audit.events.AuditEvent auditEvent)
        Description copied from interface: AuditEventPublisher
        Tries to publish the provided AuditEvent to the specified topic of the AuditService.

        If an error occurs that prevents the AuditEvent from being published, then details regarding the error are recorded in the debug logs. However, only details relating to the error are logged; the debug logs are not treated as the fallback destination for audit information.

        Specified by:
        tryPublish in interface AuditEventPublisher
        Parameters:
        topic - Coarse-grained categorization of the AuditEvent's type.
        auditEvent - The AuditEvent to publish.
      • isAuditing

        public boolean isAuditing​(String realm,
                                  String topic,
                                  AuditConstants.EventName eventName)
        Description copied from interface: AuditEventPublisher
        Determines if the audit service is auditing the specified topic in the specified realm. If the realm is either null or empty, the check will be done against the default audit service. Note that We deliberately do not provide a convenience method with no realm to force implementers to consider providing the realm. We must publish per realm wherever applicable.
        Specified by:
        isAuditing in interface AuditEventPublisher
        Parameters:
        realm - The realm in which the audit event occurred, or null if realm is not applicable.
        topic - The auditing topic.
        eventName - The event name, may be null if not known.
        Returns:
        true if the topic should be audited.