aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

The order of DefaultCredentialsProvider

Open TingDaoK opened this issue 2 years ago • 1 comments

Describe the issue

The order of DefaultCredentialsProvider, in here makes me confused.

  1. Java System Properties - aws.accessKeyId and aws.secretAccessKey
  1. Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  2. Web Identity Token credentials from system properties or environment variables
  3. Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI xxx

SystemPropertyCredentialsProvider EnvironmentVariableCredentialsProvider ProfileCredentialsProvider WebIdentityTokenFileCredentialsProvider

I'd assume the link order is the same of the order listed in the documentation. And the documentation is not directly link to the class that have the implementation. So, The ProfileCredentialsProvider should be the 4th in the chain, right?

Links

https://github.com/aws/aws-sdk-java-v2/blob/a1c168a3cb6263b7dbfa6f2c40c95ef159db5bce/core/auth/src/main/java/software/amazon/awssdk/auth/credentials/DefaultCredentialsProvider.java#L29-L47

TingDaoK avatar Apr 14 '23 18:04 TingDaoK

Good callout, yes, WebIdentityTokenFileCredentialsProvider should be before ProfileCredentialsProvider in the "see also" list.

We welcome PRs :)

debora-ito avatar Apr 15 '23 01:04 debora-ito