Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
karenc-bq committed Apr 4, 2024
1 parent 576ad37 commit b56e7ea
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}''
Expand Down Expand Up @@ -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}''.
Expand Down

0 comments on commit b56e7ea

Please sign in to comment.