From 547d2b0bac3f089688157783ec2c7f7e5e39fde9 Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Thu, 4 Apr 2013 13:50:31 +0000 Subject: [PATCH] HDFS-4548. Webhdfs doesn't renegotiate SPNEGO token. Contributed by Daryn Sharp. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1464548 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java | 11 ++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 9805bd8dad0..b38694626fd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -2490,6 +2490,8 @@ Release 0.23.7 - UNRELEASED HDFS-4649. Webhdfs cannot list large directories (daryn via kihwal) + HDFS-4548. Webhdfs doesn't renegotiate SPNEGO token (daryn via kihwal) + Release 0.23.6 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java index 6f33827fa74..75b405d0514 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java @@ -156,7 +156,6 @@ public class WebHdfsFileSystem extends FileSystem private URI uri; private boolean hasInitedToken; private Token delegationToken; - private final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token(); private RetryPolicy retryPolicy = null; private Path workingDir; @@ -481,6 +480,8 @@ public class WebHdfsFileSystem extends FileSystem try { if (op.getRequireAuth()) { LOG.debug("open AuthenticatedURL connection"); + UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab(); + final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token(); conn = new AuthenticatedURL(AUTH).openConnection(url, authToken); } else { LOG.debug("open URL connection"); @@ -1006,20 +1007,12 @@ public class WebHdfsFileSystem extends FileSystem @Override public long renew(final Token token, final Configuration conf ) throws IOException, InterruptedException { - final UserGroupInformation ugi = UserGroupInformation.getLoginUser(); - // update the kerberos credentials, if they are coming from a keytab - ugi.reloginFromKeytab(); - return getWebHdfs(token, conf).renewDelegationToken(token); } @Override public void cancel(final Token token, final Configuration conf ) throws IOException, InterruptedException { - final UserGroupInformation ugi = UserGroupInformation.getLoginUser(); - // update the kerberos credentials, if they are coming from a keytab - ugi.checkTGTAndReloginFromKeytab(); - getWebHdfs(token, conf).cancelDelegationToken(token); } }