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 17:52:33 UTC

[activemq-artemis] 39/42: ARTEMIS-3902 Adding Reason to Security Exception

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

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

commit 47a66ec9ffbd5b54a1708a443e1058c16db95f22
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Fri Jul 22 11:46:35 2022 -0400

    ARTEMIS-3902 Adding Reason to Security Exception
---
 .../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 705f3af314..75e406d240 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
@@ -1994,12 +1994,12 @@ public interface AuditLogger {
    void handleManagementMessage2(String user, Object source, String args);
 
 
-   static void securityFailure(Exception cause) {
-      BASE_LOGGER.securityFailure(getCaller(), cause);
+   static void securityFailure(String reason, Exception cause) {
+      BASE_LOGGER.securityFailure(getCaller(), reason, cause);
    }
 
-   @LogMessage(id = 601264, value = "User {} gets security check failure", level = LogMessage.Level.INFO)
-   void securityFailure(String user, Throwable cause);
+   @LogMessage(id = 601264, value = "User {} gets security check failure, reason = {}", level = LogMessage.Level.INFO)
+   void securityFailure(String user, String reason, 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 fd13dd79bd..06c454e98a 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
@@ -291,7 +291,7 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC
             } else {
                ex = ActiveMQMessageBundle.BUNDLE.userNoPermissionsQueue(session.getUsername(), checkType, bareQueue, bareAddress);
             }
-            AuditLogger.securityFailure(ex);
+            AuditLogger.securityFailure(ex.getMessage(), ex);
             throw ex;
          }