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

(cherry picked from commit 971dc838ec)
This commit is contained in:
Yongjun Zhang 2015-06-19 23:39:13 -07:00
parent 5c3070dc16
commit d657e378ad
2 changed files with 8 additions and 0 deletions

View File

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

View File

@ -730,6 +730,9 @@ Release 2.7.1 - UNRELEASED
HDFS-8626. Reserved RBW space is not released if creation of RBW File HDFS-8626. Reserved RBW space is not released if creation of RBW File
fails. (kanaka kumar avvaru via Arpit Agarwal) 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 Release 2.7.0 - 2015-04-20
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES