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

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

commit 00eb7e61938aec2795c9a3be2485cc0252d3266e
Author: Domenico Francesco Bruscino <[email protected]>
AuthorDate: Thu Nov 11 11:24:19 2021 +0100

    ARTEMIS-3567 Fix IllegalStateException on web console logout
    
    (cherry picked from commit 8635eb65eb8612d89e84dcb87b7a9b7b529fbcc7)
---
 .../apache/activemq/artemis/component/AuthenticationFilter.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/artemis-web/src/main/java/org/apache/activemq/artemis/component/AuthenticationFilter.java
 
b/artemis-web/src/main/java/org/apache/activemq/artemis/component/AuthenticationFilter.java
index 7f395b7..6a94d7c 100644
--- 
a/artemis-web/src/main/java/org/apache/activemq/artemis/component/AuthenticationFilter.java
+++ 
b/artemis-web/src/main/java/org/apache/activemq/artemis/component/AuthenticationFilter.java
@@ -45,8 +45,11 @@ public class AuthenticationFilter implements Filter {
          int status = ((Response) servletResponse).getStatus();
          //status 200 means that the user has been authenticated, anything 
else must be a failure
          if (status == 200) {
-            HttpSession session = ((Request) servletRequest).getSession();
-            AuditLogger.userSuccesfullyAuthenticatedInAudit(session != null ? 
(Subject) session.getAttribute("subject") : null);
+            //the hawtio logout servlet cleans the session and redirects to 
the login servlet
+            HttpSession session = ((Request) servletRequest).getSession(false);
+            if (session != null) {
+               AuditLogger.userSuccesfullyAuthenticatedInAudit(session != null 
? (Subject) session.getAttribute("subject") : null);
+            }
          } else {
             AuditLogger.userFailedAuthenticationInAudit("" + status);
          }

Reply via email to