From db8f530256dd374f14c3dce1adcf35f0e761113c Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 22 Jul 2022 11:22:30 -0400 Subject: [PATCH] ARTEMIS-3902 Adding reason to Audit Security Message --- .../org/apache/activemq/artemis/logs/AuditLogger.java | 8 ++++---- .../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; }