public String readPasswordFromStore(String aliasStr, Configuration configuration) {
    String password = null;
    loadCredentialProvider(configuration);
    if (credentialProvider != null) {
      char[] result = null;
      try {
        result = credentialProvider.getPasswordForAlias(aliasStr);
      } catch (AmbariException e) {
        LOG.error("Error reading from credential store.", e);
      }
      if (result != null) {
        password = new String(result);
      } else {
        if (CredentialProvider.isAliasString(aliasStr)) {
          LOG.error("Cannot read password for alias = " + aliasStr);
        } else {
          LOG.warn("Raw password provided, not an alias. It cannot be read from credential store.");
        }
      }
    }
    return password;
  }
Reading the password from Credential Store for the given alias

@param aliasStr
         the Credential Store alias you want to read the password for
@param configuration with configured master key:
masterKeyLocation
         the master key location file
isMasterKeyPersisted
         a flag indicating whether the master key is persisted
masterKeyStoreLocation
         the master key-store location file
@return the password of the given alias if it is not <code>blank</code> and
        there is password stored for this alias in Credential Store;
        <code>null</code> otherwise
ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java