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,24 +277,28 @@ public final class ApplicationProperties extends PropertiesConfiguration { ...@@ -277,24 +277,28 @@ public final class ApplicationProperties extends PropertiesConfiguration {
} }
private static void setLdapPasswordFromKeystore(Configuration configuration) { private static void setLdapPasswordFromKeystore(Configuration configuration) {
try { String ldapType = configuration.getString(LDAP_TYPE);
if (configuration.getString(LDAP_TYPE).equalsIgnoreCase("ldap")) {
String maskPasssword = configuration.getString(LDAP_BIND_PASSWORD); if (StringUtils.isNotEmpty(ldapType)) {
if (MASK_LDAP_PASSWORD.equals(maskPasssword)) { try {
String password = SecurityUtil.getPassword(configuration, LDAP_BIND_PASSWORD); if (ldapType.equalsIgnoreCase("ldap")) {
configuration.clearProperty(LDAP_BIND_PASSWORD); String maskPasssword = configuration.getString(LDAP_BIND_PASSWORD);
configuration.addProperty(LDAP_BIND_PASSWORD, password); if (MASK_LDAP_PASSWORD.equals(maskPasssword)) {
} String password = SecurityUtil.getPassword(configuration, LDAP_BIND_PASSWORD);
} else if (configuration.getString(LDAP_TYPE).equalsIgnoreCase("ad")) { configuration.clearProperty(LDAP_BIND_PASSWORD);
String maskPasssword = configuration.getString(LDAP_AD_BIND_PASSWORD); configuration.addProperty(LDAP_BIND_PASSWORD, password);
if (MASK_LDAP_PASSWORD.equals(maskPasssword)) { }
String password = SecurityUtil.getPassword(configuration, LDAP_AD_BIND_PASSWORD); } else if (ldapType.equalsIgnoreCase("ad")) {
configuration.clearProperty(LDAP_AD_BIND_PASSWORD); String maskPasssword = configuration.getString(LDAP_AD_BIND_PASSWORD);
configuration.addProperty(LDAP_AD_BIND_PASSWORD, password); if (MASK_LDAP_PASSWORD.equals(maskPasssword)) {
String password = SecurityUtil.getPassword(configuration, LDAP_AD_BIND_PASSWORD);
configuration.clearProperty(LDAP_AD_BIND_PASSWORD);
configuration.addProperty(LDAP_AD_BIND_PASSWORD, password);
}
} }
} catch (Exception e) {
LOG.error("Error in getting secure password ", e);
} }
} catch (Exception e) {
LOG.error("Error in getting secure password ", e);
} }
} }
......
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