HADOOP-14029. Fix KMSClientProvider for non-secure proxyuser use case. Contributed by Xiaoyu Yao.
(cherry picked from commit 2034315763
)
This commit is contained in:
parent
17d4ba26fc
commit
6b602c6e34
|
@ -1063,13 +1063,14 @@ public class KMSClientProvider extends KeyProvider implements CryptoExtension,
|
||||||
// Use real user for proxy user
|
// Use real user for proxy user
|
||||||
actualUgi = currentUgi.getRealUser();
|
actualUgi = currentUgi.getRealUser();
|
||||||
}
|
}
|
||||||
|
if (UserGroupInformation.isSecurityEnabled() &&
|
||||||
if (!containsKmsDt(actualUgi) &&
|
!containsKmsDt(actualUgi) &&
|
||||||
!actualUgi.hasKerberosCredentials()) {
|
!actualUgi.hasKerberosCredentials()) {
|
||||||
// Use login user for user that does not have either
|
// Use login user is only necessary when Kerberos is enabled
|
||||||
|
// but the actual user does not have either
|
||||||
// Kerberos credential or KMS delegation token for KMS operations
|
// Kerberos credential or KMS delegation token for KMS operations
|
||||||
LOG.debug("using loginUser no KMS Delegation Token "
|
LOG.debug("Using loginUser when Kerberos is enabled but the actual user" +
|
||||||
+ "no Kerberos Credentials");
|
" does not have either KMS Delegation Token or Kerberos Credentials");
|
||||||
actualUgi = UserGroupInformation.getLoginUser();
|
actualUgi = UserGroupInformation.getLoginUser();
|
||||||
}
|
}
|
||||||
return actualUgi;
|
return actualUgi;
|
||||||
|
|
|
@ -2284,7 +2284,11 @@ public class TestKMS {
|
||||||
|
|
||||||
public void doWebHDFSProxyUserTest(final boolean kerberos) throws Exception {
|
public void doWebHDFSProxyUserTest(final boolean kerberos) throws Exception {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.set("hadoop.security.authentication", "kerberos");
|
if (kerberos) {
|
||||||
|
conf.set("hadoop.security.authentication", "kerberos");
|
||||||
|
}
|
||||||
|
UserGroupInformation.setConfiguration(conf);
|
||||||
|
|
||||||
final File testDir = getTestDir();
|
final File testDir = getTestDir();
|
||||||
conf = createBaseKMSConf(testDir, conf);
|
conf = createBaseKMSConf(testDir, conf);
|
||||||
if (kerberos) {
|
if (kerberos) {
|
||||||
|
|
Loading…
Reference in New Issue