pzampino commented on a change in pull request #445:
URL: https://github.com/apache/knox/pull/445#discussion_r625797509



##########
File path: 
gateway-provider-security-hadoopauth/src/main/java/org/apache/knox/gateway/hadoopauth/filter/HadoopAuthFilter.java
##########
@@ -201,6 +246,86 @@ public Principal getUserPrincipal() {
     super.doFilter(filterChain, request, response);
   }
 
+  /**
+   * A helper method that checks whether request contains
+   * unauthenticated path
+   * @param request
+   * @return
+   */
+  private boolean doesRequestContainUnauthPath(final ServletRequest request) {
+    for (final String path : unAuthenticatedPaths) {
+      /* make sure the path matches EXACTLY to prevent auth bypass */
+      if (((HttpServletRequest) request).getPathInfo().equals(path)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * A function that let's configured unauthenticated path requests to
+   * pass through without requiring authentication.
+   * An anonymous subject is created and the request is audited.
+   *
+   * Fail gracefully by logging error message.
+   * @param request
+   * @param response
+   * @param chain
+   */
+  private void checkForUnauthenticatedPaths(final ServletRequest request,

Review comment:
       Nevermind...I saw the follow-on commit.

##########
File path: 
gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTFederationFilter.java
##########
@@ -186,4 +215,46 @@ protected void handleValidationError(HttpServletRequest 
request, HttpServletResp
     }
   }
 
+  /**
+   * A helper method that checks whether request contains
+   * unauthenticated path
+   * @param request
+   * @return
+   */
+  private boolean doesRequestContainUnauthPath(final ServletRequest request) {
+    for (final String path : unAuthenticatedPaths) {
+      if (((HttpServletRequest) request).getPathInfo().equals(path)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * A function that let's configured unauthenticated path requests to
+   * pass through without requiring authentication.
+   * An anonymous subject is created and the request is audited.
+   *
+   * Fail gracefully by logging error message.
+   * @param request
+   * @param response
+   * @param chain
+   */
+  private void checkForUnauthenticatedPaths(final ServletRequest request,

Review comment:
       Nevermind...I saw the follow-on commit.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to