|
@@ -45,8 +45,10 @@ import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier;
|
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
|
import org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.DatanodeDescriptor;
|
|
|
+import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
|
|
import org.apache.hadoop.http.HtmlQuoting;
|
|
|
import org.apache.hadoop.io.WritableUtils;
|
|
|
+import org.apache.hadoop.io.Text;
|
|
|
import org.apache.hadoop.net.NetUtils;
|
|
|
import org.apache.hadoop.security.AccessControlException;
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
@@ -280,8 +282,8 @@ public class JspHelper {
|
|
|
String[] parts = dir.split(Path.SEPARATOR);
|
|
|
StringBuilder tempPath = new StringBuilder(dir.length());
|
|
|
out.print("<a href=\"browseDirectory.jsp" + "?dir="+ Path.SEPARATOR
|
|
|
- + "&namenodeInfoPort=" + namenodeInfoPort
|
|
|
- + "\">" + Path.SEPARATOR + "</a>");
|
|
|
+ + "&namenodeInfoPort=" + namenodeInfoPort + SET_DELEGATION
|
|
|
+ + tokenString + "\">" + Path.SEPARATOR + "</a>");
|
|
|
tempPath.append(Path.SEPARATOR);
|
|
|
for (int i = 0; i < parts.length-1; i++) {
|
|
|
if (!parts[i].equals("")) {
|
|
@@ -405,6 +407,12 @@ public class JspHelper {
|
|
|
Token<DelegationTokenIdentifier> token =
|
|
|
new Token<DelegationTokenIdentifier>();
|
|
|
token.decodeFromUrlString(tokenString);
|
|
|
+ InetSocketAddress serviceAddr = NameNode.getAddress(conf);
|
|
|
+ LOG.info("Setting service in token: "
|
|
|
+ + new Text(serviceAddr.getAddress().getHostAddress() + ":"
|
|
|
+ + serviceAddr.getPort()));
|
|
|
+ token.setService(new Text(serviceAddr.getAddress().getHostAddress()
|
|
|
+ + ":" + serviceAddr.getPort()));
|
|
|
ugi = UserGroupInformation.createRemoteUser(user);
|
|
|
ugi.addToken(token);
|
|
|
ugi.setAuthenticationMethod(AuthenticationMethod.TOKEN);
|