@Override
  public Set<String> listCredentials() throws AmbariException {
    Set<String> credentials = null;

    lock.lock();
    try {
      KeyStore ks = loadCredentialStore();
      if (ks != null) {
        try {
          Enumeration<String> aliases = ks.aliases();

          if (aliases != null) {
            credentials = new HashSet<>();
            while (aliases.hasMoreElements()) {
              credentials.add(aliases.nextElement());
            }
          }
        } catch (KeyStoreException e) {
          throw new AmbariException("Failed to read KeyStore - the key store may not have been initialized", e);
        }
      }
    } finally {
      lock.unlock();
    }

    return credentials;
  }
Returns a list of the alias names for the credentials stored in the CredentialStore
<p/>
This implementation is thread-safe, allowing one thread at a time to access the credential store.

@return a Set of Strings representing alias names for the credentials stored in the CredentialStore
@throws AmbariException if an error occurs while searching forthe credential
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java