HADOOP-13422. ZKDelegationTokenSecretManager JaasConfig does not work well with other ZK users in process. Contributed by Sergey Shelukhin.

This commit is contained in:
Chris Nauroth 2016-07-26 15:33:20 -07:00
parent 5aace38b74
commit 255ea45e50
2 changed files with 8 additions and 2 deletions

View File

@ -436,6 +436,8 @@ public List<ACL> getAclForPath(String path) {
@InterfaceAudience.Private @InterfaceAudience.Private
public static class JaasConfiguration extends Configuration { public static class JaasConfiguration extends Configuration {
private final javax.security.auth.login.Configuration baseConfig =
javax.security.auth.login.Configuration.getConfiguration();
private static AppConfigurationEntry[] entry; private static AppConfigurationEntry[] entry;
private String entryName; private String entryName;
@ -468,7 +470,8 @@ public JaasConfiguration(String entryName, String principal, String keytab) {
@Override @Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) { public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
return (entryName.equals(name)) ? entry : null; return (entryName.equals(name)) ? entry : ((baseConfig != null)
? baseConfig.getAppConfigurationEntry(name) : null);
} }
private String getKrb5LoginModuleName() { private String getKrb5LoginModuleName() {

View File

@ -242,6 +242,8 @@ private String setJaasConfiguration(Configuration config) throws Exception {
public static class JaasConfiguration extends public static class JaasConfiguration extends
javax.security.auth.login.Configuration { javax.security.auth.login.Configuration {
private final javax.security.auth.login.Configuration baseConfig =
javax.security.auth.login.Configuration.getConfiguration();
private static AppConfigurationEntry[] entry; private static AppConfigurationEntry[] entry;
private String entryName; private String entryName;
@ -277,7 +279,8 @@ public JaasConfiguration(String entryName, String principal, String keytab) {
@Override @Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) { public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
return (entryName.equals(name)) ? entry : null; return (entryName.equals(name)) ? entry : ((baseConfig != null)
? baseConfig.getAppConfigurationEntry(name) : null);
} }
private String getKrb5LoginModuleName() { private String getKrb5LoginModuleName() {