From 1de0723aafb4349ec9cc80bbc2f41eb71a4d4141 Mon Sep 17 00:00:00 2001 From: Patrique Legault Date: Fri, 9 Aug 2024 16:26:20 -0400 Subject: [PATCH] Adding fix for #SLING-12406 --- .../apache/sling/auth/core/impl/SlingAuthenticator.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java index 93e7316..febee7c 100644 --- a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java +++ b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java @@ -406,6 +406,9 @@ public static String getHttpAuth(final Config config) { @Override public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) { + if(request.getHeader("x-request-id") != null) { + setThreadName(request.getHeader("x-request-id")); + } // 0. Nothing to do, if the session is also in the request // this might be the case if the request is handled as a result // of a servlet container include inside another Sling request @@ -444,6 +447,10 @@ public boolean handleSecurity(HttpServletRequest request, return process; } + private void setThreadName(String xRequestId) { + Thread.currentThread().setName(xRequestId); + } + private boolean doHandleSecurity(HttpServletRequest request, HttpServletResponse response) { // 0. Check for request attribute; set if not present