You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/22 15:36:26 UTC

[activemq-artemis] branch main updated: ARTEMIS-3902 Adding reason to Audit Security Message

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new db8f530256 ARTEMIS-3902 Adding reason to Audit Security Message
db8f530256 is described below

commit db8f530256dd374f14c3dce1adcf35f0e761113c
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Fri Jul 22 11:22:30 2022 -0400

    ARTEMIS-3902 Adding reason to Audit Security Message
---
 .../main/java/org/apache/activemq/artemis/logs/AuditLogger.java   | 8 ++++----
 .../activemq/artemis/core/security/impl/SecurityStoreImpl.java    | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java
index 5633997375..7b9cdec1ff 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java
@@ -2267,13 +2267,13 @@ public interface AuditLogger extends BasicLogger {
    void handleManagementMessage2(String user, Object source, Object... args);
 
 
-   static void securityFailure(Exception cause) {
-      BASE_LOGGER.securityFailure(getCaller(), cause);
+   static void securityFailure(Exception cause, String reason) {
+      BASE_LOGGER.securityFailure(getCaller(), reason, cause);
    }
 
    @LogMessage(level = Logger.Level.INFO)
-   @Message(id = 601264, value = "User {0} gets security check failure", format = Message.Format.MESSAGE_FORMAT)
-   void securityFailure(String user, @Cause Throwable cause);
+   @Message(id = 601264, value = "User {0} gets security check failure, reason={1}", format = Message.Format.MESSAGE_FORMAT)
+   void securityFailure(String user, String reason, @Cause Throwable cause);
 
 
    static void createCoreConsumer(Object source, Subject user, String remoteAddress, Object... args) {
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
index 67613fe8fe..4971e091b0 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
@@ -290,7 +290,7 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC
             } else {
                ex = ActiveMQMessageBundle.BUNDLE.userNoPermissionsQueue(session.getUsername(), checkType, bareQueue, bareAddress);
             }
-            AuditLogger.securityFailure(ex);
+            AuditLogger.securityFailure(ex, ex.getMessage());
             throw ex;
          }