class HadoopCredentialConfiguration {

  public static CredentialFactory getCredentialFactory(
      Configuration config, String... keyPrefixesVararg) {
    List<String> keyPrefixes = getConfigKeyPrefixes(keyPrefixesVararg);
    CredentialOptions credentialOptions =
        CredentialOptions.builder()
            .setServiceAccountEnabled(
                ENABLE_SERVICE_ACCOUNTS_SUFFIX
                    .withPrefixes(keyPrefixes)
                    .get(config, config::getBoolean))
            .setServiceAccountPrivateKeyId(
                RedactedString.create(
                    SERVICE_ACCOUNT_PRIVATE_KEY_ID_SUFFIX
                        .withPrefixes(keyPrefixes)
                        .getPassword(config)))
            .setServiceAccountPrivateKey(
                RedactedString.create(
                    SERVICE_ACCOUNT_PRIVATE_KEY_SUFFIX
                        .withPrefixes(keyPrefixes)
                        .getPassword(config)))
            .setServiceAccountEmail(
                SERVICE_ACCOUNT_EMAIL_SUFFIX.withPrefixes(keyPrefixes).getPassword(config))
            .setServiceAccountKeyFile(
                SERVICE_ACCOUNT_KEYFILE_SUFFIX.withPrefixes(keyPrefixes).get(config, config::get))
            .setServiceAccountJsonKeyFile(
                SERVICE_ACCOUNT_JSON_KEYFILE_SUFFIX
                    .withPrefixes(keyPrefixes)
                    .get(config, config::get))
            .setClientId(
                RedactedString.create(
                    CLIENT_ID_SUFFIX.withPrefixes(keyPrefixes).get(config, config::get)))
            .setClientSecret(
                RedactedString.create(
                    CLIENT_SECRET_SUFFIX.withPrefixes(keyPrefixes).get(config, config::get)))
            .setOAuthCredentialFile(
                OAUTH_CLIENT_FILE_SUFFIX.withPrefixes(keyPrefixes).get(config, config::get))
            .setNullCredentialEnabled(
                ENABLE_NULL_CREDENTIAL_SUFFIX
                    .withPrefixes(keyPrefixes)
                    .get(config, config::getBoolean))
            .setTransportType(
                HTTP_TRANSPORT_SUFFIX.withPrefixes(keyPrefixes).get(config, config::getEnum))
            .setTokenServerUrl(
                TOKEN_SERVER_URL_SUFFIX.withPrefixes(keyPrefixes).get(config, config::get))
            .setProxyAddress(
                PROXY_ADDRESS_SUFFIX.withPrefixes(keyPrefixes).get(config, config::get))
            .setProxyUsername(
                RedactedString.create(
                    PROXY_USERNAME_SUFFIX.withPrefixes(keyPrefixes).getPassword(config)))
            .setProxyPassword(
                RedactedString.create(
                    PROXY_PASSWORD_SUFFIX.withPrefixes(keyPrefixes).getPassword(config)))
            .build();
    return new CredentialFactory(credentialOptions);
  }

  protected  HadoopCredentialConfiguration();

}