This is an automated email from the ASF dual-hosted git repository.

daijy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 22a5e21  HIVE-14737: Problem accessing /logs in a Kerberized Hive 
Server 2 Web UI (Rajkumar Singh, reviewed by Daniel Dai)
22a5e21 is described below

commit 22a5e211df38a5de1cc3d1e6b15c52389aace2e1
Author: Daniel Dai <da...@cloudera.com>
AuthorDate: Wed Jun 26 21:05:38 2019 -0700

    HIVE-14737: Problem accessing /logs in a Kerberized Hive Server 2 Web UI 
(Rajkumar Singh, reviewed by Daniel Dai)
---
 common/src/java/org/apache/hive/http/HttpServer.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/common/src/java/org/apache/hive/http/HttpServer.java 
b/common/src/java/org/apache/hive/http/HttpServer.java
index bbcc67e..8968529 100644
--- a/common/src/java/org/apache/hive/http/HttpServer.java
+++ b/common/src/java/org/apache/hive/http/HttpServer.java
@@ -462,7 +462,7 @@ public class HttpServer {
   /**
    * Secure the web server with kerberos (AuthenticationFilter).
    */
-  void setupSpnegoFilter(Builder b) throws IOException {
+  void setupSpnegoFilter(Builder b, ServletContextHandler ctx) throws 
IOException {
     Map<String, String> params = new HashMap<String, String>();
     params.put("kerberos.principal",
       SecurityUtil.getServerPrincipal(b.spnegoPrincipal, b.host));
@@ -471,8 +471,7 @@ public class HttpServer {
     FilterHolder holder = new FilterHolder();
     holder.setClassName(AuthenticationFilter.class.getName());
     holder.setInitParameters(params);
-
-    ServletHandler handler = webAppContext.getServletHandler();
+    ServletHandler handler = ctx.getServletHandler();
     handler.addFilterWithMapping(
       holder, "/*", FilterMapping.ALL);
   }
@@ -565,7 +564,7 @@ public class HttpServer {
 
     if (b.useSPNEGO) {
       // Secure the web server with kerberos
-      setupSpnegoFilter(b);
+      setupSpnegoFilter(b, webAppContext);
     }
 
     if (b.enableCORS) {
@@ -648,6 +647,9 @@ public class HttpServer {
       ServletContextHandler logCtx =
         new ServletContextHandler(contexts, "/logs");
       setContextAttributes(logCtx.getServletContext(), b.contextAttrs);
+      if(b.useSPNEGO) {
+        setupSpnegoFilter(b,logCtx);
+      }
       logCtx.addServlet(AdminAuthorizedServlet.class, "/*");
       logCtx.setResourceBase(logDir);
       logCtx.setDisplayName("logs");

Reply via email to