Skip to content

Commit 139f017

Browse files
authored
KNOX-3104 - Add groups to the RemoteAuthProvider audit entry (apache#1000)
1 parent cdf6e80 commit 139f017

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gateway-provider-security-authc-remote/src/main/java/org/apache/knox/gateway/filter/RemoteAuthFilter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
178178
context.setUsername( principalName );
179179
auditService.attachContext(context);
180180
String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
181-
auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
181+
auditor.audit(Action.AUTHENTICATION, sourceUri, ResourceType.URI,
182+
ActionOutcome.SUCCESS, "Groups: " + Arrays.toString(subject.getPrincipals(GroupPrincipal.class)
183+
.stream()
184+
.map(GroupPrincipal::getName)
185+
.toArray(String[]::new)));
182186
}
183187

184188
continueWithEstablishedSecurityContext(subject, httpRequest, httpResponse, filterChain);

0 commit comments

Comments
 (0)