Commit fc0ae771 by Madhan Neethiraj

ATLAS-3667: Option to store Ldap/AD bind password in jceks keystore file - #2 (fix for NPE)

parent d727cef7
...@@ -277,15 +277,18 @@ public final class ApplicationProperties extends PropertiesConfiguration { ...@@ -277,15 +277,18 @@ public final class ApplicationProperties extends PropertiesConfiguration {
} }
private static void setLdapPasswordFromKeystore(Configuration configuration) { private static void setLdapPasswordFromKeystore(Configuration configuration) {
String ldapType = configuration.getString(LDAP_TYPE);
if (StringUtils.isNotEmpty(ldapType)) {
try { try {
if (configuration.getString(LDAP_TYPE).equalsIgnoreCase("ldap")) { if (ldapType.equalsIgnoreCase("ldap")) {
String maskPasssword = configuration.getString(LDAP_BIND_PASSWORD); String maskPasssword = configuration.getString(LDAP_BIND_PASSWORD);
if (MASK_LDAP_PASSWORD.equals(maskPasssword)) { if (MASK_LDAP_PASSWORD.equals(maskPasssword)) {
String password = SecurityUtil.getPassword(configuration, LDAP_BIND_PASSWORD); String password = SecurityUtil.getPassword(configuration, LDAP_BIND_PASSWORD);
configuration.clearProperty(LDAP_BIND_PASSWORD); configuration.clearProperty(LDAP_BIND_PASSWORD);
configuration.addProperty(LDAP_BIND_PASSWORD, password); configuration.addProperty(LDAP_BIND_PASSWORD, password);
} }
} else if (configuration.getString(LDAP_TYPE).equalsIgnoreCase("ad")) { } else if (ldapType.equalsIgnoreCase("ad")) {
String maskPasssword = configuration.getString(LDAP_AD_BIND_PASSWORD); String maskPasssword = configuration.getString(LDAP_AD_BIND_PASSWORD);
if (MASK_LDAP_PASSWORD.equals(maskPasssword)) { if (MASK_LDAP_PASSWORD.equals(maskPasssword)) {
String password = SecurityUtil.getPassword(configuration, LDAP_AD_BIND_PASSWORD); String password = SecurityUtil.getPassword(configuration, LDAP_AD_BIND_PASSWORD);
...@@ -297,6 +300,7 @@ public final class ApplicationProperties extends PropertiesConfiguration { ...@@ -297,6 +300,7 @@ public final class ApplicationProperties extends PropertiesConfiguration {
LOG.error("Error in getting secure password ", e); LOG.error("Error in getting secure password ", e);
} }
} }
}
private void setDefaults() { private void setDefaults() {
AtlasRunMode runMode = AtlasRunMode.valueOf(getString(ATLAS_RUN_MODE, DEFAULT_ATLAS_RUN_MODE.name())); AtlasRunMode runMode = AtlasRunMode.valueOf(getString(ATLAS_RUN_MODE, DEFAULT_ATLAS_RUN_MODE.name()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment