Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/#semantic-versioning-200).

### :bug: Fixed
- Use the AwsCredentialsProviderHandler from the ConfigurationProfile when it is defined ([PR #1183](https://github.com/aws/aws-advanced-jdbc-wrapper/pull/1183)).

## [2.5.2] - 2024-11-4
### :bug: Fixed
- Limitless Connection Plugin to reduce extra connections made during new connection creation ([PR #1174](https://github.com/aws/aws-advanced-jdbc-wrapper/pull/1174)).
Expand Down
3 changes: 3 additions & 0 deletions wrapper/src/main/java/software/amazon/jdbc/PluginService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import software.amazon.jdbc.dialect.Dialect;
import software.amazon.jdbc.exceptions.ExceptionHandler;
import software.amazon.jdbc.hostavailability.HostAvailability;
import software.amazon.jdbc.profile.ConfigurationProfile;
import software.amazon.jdbc.states.SessionStateService;
import software.amazon.jdbc.targetdriverdialect.TargetDriverDialect;
import software.amazon.jdbc.util.telemetry.TelemetryFactory;
Expand Down Expand Up @@ -231,6 +232,8 @@ HostSpec getHostSpecByStrategy(List<HostSpec> hosts, HostRole role, String strat

String getDriverProtocol();

@Nullable ConfigurationProfile getConfigurationProfile();

Properties getProperties();

TelemetryFactory getTelemetryFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ public String getDriverProtocol() {
return this.driverProtocol;
}

@Override
@Nullable
public ConfigurationProfile getConfigurationProfile() {
return this.configurationProfile;
}

@Override
public void setCurrentConnection(
final @NonNull Connection connection, final @NonNull HostSpec hostSpec) throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import software.amazon.jdbc.PluginService;
import software.amazon.jdbc.PropertyDefinition;
import software.amazon.jdbc.authentication.AwsCredentialsManager;
import software.amazon.jdbc.profile.ConfigurationProfile;
import software.amazon.jdbc.util.Messages;
import software.amazon.jdbc.util.RegionUtils;
import software.amazon.jdbc.util.StringUtils;
Expand Down Expand Up @@ -175,7 +176,12 @@ public AwsSecretsManagerConnectionPlugin(final PluginService pluginService, fina

this.secretKey = Pair.of(secretId, region);

ConfigurationProfile profile = this.pluginService.getConfigurationProfile();
if (profile != null && profile.getAwsCredentialsProviderHandler() != null) {
AwsCredentialsManager.setCustomHandler(profile.getAwsCredentialsProviderHandler());
}
this.secretsManagerClientFunc = secretsManagerClientFunc;

this.getSecretValueRequestFunc = getSecretValueRequestFunc;
this.fetchCredentialsCounter = this.pluginService.getTelemetryFactory()
.createCounter(TELEMETRY_FETCH_CREDENTIALS_COUNTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import software.amazon.jdbc.PropertyDefinition;
import software.amazon.jdbc.authentication.AwsCredentialsManager;
import software.amazon.jdbc.plugin.AbstractConnectionPlugin;
import software.amazon.jdbc.profile.ConfigurationProfile;
import software.amazon.jdbc.util.Messages;
import software.amazon.jdbc.util.RdsUtils;
import software.amazon.jdbc.util.RegionUtils;
Expand Down Expand Up @@ -145,6 +146,11 @@ public CustomEndpointPlugin(
final BiFunction<HostSpec, Region, RdsClient> rdsClientFunc) {
this.pluginService = pluginService;
this.props = props;

ConfigurationProfile profile = this.pluginService.getConfigurationProfile();
if (profile != null && profile.getAwsCredentialsProviderHandler() != null) {
AwsCredentialsManager.setCustomHandler(profile.getAwsCredentialsProviderHandler());
}
this.rdsClientFunc = rdsClientFunc;

this.shouldWaitForInfo = WAIT_FOR_CUSTOM_ENDPOINT_INFO.getBoolean(this.props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import software.amazon.jdbc.authentication.AwsCredentialsManager;
import software.amazon.jdbc.plugin.AbstractConnectionPlugin;
import software.amazon.jdbc.plugin.TokenInfo;
import software.amazon.jdbc.profile.ConfigurationProfile;
import software.amazon.jdbc.util.IamAuthUtils;
import software.amazon.jdbc.util.Messages;
import software.amazon.jdbc.util.RdsUtils;
Expand Down Expand Up @@ -98,6 +99,11 @@ public IamAuthConnectionPlugin(final @NonNull PluginService pluginService) {
this.telemetryFactory = pluginService.getTelemetryFactory();
this.cacheSizeGauge = telemetryFactory.createGauge("iam.tokenCache.size", () -> (long) tokenCache.size());
this.fetchTokenCounter = telemetryFactory.createCounter("iam.fetchToken.count");

ConfigurationProfile profile = this.pluginService.getConfigurationProfile();
if (profile != null && profile.getAwsCredentialsProviderHandler() != null) {
AwsCredentialsManager.setCustomHandler(profile.getAwsCredentialsProviderHandler());
}
}

@Override
Expand Down
Loading