Browse Source

HDFS-8337. Accessing httpfs via webhdfs doesn't work from a jar with kerberos. Contributed by Yongjun Zhang.

(cherry picked from commit 971dc838ecf8bf55a9bd64128ce2447e4613ea76)
Yongjun Zhang 10 years ago
parent
commit
d657e378ad

+ 5 - 0
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSAuthenticationFilter.java

@@ -20,8 +20,10 @@ package org.apache.hadoop.fs.http.server;
 import org.apache.commons.io.Charsets;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.web.WebHdfsConstants;
 import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
 import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter;
+import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticationHandler;
 
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
@@ -92,6 +94,9 @@ public class HttpFSAuthenticationFilter
     } catch (IOException ex) {
       throw new RuntimeException("Could not read HttpFS signature secret file: " + signatureSecretFile);
     }
+    setAuthHandlerClass(props);
+    props.setProperty(KerberosDelegationTokenAuthenticationHandler.TOKEN_KIND,
+        WebHdfsConstants.WEBHDFS_TOKEN_KIND.toString());
     return props;
   }
 

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -730,6 +730,9 @@ Release 2.7.1 - UNRELEASED
     HDFS-8626. Reserved RBW space is not released if creation of RBW File
     fails. (kanaka kumar avvaru via Arpit Agarwal)
 
+    HDFS-8337. Accessing httpfs via webhdfs doesn't work from a jar with
+    kerberos. (Yongjun Zhang)
+
 Release 2.7.0 - 2015-04-20
 
   INCOMPATIBLE CHANGES