Class CommonAudit


  • public class CommonAudit
    extends Object
    Entry point for the common audit facility.

    This class manages the AuditService instances and Audit Event Handlers that correspond to the publishers defined in OpenDJ configuration.

    In theory there should be only one instance of AuditService for all the event handlers but defining one service per handler allow to perform filtering at the DJ server level.

    • Field Detail

      • DEFAULT_TRANSACTION_ID

        public static final String DEFAULT_TRANSACTION_ID
        Transaction id used when the incoming request does not contain a transaction id.
        See Also:
        Constant Field Values
    • Constructor Detail

    • Method Detail

      • shouldTrustTransactionIds

        public boolean shouldTrustTransactionIds()
        Indicates if transactionIds received from requests should be trusted.
        Returns:
        true if transactionIds should be trusted, false otherwise
      • setTrustTransactionIds

        public void setTrustTransactionIds​(boolean shouldTrust)
        Sets the indicator for transactionIds trusting.
        Parameters:
        shouldTrust - true if transactionIds should be trusted, false otherwise
      • getRequestHandler

        public org.forgerock.json.resource.RequestHandler getRequestHandler​(LogPublisherCfg config)
                                                                     throws ConfigException
        Returns the Common Audit request handler for the provided configuration.
        Parameters:
        config - The log publisher configuration
        Returns:
        the request handler associated to the log publisher
        Throws:
        ConfigException - If an error occurs
      • addOrUpdatePublisher

        public void addOrUpdatePublisher​(LogPublisherCfg newConfig)
                                  throws ConfigException
        Adds or updates the publisher corresponding to the provided configuration to common audit.
        Parameters:
        newConfig - Configuration of the publisher
        Throws:
        ConfigException - If an error occurs.
      • removePublisher

        public void removePublisher​(LogPublisherCfg config)
                             throws ConfigException
        Removes the publisher corresponding to the provided configuration from common audit.
        Parameters:
        config - Configuration of publisher to remove
        Throws:
        ConfigException - If an error occurs.
      • shutdown

        public void shutdown()
        Shutdown common audit.
      • isCommonAuditConfig

        public boolean isCommonAuditConfig​(LogPublisherCfg config)
                                    throws ConfigException
        Indicates if the provided log publisher configuration corresponds to a common audit publisher.

        The common audit publisher may not already exist.

        This method must not be used when the corresponding configuration is deleted, because it implies checking the corresponding configuration entry in the server.

        Parameters:
        config - The log publisher configuration.
        Returns:
        true if publisher corresponds to a common audit publisher
        Throws:
        ConfigException - If an error occurs
      • isExistingCommonAuditConfig

        public boolean isExistingCommonAuditConfig​(LogPublisherCfg config)
                                            throws ConfigException
        Indicates if the provided log publisher configuration corresponds to a common audit publisher.
        Parameters:
        config - The log publisher configuration.
        Returns:
        true if publisher is defined for common audit, false otherwise
        Throws:
        ConfigException - If an error occurs
      • isHttpAccessLogEnabled

        public boolean isHttpAccessLogEnabled()
        Indicates if HTTP access logging is enabled for common audit.
        Returns:
        true if there is at least one HTTP access logger enabled for common audit.
      • getAuditServiceForHttpAccessLog

        public org.forgerock.json.resource.RequestHandler getAuditServiceForHttpAccessLog()
        Returns the audit service that manages HTTP Access logging.
        Returns:
        the request handler that accepts audit events