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
|
HDFS-4542. Webhdfs doesn't support secure proxy users (Daryn Sharp via
|
||||||
kihwal)
|
kihwal)
|
||||||
|
|
||||||
|
HDFS-4560. Webhdfs cannot use tokens obtained by another user (daryn)
|
||||||
|
|
||||||
Release 0.23.6 - UNRELEASED
|
Release 0.23.6 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -350,15 +350,15 @@ public class WebHdfsFileSystem extends FileSystem
|
||||||
} // else we are talking to an insecure cluster
|
} // else we are talking to an insecure cluster
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserGroupInformation userUgi = ugi;
|
|
||||||
if (!hasToken) {
|
if (!hasToken) {
|
||||||
|
UserGroupInformation userUgi = ugi;
|
||||||
UserGroupInformation realUgi = userUgi.getRealUser();
|
UserGroupInformation realUgi = userUgi.getRealUser();
|
||||||
if (realUgi != null) { // proxy user
|
if (realUgi != null) { // proxy user
|
||||||
authParams.add(new DoAsParam(userUgi.getShortUserName()));
|
authParams.add(new DoAsParam(userUgi.getShortUserName()));
|
||||||
userUgi = realUgi;
|
userUgi = realUgi;
|
||||||
}
|
}
|
||||||
|
authParams.add(new UserParam(userUgi.getShortUserName()));
|
||||||
}
|
}
|
||||||
authParams.add(new UserParam(userUgi.getShortUserName()));
|
|
||||||
return authParams.toArray(new Param<?,?>[0]);
|
return authParams.toArray(new Param<?,?>[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,24 +134,22 @@ public class TestWebHdfsUrl {
|
||||||
},
|
},
|
||||||
renewTokenUrl);
|
renewTokenUrl);
|
||||||
|
|
||||||
// send user+token
|
// send token
|
||||||
URL cancelTokenUrl = webhdfs.toUrl(PutOpParam.Op.CANCELDELEGATIONTOKEN,
|
URL cancelTokenUrl = webhdfs.toUrl(PutOpParam.Op.CANCELDELEGATIONTOKEN,
|
||||||
fsPath, new TokenArgumentParam(tokenString));
|
fsPath, new TokenArgumentParam(tokenString));
|
||||||
checkQueryParams(
|
checkQueryParams(
|
||||||
new String[]{
|
new String[]{
|
||||||
PutOpParam.Op.CANCELDELEGATIONTOKEN.toQueryString(),
|
PutOpParam.Op.CANCELDELEGATIONTOKEN.toQueryString(),
|
||||||
new UserParam(ugi.getShortUserName()).toString(),
|
|
||||||
new TokenArgumentParam(tokenString).toString(),
|
new TokenArgumentParam(tokenString).toString(),
|
||||||
new DelegationParam(tokenString).toString()
|
new DelegationParam(tokenString).toString()
|
||||||
},
|
},
|
||||||
cancelTokenUrl);
|
cancelTokenUrl);
|
||||||
|
|
||||||
// send user+token
|
// send token
|
||||||
URL fileStatusUrl = webhdfs.toUrl(GetOpParam.Op.GETFILESTATUS, fsPath);
|
URL fileStatusUrl = webhdfs.toUrl(GetOpParam.Op.GETFILESTATUS, fsPath);
|
||||||
checkQueryParams(
|
checkQueryParams(
|
||||||
new String[]{
|
new String[]{
|
||||||
GetOpParam.Op.GETFILESTATUS.toQueryString(),
|
GetOpParam.Op.GETFILESTATUS.toQueryString(),
|
||||||
new UserParam(ugi.getShortUserName()).toString(),
|
|
||||||
new DelegationParam(tokenString).toString()
|
new DelegationParam(tokenString).toString()
|
||||||
},
|
},
|
||||||
fileStatusUrl);
|
fileStatusUrl);
|
||||||
|
@ -219,24 +217,22 @@ public class TestWebHdfsUrl {
|
||||||
},
|
},
|
||||||
renewTokenUrl);
|
renewTokenUrl);
|
||||||
|
|
||||||
// send effective+token
|
// send token
|
||||||
URL cancelTokenUrl = webhdfs.toUrl(PutOpParam.Op.CANCELDELEGATIONTOKEN,
|
URL cancelTokenUrl = webhdfs.toUrl(PutOpParam.Op.CANCELDELEGATIONTOKEN,
|
||||||
fsPath, new TokenArgumentParam(tokenString));
|
fsPath, new TokenArgumentParam(tokenString));
|
||||||
checkQueryParams(
|
checkQueryParams(
|
||||||
new String[]{
|
new String[]{
|
||||||
PutOpParam.Op.CANCELDELEGATIONTOKEN.toQueryString(),
|
PutOpParam.Op.CANCELDELEGATIONTOKEN.toQueryString(),
|
||||||
new UserParam(ugi.getShortUserName()).toString(),
|
|
||||||
new TokenArgumentParam(tokenString).toString(),
|
new TokenArgumentParam(tokenString).toString(),
|
||||||
new DelegationParam(tokenString).toString()
|
new DelegationParam(tokenString).toString()
|
||||||
},
|
},
|
||||||
cancelTokenUrl);
|
cancelTokenUrl);
|
||||||
|
|
||||||
// send effective+token
|
// send token
|
||||||
URL fileStatusUrl = webhdfs.toUrl(GetOpParam.Op.GETFILESTATUS, fsPath);
|
URL fileStatusUrl = webhdfs.toUrl(GetOpParam.Op.GETFILESTATUS, fsPath);
|
||||||
checkQueryParams(
|
checkQueryParams(
|
||||||
new String[]{
|
new String[]{
|
||||||
GetOpParam.Op.GETFILESTATUS.toQueryString(),
|
GetOpParam.Op.GETFILESTATUS.toQueryString(),
|
||||||
new UserParam(ugi.getShortUserName()).toString(),
|
|
||||||
new DelegationParam(tokenString).toString()
|
new DelegationParam(tokenString).toString()
|
||||||
},
|
},
|
||||||
fileStatusUrl);
|
fileStatusUrl);
|
||||||
|
|
Loading…
Reference in New Issue