All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openmetadata.service.util.jdbi.DatabaseAuthenticationProviderFactory Maven / Gradle / Ivy

There is a newer version: 1.5.11
Show newest version
package org.openmetadata.service.util.jdbi;

import java.util.Optional;

/** Factory class for {@link DatabaseAuthenticationProvider}. */
public class DatabaseAuthenticationProviderFactory {
  /** C'tor */
  private DatabaseAuthenticationProviderFactory() {}

  /**
   * Get auth provider based on the given jdbc url.
   *
   * @param jdbcURL the jdbc url.
   * @return instance of {@link DatabaseAuthenticationProvider}.
   */
  public static Optional get(String jdbcURL) {
    // Check
    if (jdbcURL.contains(AwsRdsDatabaseAuthenticationProvider.AWS_REGION)
        && jdbcURL.contains(AwsRdsDatabaseAuthenticationProvider.ALLOW_PUBLIC_KEY_RETRIEVAL)) {
      // Return AWS RDS Auth provider
      return Optional.of(new AwsRdsDatabaseAuthenticationProvider());
    }

    // Return empty
    return Optional.empty();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy