henrib commented on code in PR #5561:
URL: https://github.com/apache/hive/pull/5561#discussion_r1876495735


##########
common/src/java/org/apache/hive/http/HttpServer.java:
##########
@@ -702,6 +714,12 @@ private void initializeWebServer(final Builder b, int 
queueSize) throws IOExcept
       logCtx.setResourceBase(logDir);
       logCtx.setDisplayName("logs");
     }
+

Review Comment:
   A comment would be nice; for each global filer, add a dedicated filter for 
each context handlers (if this is what the code actual intends :-))



##########
service/src/java/org/apache/hive/service/servlet/LDAPAuthenticationFilter.java:
##########
@@ -44,29 +46,28 @@ public LDAPAuthenticationFilter(LdapAuthService 
ldapAuthService) {
 
   public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
       throws IOException, ServletException {
-
     HttpServletRequest httpRequest = (HttpServletRequest) request;
-    String requestURI = httpRequest.getRequestURI();
-
-    boolean isLoginFormRequest = requestURI.endsWith(LOGIN_FORM_URI);
-    boolean isLoginServletRequest = requestURI.endsWith(LOGIN_SERVLET_URI);
     boolean isLoggedIn = ldapAuthService.authenticate(httpRequest, 
(HttpServletResponse) response);
-
-    if (isLoggedIn && (isLoginFormRequest || isLoginServletRequest)) {
-      // User is already logged in, and is trying to login again; forward to 
the main homepage
-      RequestDispatcher dispatcher = 
request.getRequestDispatcher(HiveServer2.HS2_WEBUI_ROOT_URI);
+    boolean forwardRequest = (isLoginRequest(httpRequest) && isLoggedIn) || 
(!isLoginRequest(httpRequest) && !isLoggedIn);

Review Comment:
   boolean forwardRequest = isLoginRequest(httpRequest) == isLoggedIn;



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to