Skip to content

Commit

Permalink
Use AWS credentials file for authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Cross committed Oct 16, 2024
1 parent a3425be commit e8503b9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions plugins/riot/src/main/java/com/redis/riot/AwsArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
import io.awspring.cloud.s3.S3Resource;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Option;
import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.S3ClientBuilder;
Expand Down Expand Up @@ -45,13 +43,7 @@ public Resource resource(String location) {
}

private AwsCredentialsProvider credentialsProvider() {
if (credentialsArgs != null && StringUtils.hasText(credentialsArgs.getAccessKey())
&& StringUtils.hasText(credentialsArgs.getSecretKey())) {
AwsBasicCredentials credentials = AwsBasicCredentials.create(credentialsArgs.getAccessKey(),
credentialsArgs.getSecretKey());
return StaticCredentialsProvider.create(credentials);
}
return AnonymousCredentialsProvider.create();
return ProfileCredentialsProvider.create();
}

public AwsCredentialsArgs getCredentialsArgs() {
Expand Down

0 comments on commit e8503b9

Please sign in to comment.