From common-commits-return-90480-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed Nov 7 03:09:14 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A8D1018072F for ; Wed, 7 Nov 2018 03:09:13 +0100 (CET) Received: (qmail 46085 invoked by uid 500); 7 Nov 2018 02:09:02 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 43702 invoked by uid 99); 7 Nov 2018 02:09:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2018 02:09:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BA1C8E1232; Wed, 7 Nov 2018 02:08:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brahma@apache.org To: common-commits@hadoop.apache.org Date: Wed, 07 Nov 2018 02:09:25 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [27/37] hadoop git commit: HDFS-14051. Refactor NameNodeHttpServer#initWebHdfs to specify local keytab. Contributed by CR Hota. HDFS-14051. Refactor NameNodeHttpServer#initWebHdfs to specify local keytab. Contributed by CR Hota. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f0ce0729 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f0ce0729 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f0ce0729 Branch: refs/heads/HDFS-13891 Commit: f0ce072934515d39e9bf61744058ecad3393291e Parents: 3d5cc11 Author: Inigo Goiri Authored: Tue Nov 6 10:05:58 2018 -0800 Committer: Inigo Goiri Committed: Tue Nov 6 10:05:58 2018 -0800 ---------------------------------------------------------------------- .../server/federation/router/RouterHttpServer.java | 4 ++-- .../hdfs/server/namenode/NameNodeHttpServer.java | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/f0ce0729/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHttpServer.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHttpServer.java index 0cf884f..d223e2a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterHttpServer.java @@ -89,8 +89,8 @@ public class RouterHttpServer extends AbstractService { this.httpServer = builder.build(); - NameNodeHttpServer.initWebHdfs(conf, httpAddress.getHostName(), httpServer, - RouterWebHdfsMethods.class.getPackage().getName()); + NameNodeHttpServer.initWebHdfs(conf, httpAddress.getHostName(), null, + httpServer, RouterWebHdfsMethods.class.getPackage().getName()); this.httpServer.setAttribute(NAMENODE_ATTRIBUTE_KEY, this.router); this.httpServer.setAttribute(JspHelper.CURRENT_CONF, this.conf); http://git-wip-us.apache.org/repos/asf/hadoop/blob/f0ce0729/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java index ae9c7fe..1bc43b8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java @@ -77,6 +77,7 @@ public class NameNodeHttpServer { } public static void initWebHdfs(Configuration conf, String hostname, + String httpKeytab, HttpServer2 httpServer2, String jerseyResourcePackage) throws IOException { // set user pattern based on configuration file @@ -94,7 +95,8 @@ public class NameNodeHttpServer { final String name = className; final String pathSpec = WebHdfsFileSystem.PATH_PREFIX + "/*"; - Map params = getAuthFilterParams(conf, hostname); + Map params = getAuthFilterParams(conf, hostname, + httpKeytab); HttpServer2.defineFilter(httpServer2.getWebAppContext(), name, className, params, new String[] { pathSpec }); HttpServer2.LOG.info("Added filter '" + name + "' (class=" + className @@ -167,8 +169,9 @@ public class NameNodeHttpServer { httpServer.setAttribute(DFSConfigKeys.DFS_DATANODE_HTTPS_PORT_KEY, datanodeSslPort.getPort()); } - - initWebHdfs(conf, bindAddress.getHostName(), httpServer, + String httpKeytab = conf.get(DFSUtil.getSpnegoKeytabKey(conf, + DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY)); + initWebHdfs(conf, bindAddress.getHostName(), httpKeytab, httpServer, NamenodeWebHdfsMethods.class.getPackage().getName()); httpServer.setAttribute(NAMENODE_ATTRIBUTE_KEY, nn); @@ -191,7 +194,7 @@ public class NameNodeHttpServer { } private static Map getAuthFilterParams(Configuration conf, - String hostname) throws IOException { + String hostname, String httpKeytab) throws IOException { Map params = new HashMap(); // Select configs beginning with 'dfs.web.authentication.' Iterator> iterator = conf.iterator(); @@ -214,8 +217,6 @@ public class NameNodeHttpServer { DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY + "' is not set."); } - String httpKeytab = conf.get(DFSUtil.getSpnegoKeytabKey(conf, - DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY)); if (httpKeytab != null && !httpKeytab.isEmpty()) { params.put( DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY, --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org