public String readPassword(String passwordProperty, String defaultPassword) {
    if (StringUtils.isNotBlank(passwordProperty)) {
      if (CredentialProvider.isAliasString(passwordProperty)) {
        return readPasswordFromStore(passwordProperty);
      } else {
        return readPasswordFromFile(passwordProperty, defaultPassword);
      }
    }
    return defaultPassword;
  }
Reading the password belong to the given password property

@param passwordProperty
         this is either the Credential Store alias or the password file name
         you want to read the password for/from
@param defaultPassword
         the default password this function returns in case the given
         <code>passwordProperty</code> is <blank> or the password file cannot
         be read for any reason
@return in case <code>passwordProperty</code> belongs to a Credential Store
        alias this function returns the password of the given Credential
        Store alias or <code>null</code> (if the given alias is
        <code>blank</code> or there is no password found in CS); otherwise
        either the password found in the given password file is returned or
        <code>defaultPassword</code> if the given path is <code>blank</code>
        or cannot be read for any reason
@throws RuntimeException
          if any error occurred while reading the password file
ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java