private static String getPasswordFromCredentialProvider(String providerPath, String key) {
    try {
      if (providerPath != null) {
        Configuration conf = new Configuration();
        conf.set("hadoop.security.credential.provider.path", providerPath);
        char[] password = conf.getPassword(key);
        if (password != null) {
          return new String(password);
        }
      }
    } catch(IOException exception) {
      LOG.warn("Could not retrieve password for " + key, exception);
    }
    return null;
  }
Method to get the password from the credential provider
@param providerPath provider path
@param key alias name
@return password
jdbc/src/java/org/apache/hive/jdbc/Utils.java