diff --git a/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/FederatedAuthPlugin.java b/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/FederatedAuthPlugin.java index fb143fac0..8cf644a76 100644 --- a/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/FederatedAuthPlugin.java +++ b/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/FederatedAuthPlugin.java @@ -219,7 +219,7 @@ private Connection connectInternal(final HostSpec hostSpec, final Properties pro } catch (final Exception exception) { LOGGER.warning( () -> Messages.get( - "FederatedAuthPlugin.unhandledException", + "SamlAuthPlugin.unhandledException", new Object[] {exception})); throw new SQLException(exception); } diff --git a/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPlugin.java b/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPlugin.java index 6457f2263..afeeaa535 100644 --- a/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPlugin.java +++ b/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPlugin.java @@ -85,8 +85,6 @@ public class OktaAuthPlugin extends AbstractConnectionPlugin { "The connect timeout value in milliseconds for the HttpClient used by the OktaAuthPlugin"); public static final AwsWrapperProperty SSL_INSECURE = new AwsWrapperProperty("sslInsecure", "true", "Whether or not the SSL session is to be secure and the sever's certificates will be verified"); - public static AwsWrapperProperty - IDP_NAME = new AwsWrapperProperty("idpName", "okta", "The name of the Identity Provider implementation used"); public static final AwsWrapperProperty DB_USER = new AwsWrapperProperty("dbUser", null, "The database user used to access the database"); @@ -194,7 +192,7 @@ private Connection connectInternal(final HostSpec hostSpec, final Properties pro } catch (final Exception exception) { LOGGER.warning( () -> Messages.get( - "FederatedAuthPlugin.unhandledException", + "SamlAuthPlugin.unhandledException", new Object[] {exception})); throw new SQLException(exception); } diff --git a/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPluginFactory.java b/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPluginFactory.java index eb940ad19..1061c4c7c 100644 --- a/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPluginFactory.java +++ b/wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPluginFactory.java @@ -33,23 +33,18 @@ public ConnectionPlugin getInstance(PluginService pluginService, Properties prop private CredentialsProviderFactory getCredentialsProviderFactory(final PluginService pluginService, final Properties props) { - final String idpName = FederatedAuthPlugin.IDP_NAME.getString(props); - if (StringUtils.isNullOrEmpty(idpName) || "okta".equalsIgnoreCase(idpName)) { - return new OktaCredentialsProviderFactory( - pluginService, - () -> { - try { - return new HttpClientFactory().getCloseableHttpClient( - OktaAuthPlugin.HTTP_CLIENT_SOCKET_TIMEOUT.getInteger(props), - OktaAuthPlugin.HTTP_CLIENT_CONNECT_TIMEOUT.getInteger(props), - OktaAuthPlugin.SSL_INSECURE.getBoolean(props)); - } catch (GeneralSecurityException e) { - throw new RuntimeException( - Messages.get("CredentialsProviderFactory.failedToInitializeHttpClient"), e); - } - }); - } - throw new IllegalArgumentException(Messages.get("CredentialsProviderFactory.unsupportedIdp", - new Object[] {idpName})); + return new OktaCredentialsProviderFactory( + pluginService, + () -> { + try { + return new HttpClientFactory().getCloseableHttpClient( + OktaAuthPlugin.HTTP_CLIENT_SOCKET_TIMEOUT.getInteger(props), + OktaAuthPlugin.HTTP_CLIENT_CONNECT_TIMEOUT.getInteger(props), + OktaAuthPlugin.SSL_INSECURE.getBoolean(props)); + } catch (GeneralSecurityException e) { + throw new RuntimeException( + Messages.get("CredentialsProviderFactory.failedToInitializeHttpClient"), e); + } + }); } } diff --git a/wrapper/src/main/resources/aws_advanced_jdbc_wrapper_messages.properties b/wrapper/src/main/resources/aws_advanced_jdbc_wrapper_messages.properties index 7954b56d2..63114a660 100644 --- a/wrapper/src/main/resources/aws_advanced_jdbc_wrapper_messages.properties +++ b/wrapper/src/main/resources/aws_advanced_jdbc_wrapper_messages.properties @@ -161,8 +161,6 @@ Failover.failedToUpdateCurrentHostspecAvailability=Failed to update current host Failover.noOperationsAfterConnectionClosed=No operations allowed after connection closed. Failover.invalidHostListProvider=Incorrect type of host list provider found, please ensure the correct host list provider is specified. The host list provider in use is: ''{0}'', the plugin is expected a cluster-aware host list provider such as the AuroraHostListProvider. -FederatedAuthPlugin.unhandledException=Unhandled exception: ''{0}'' - # HikariPooledConnectionProvider HikariPooledConnectionProvider.errorConnectingWithDataSource=Unable to connect to ''{0}'' using the Hikari data source. HikariPooledConnectionProvider.errorConnectingWithDataSourceWithCause=Unable to connect to ''{0}'' using the Hikari data source. Exception message: ''{1}'' @@ -265,6 +263,7 @@ ReadWriteSplittingPlugin.errorVerifyingInitialHostSpecRole=An error occurred whi SAMLCredentialsProviderFactory.getSamlAssertionFailed=Failed to get SAML Assertion due to exception: ''{0}'' SamlAuthPlugin.javaStsSdkNotInClasspath=Required dependency 'AWS Java SDK for AWS Secret Token Service' is not on the classpath. +SamlAuthPlugin.unhandledException=Unhandled exception: ''{0}'' # Wrapper Utils WrapperUtils.noWrapperClassExists=No wrapper class exists for ''{0}''.