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