zeroflag commented on a change in pull request #488:
URL: https://github.com/apache/knox/pull/488#discussion_r707223972
##########
File path:
gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/AbstractIdentityAssertionFilter.java
##########
@@ -110,7 +111,9 @@ protected void
continueChainAsPrincipal(HttpServletRequestWrapper request, Servl
if (primaryPrincipal != null) {
if (!primaryPrincipal.getName().equals(mappedPrincipalName)) {
impersonationNeeded = true;
- auditService.getContext().setProxyUsername( mappedPrincipalName );
+ AuditContext context = auditService.getContext();
+ context.setProxyUsername( mappedPrincipalName );
+ auditService.attachContext(context);
Review comment:
In log4j1 the `MDC` held a reference to an object, so changing the
`proxyUserName` on this object changed the `MDC` as well. But in log4j2 there
is a `ThreadContext` instead of `MDC` which can hold only key value pairs. So
changing the `proxyUserName` on the `AuditContext` won't change the the
threadContext without reattaching (thus populating the key values) again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]