Skip to content

Commit

Permalink
fix: Credentials Resolution Bug in S3 Reads (#6444)
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotrashivam authored Nov 27, 2024
1 parent 0be4153 commit e7f27cb
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@
enum ResolvingCredentials implements AwsSdkV2Credentials {
INSTANCE;

private static final AwsCredentialsProviderChain PROVIDER_CHAIN = AwsCredentialsProviderChain.builder()
.credentialsProviders(
DefaultCredentialsProvider.create(),
AnonymousCredentialsProvider.create())
.reuseLastProviderEnabled(false) // Don't cache because this chain is a shared static instance
.build();

@Override
public final AwsCredentialsProvider awsV2CredentialsProvider(@NotNull final S3Instructions instructions) {
if (instructions.profileName().isPresent()
|| instructions.configFilePath().isPresent()
|| instructions.credentialsFilePath().isPresent()) {
return ProfileCredentials.INSTANCE.awsV2CredentialsProvider(instructions);
}
return PROVIDER_CHAIN;
return AwsCredentialsProviderChain.builder()
.credentialsProviders(
DefaultCredentialsProvider.create(),
AnonymousCredentialsProvider.create())
.reuseLastProviderEnabled(true)
.build();
}
}

0 comments on commit e7f27cb

Please sign in to comment.