svn merge -c 1453955 FIXES: HDFS-4560. Webhdfs cannot use tokens obtained by another user (daryn)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1453956 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7808df2ed5
commit
a3045acb37
|
@ -2128,6 +2128,8 @@ Release 0.23.7 - UNRELEASED
|
|||
HDFS-4542. Webhdfs doesn't support secure proxy users (Daryn Sharp via
|
||||
kihwal)
|
||||
|
||||
HDFS-4560. Webhdfs cannot use tokens obtained by another user (daryn)
|
||||
|
||||
Release 0.23.6 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -350,15 +350,15 @@ public class WebHdfsFileSystem extends FileSystem
|
|||
} // else we are talking to an insecure cluster
|
||||
}
|
||||
}
|
||||
UserGroupInformation userUgi = ugi;
|
||||
if (!hasToken) {
|
||||
UserGroupInformation userUgi = ugi;
|
||||
UserGroupInformation realUgi = userUgi.getRealUser();
|
||||
if (realUgi != null) { // proxy user
|
||||
authParams.add(new DoAsParam(userUgi.getShortUserName()));
|
||||
userUgi = realUgi;
|
||||
}
|
||||
authParams.add(new UserParam(userUgi.getShortUserName()));
|
||||
}
|
||||
authParams.add(new UserParam(userUgi.getShortUserName()));
|
||||
return authParams.toArray(new Param<?,?>[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -134,24 +134,22 @@ public class TestWebHdfsUrl {
|
|||
},
|
||||
renewTokenUrl);
|
||||
|
||||
// send user+token
|
||||
// send token
|
||||
URL cancelTokenUrl = webhdfs.toUrl(PutOpParam.Op.CANCELDELEGATIONTOKEN,
|
||||
fsPath, new TokenArgumentParam(tokenString));
|
||||
checkQueryParams(
|
||||
new String[]{
|
||||
PutOpParam.Op.CANCELDELEGATIONTOKEN.toQueryString(),
|
||||
new UserParam(ugi.getShortUserName()).toString(),
|
||||
new TokenArgumentParam(tokenString).toString(),
|
||||
new DelegationParam(tokenString).toString()
|
||||
},
|
||||
cancelTokenUrl);
|
||||
|
||||
// send user+token
|
||||
// send token
|
||||
URL fileStatusUrl = webhdfs.toUrl(GetOpParam.Op.GETFILESTATUS, fsPath);
|
||||
checkQueryParams(
|
||||
new String[]{
|
||||
GetOpParam.Op.GETFILESTATUS.toQueryString(),
|
||||
new UserParam(ugi.getShortUserName()).toString(),
|
||||
new DelegationParam(tokenString).toString()
|
||||
},
|
||||
fileStatusUrl);
|
||||
|
@ -219,24 +217,22 @@ public class TestWebHdfsUrl {
|
|||
},
|
||||
renewTokenUrl);
|
||||
|
||||
// send effective+token
|
||||
// send token
|
||||
URL cancelTokenUrl = webhdfs.toUrl(PutOpParam.Op.CANCELDELEGATIONTOKEN,
|
||||
fsPath, new TokenArgumentParam(tokenString));
|
||||
checkQueryParams(
|
||||
new String[]{
|
||||
PutOpParam.Op.CANCELDELEGATIONTOKEN.toQueryString(),
|
||||
new UserParam(ugi.getShortUserName()).toString(),
|
||||
new TokenArgumentParam(tokenString).toString(),
|
||||
new DelegationParam(tokenString).toString()
|
||||
},
|
||||
cancelTokenUrl);
|
||||
|
||||
// send effective+token
|
||||
// send token
|
||||
URL fileStatusUrl = webhdfs.toUrl(GetOpParam.Op.GETFILESTATUS, fsPath);
|
||||
checkQueryParams(
|
||||
new String[]{
|
||||
GetOpParam.Op.GETFILESTATUS.toQueryString(),
|
||||
new UserParam(ugi.getShortUserName()).toString(),
|
||||
new DelegationParam(tokenString).toString()
|
||||
},
|
||||
fileStatusUrl);
|
||||
|
|
Loading…
Reference in New Issue