Skip to content

Commit 51081d5

Browse files
committed
feat(DRIVERS-2983): use custom aws configuration
1 parent ce35696 commit 51081d5

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

source/auth/auth.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,22 @@ those credentials will be used by default if AWS auth environment variables are
987987
application. Alternatively, you can create an AWS profile specifically for your MongoDB credentials and set the
988988
`AWS_PROFILE` environment variable to that profile name."
989989
990+
##### Custom Credential Providers
991+
992+
Drivers that choose you use the AWS SDK to fetch credentials MAY also allow users to provide a custom credential provider
993+
as an option to the `MongoClient`. The interface for the option provided depends on the individual language SDK and
994+
drivers MUST consult AWS SDK documentation to determine that format when implementing. The name of the option MUST be
995+
`AWS_CREDENTIAL_PROVIDER` and be part of the authentication mechanism properties options that can be provided to the
996+
client.
997+
998+
Drivers that implement this MAY choose to implement the following scenarios when applicable in their labguage's SDK:
999+
1000+
1. The default SDK credential provider.
1001+
2. A custom credential provider chain.
1002+
3. A single credential provider of any available SDK options provided by the SDK.
1003+
1004+
##### Credential Fetching Order
1005+
9901006
The order in which Drivers MUST search for credentials is:
9911007

9921008
1. The URI
@@ -1306,6 +1322,10 @@ in the MONGODB-OIDC specification, including sections or blocks that specificall
13061322
check MUST be performed after SRV record resolution, if applicable. This property is only required for drivers
13071323
that support the [Human Authentication Flow](#human-authentication-flow).
13081324
1325+
- AWS_CREDENTIAL_PROVIDER
1326+
1327+
A function or object from the AWS SDK that can be used to return AWS credentials.
1328+
13091329
<span id="built-in-provider-integrations"/>
13101330
13111331
#### Built-in OIDC Environment Integrations
@@ -2134,6 +2154,8 @@ practice to avoid this. (See
21342154

21352155
## Changelog
21362156

2157+
- 2025-01-29: Add support for custom AWS credential providers.
2158+
21372159
- 2024-10-02: Add Kubernetes built-in OIDC provider integration.
21382160

21392161
- 2024-08-19: Clarify Reauthentication and Speculative Authentication combination behavior.

source/auth/tests/mongodb-aws.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ SecretAccessKey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
2121
Token=AQoDYXdzEJr...<remainder of security token>
2222
```
2323

24+
If the driver supports user provided custom AWS credential providers, then the driver MUST also test the above
25+
scenarios 2-6 with a user provided `AWS_CREDENTIAL_PROVIDER` auth mechanism property. This value MUST be the default
26+
credential provider from the AWS SDK. If the default provider does not cover all scenarios above, those not
27+
convered MAY be skipped.
28+
2429
## Regular credentials
2530

2631
Drivers MUST be able to authenticate by providing a valid access key id and secret access key pair as the username and

0 commit comments

Comments
 (0)