pzampino commented on a change in pull request #488:
URL: https://github.com/apache/knox/pull/488#discussion_r706464585
##########
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:
Is this necessary to update the context content? It seems we're getting
the context from the auditService, and then we have to attach it again?
##########
File path:
gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
##########
@@ -60,7 +61,9 @@ public void doFilter(ServletRequest request, ServletResponse
response, FilterCha
}
Subject subject = new Subject();
subject.getPrincipals().add(new PrimaryPrincipal(principal));
- auditService.getContext().setUsername( principal ); //KM: Audit Fix
+ AuditContext context = auditService.getContext();
+ context.setUsername( principal );
+ auditService.attachContext(context);
Review comment:
Is this necesary?
##########
File path:
gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
##########
@@ -527,41 +523,35 @@ public void
testRequestXmlBodyRewriteWithFilterInitParam() throws Exception {
@Test
public void
testRequestXmlBodyRewriteWithFilterInitParamForInvalidFilterConfig() throws
Exception {
- Enumeration<Appender> realAppenders =
NoOpAppender.setUpAndReturnOriginalAppenders();
- try {
-
- Map<String,String> initParams = new HashMap<>();
- initParams.put( "request.body", "test-filter-3" );
- testSetUp( initParams );
-
- String input = "<root
url='http://mock-host:42/test-input-path-1'><url>http://mock-host:42/test-input-path-2</url></root>";
- String expect = "<root
url='http://mock-host:42/test-input-path-2'><url>http://mock-host:42/test-input-path-2</url></root>";
-
- // Setup the server side request/response interaction.
- interaction.expect()
- .method( "PUT" )
- .requestUrl( "http://mock-host:42/test-output-path-1" )
- .contentType( "text/xml" )
- .characterEncoding( StandardCharsets.UTF_8.name() )
- .content( expect, StandardCharsets.UTF_8 );
- interaction.respond()
- .status( 200 );
- interactions.add( interaction );
- request.setMethod( "PUT" );
- request.setURI( "/test-input-path" );
- //request.setVersion( "HTTP/1.1" );
- request.setHeader( "Host", "mock-host:42" );
- request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
- request.setContent( input );
-
- // Execute the request.
- response = TestUtils.execute( server, request );
-
- // Test the results.
- assertThat( response.getStatus(), is( 500 ) );
- } finally {
- NoOpAppender.resetOriginalAppenders( realAppenders );
- }
+ Map<String,String> initParams = new HashMap<>();
Review comment:
What happened to the appender handling? Is it done in config now?
--
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]