From a2d7287873685249c2ceeda49f9feadfb307f5c2 Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Thu, 6 Oct 2011 21:17:19 +0000 Subject: [PATCH] HDFS-2403. NamenodeWebHdfsMethods.generateDelegationToken(..) does not use the renewer parameter. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1179856 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../web/resources/NamenodeWebHdfsMethods.java | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index be5f7a3f3ce..0e0995514d9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -97,6 +97,9 @@ Trunk (unreleased changes) HDFS-2298. Fix TestDfsOverAvroRpc by changing ClientProtocol to not include multiple methods of the same name. (cutting) + HDFS-2403. NamenodeWebHdfsMethods.generateDelegationToken(..) does not use + the renewer parameter. (szetszwo) + Release 0.23.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java index 8e0b6b091ee..8c27eca6585 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java @@ -19,7 +19,6 @@ package org.apache.hadoop.hdfs.server.namenode.web.resources; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.net.URI; @@ -143,7 +142,8 @@ public class NamenodeWebHdfsMethods { final NameNode namenode, final UserGroupInformation ugi, final String renewer) throws IOException { final Credentials c = DelegationTokenSecretManager.createCredentials( - namenode, ugi, request.getUserPrincipal().getName()); + namenode, ugi, + renewer != null? renewer: request.getUserPrincipal().getName()); final Token t = c.getAllTokens().iterator().next(); t.setService(new Text(SecurityUtil.buildDTServiceName( NameNode.getUri(namenode.getNameNodeAddress()), @@ -189,7 +189,6 @@ public class NamenodeWebHdfsMethods { @Consumes({"*/*"}) @Produces({MediaType.APPLICATION_JSON}) public Response put( - final InputStream in, @Context final UserGroupInformation ugi, @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT) final DelegationParam delegation, @@ -218,7 +217,7 @@ public class NamenodeWebHdfsMethods { final AccessTimeParam accessTime, @QueryParam(RenameOptionSetParam.NAME) @DefaultValue(RenameOptionSetParam.DEFAULT) final RenameOptionSetParam renameOptions - ) throws IOException, URISyntaxException, InterruptedException { + ) throws IOException, InterruptedException { if (LOG.isTraceEnabled()) { LOG.trace(op + ": " + path + ", ugi=" + ugi @@ -303,7 +302,6 @@ public class NamenodeWebHdfsMethods { @Consumes({"*/*"}) @Produces({MediaType.APPLICATION_JSON}) public Response post( - final InputStream in, @Context final UserGroupInformation ugi, @QueryParam(DelegationParam.NAME) @DefaultValue(DelegationParam.DEFAULT) final DelegationParam delegation, @@ -312,7 +310,7 @@ public class NamenodeWebHdfsMethods { final PostOpParam op, @QueryParam(BufferSizeParam.NAME) @DefaultValue(BufferSizeParam.DEFAULT) final BufferSizeParam bufferSize - ) throws IOException, URISyntaxException, InterruptedException { + ) throws IOException, InterruptedException { if (LOG.isTraceEnabled()) { LOG.trace(op + ": " + path + ", ugi=" + ugi @@ -389,7 +387,7 @@ public class NamenodeWebHdfsMethods { final RenewerParam renewer, @QueryParam(BufferSizeParam.NAME) @DefaultValue(BufferSizeParam.DEFAULT) final BufferSizeParam bufferSize - ) throws IOException, URISyntaxException, InterruptedException { + ) throws IOException, InterruptedException { if (LOG.isTraceEnabled()) { LOG.trace(op + ": " + path + ", ugi=" + ugi