@@ -67,7 +67,7 @@ public final class ApplicationProperties extends PropertiesConfiguration {
6767 public static final String AD = "AD" ;
6868 public static final String LDAP_AD_BIND_PASSWORD = "atlas.authentication.method.ldap.ad.bind.password" ;
6969 public static final String LDAP_BIND_PASSWORD = "atlas.authentication.method.ldap.bind.password" ;
70- public static final String MASK_LDAP_PASSWORD = "********" ;
70+ public static final String MASK_PASSWORD = "********" ;
7171 public static final String DEFAULT_GRAPHDB_BACKEND = GRAPHBD_BACKEND_JANUS ;
7272 public static final boolean DEFAULT_SOLR_WAIT_SEARCHER = false ;
7373 public static final boolean DEFAULT_INDEX_MAP_NAME = false ;
@@ -342,7 +342,7 @@ private static void setLdapPasswordFromKeystore(Configuration configuration) {
342342 if (ldapType .equalsIgnoreCase (LDAP )) {
343343 String maskPasssword = configuration .getString (LDAP_BIND_PASSWORD );
344344
345- if (MASK_LDAP_PASSWORD .equals (maskPasssword )) {
345+ if (MASK_PASSWORD .equals (maskPasssword )) {
346346 String password = SecurityUtil .getPassword (configuration , LDAP_BIND_PASSWORD , HADOOP_SECURITY_CREDENTIAL_PROVIDER_PATH );
347347
348348 configuration .clearProperty (LDAP_BIND_PASSWORD );
@@ -351,7 +351,7 @@ private static void setLdapPasswordFromKeystore(Configuration configuration) {
351351 } else if (ldapType .equalsIgnoreCase (AD )) {
352352 String maskPasssword = configuration .getString (LDAP_AD_BIND_PASSWORD );
353353
354- if (MASK_LDAP_PASSWORD .equals (maskPasssword )) {
354+ if (MASK_PASSWORD .equals (maskPasssword )) {
355355 String password = SecurityUtil .getPassword (configuration , LDAP_AD_BIND_PASSWORD , HADOOP_SECURITY_CREDENTIAL_PROVIDER_PATH );
356356
357357 configuration .clearProperty (LDAP_AD_BIND_PASSWORD );
@@ -364,6 +364,20 @@ private static void setLdapPasswordFromKeystore(Configuration configuration) {
364364 }
365365 }
366366
367+ public static String getDecryptedPassword (Configuration configuration , String propertyKey ) {
368+ String configuredValue = configuration != null ? configuration .getString (propertyKey ) : null ;
369+
370+ if (configuredValue != null && MASK_PASSWORD .equals (configuredValue )) {
371+ try {
372+ return SecurityUtil .getPassword (configuration , propertyKey , HADOOP_SECURITY_CREDENTIAL_PROVIDER_PATH );
373+ } catch (Exception e ) {
374+ LOG .error ("Error in getting secure password " , e );
375+ }
376+ }
377+
378+ return configuredValue ;
379+ }
380+
367381 private void setDefaults () {
368382 AtlasRunMode runMode = AtlasRunMode .valueOf (getString (ATLAS_RUN_MODE , DEFAULT_ATLAS_RUN_MODE .name ()));
369383
0 commit comments