Skip to content

Commit 156b0ca

Browse files
authored
DRIVERS-2856 Rename OIDC integration name and values. (#1544)
1 parent 0812d4f commit 156b0ca

File tree

6 files changed

+53
-46
lines changed

6 files changed

+53
-46
lines changed

source/auth/auth.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,9 +1212,9 @@ in the MONGODB-OIDC specification, including sections or blocks that specificall
12121212

12131213
- mechanism_properties
12141214

1215-
- PROVIDER_NAME\
1216-
Drivers MUST allow the user to specify the name of a built-in OIDC provider integration to use to
1217-
obtain credentials. If provided, the value MUST be one of `["aws"]`. If both `PROVIDER_NAME` and an
1215+
- ENVIRONMENT\
1216+
Drivers MUST allow the user to specify the name of a built-in OIDC application environment integration
1217+
to use to obtain credentials. If provided, the value MUST be one of `["test"]`. If both `ENVIRONMENT` and an
12181218
[OIDC Callback](#oidc-callback) or [OIDC Human Callback](#oidc-human-callback) are provided for the same
12191219
`MongoClient`, the driver MUST raise an error.
12201220

@@ -1243,20 +1243,25 @@ in the MONGODB-OIDC specification, including sections or blocks that specificall
12431243
performed after SRV record resolution, if applicable. This property is only required for drivers that support the
12441244
[Human Authentication Flow](#human-authentication-flow).
12451245

1246-
#### Built-in Provider Integrations
1246+
<div id="built-in-provider-integrations">
12471247

1248-
Drivers MUST support all of the following built-in OIDC providers.
1248+
#### Built-in OIDC Environment Integrations
12491249

1250-
####### AWS
1250+
Drivers MUST support all of the following built-in OIDC application environment integrations.
12511251

1252-
The AWS provider is enabled by setting auth mechanism property `PROVIDER_NAME:aws`.
1252+
**Test**
12531253

1254-
If enabled, drivers MUST read the file path from environment variable `AWS_WEB_IDENTITY_TOKEN_FILE` and then read the
1255-
OIDC access token from that file. The driver MUST use the contents of that file as value in the `jwt` field of the
1256-
`saslStart` payload.
1254+
The test integration is enabled by setting auth mechanism property `ENVIRONMENT:test`. It is meant for driver testing
1255+
purposes, and is not meant to be documented as a user-facing feature.
12571256

1258-
Drivers MAY implement the AWS provider so that it conforms to the function signature of the
1259-
[OIDC Callback](#oidc-callback) to prevent having to re-implement the AWS provider logic in the OIDC prose tests.
1257+
If enabled, drivers MUST generate a token using a script in the `auth_oidc`
1258+
[folder](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/auth_oidc#readme) in Drivers
1259+
Evergreen Tools. The must then set the `OIDC_TOKEN_FILE` environment variable to the path to that file. At runtime, the
1260+
driver MUST use the `OIDC_TOKEN_FILE` environment variable and read the OIDC access token from that path. The driver
1261+
MUST use the contents of that file as value in the `jwt` field of the `saslStart` payload.
1262+
1263+
Drivers MAY implement the "test" integration so that it conforms to the function signature of the
1264+
[OIDC Callback](#oidc-callback) to prevent having to re-implement the "test" integration logic in the OIDC prose tests.
12601265

12611266
#### OIDC Callback
12621267

@@ -1916,6 +1921,8 @@ to EC2 instance metadata in ECS, for security reasons, Amazon states it's best p
19161921

19171922
## Changelog
19181923

1924+
- 2024-03-09: Rename OIDC integration name and values.
1925+
19191926
- 2024-01-31: Migrated from reStructuredText to Markdown.
19201927

19211928
- 2024-01-17: Added MONGODB-OIDC machine auth flow spec and combine with human\

source/auth/tests/legacy/connection-string.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/auth/tests/legacy/connection-string.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -350,39 +350,39 @@ tests:
350350
mechanism: MONGODB-AWS
351351
mechanism_properties:
352352
AWS_SESSION_TOKEN: token!@#$%^&*()_+
353-
- description: should recognise the mechanism with aws provider (MONGODB-OIDC)
354-
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:aws
353+
- description: should recognise the mechanism with test environment (MONGODB-OIDC)
354+
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:test
355355
valid: true
356356
credential:
357357
username:
358358
password:
359359
source: "$external"
360360
mechanism: MONGODB-OIDC
361361
mechanism_properties:
362-
PROVIDER_NAME: aws
363-
- description: should recognise the mechanism when auth source is explicitly specified and with provider (MONGODB-OIDC)
364-
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authSource=$external&authMechanismProperties=PROVIDER_NAME:aws
362+
ENVIRONMENT: test
363+
- description: should recognise the mechanism when auth source is explicitly specified and with environment (MONGODB-OIDC)
364+
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authSource=$external&authMechanismProperties=ENVIRONMENT:test
365365
valid: true
366366
credential:
367367
username:
368368
password:
369369
source: "$external"
370370
mechanism: MONGODB-OIDC
371371
mechanism_properties:
372-
PROVIDER_NAME: aws
372+
ENVIRONMENT: test
373373
- description: should throw an exception if supplied a password (MONGODB-OIDC)
374-
uri: mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:aws
374+
uri: mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:test
375375
valid: false
376376
credential:
377377
- description: should throw an exception if username is specified for aws (MONGODB-OIDC)
378-
uri: mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&PROVIDER_NAME:aws
378+
uri: mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&ENVIRONMENT:test
379379
valid: false
380380
credential:
381-
- description: should throw an exception if specified provider is not supported (MONGODB-OIDC)
382-
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:invalid
381+
- description: should throw an exception if specified environment is not supported (MONGODB-OIDC)
382+
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:invalid
383383
valid: false
384384
credential:
385-
- description: should throw an exception if neither provider nor callbacks specified (MONGODB-OIDC)
385+
- description: should throw an exception if neither environment nor callbacks specified (MONGODB-OIDC)
386386
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC
387387
valid: false
388388
credential:

source/auth/tests/mongodb-oidc.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For example, if the selected AWS profile ID is "drivers-test", run:
1414
aws configure sso
1515
export OIDC_TOKEN_DIR=/tmp/tokens
1616
AWS_PROFILE="drivers-test" oidc_get_tokens.sh
17-
AWS_WEB_IDENTITY_TOKEN_FILE="$OIDC_TOKEN_DIR/test_user1" /my/test/command
17+
OIDC_TOKEN_FILE="$OIDC_TOKEN_DIR/test_user1" /my/test/command
1818
```
1919

2020
______________________________________________________________________
@@ -26,7 +26,7 @@ configured with `retryReads=false`.
2626

2727
> [!NOTE]
2828
> For test cases that create fail points, drivers MUST either use a unique `appName` or explicitly remove the fail point
29-
> after the test to prevent interaction between test cases.
29+
> callback to prevent interaction between test cases.
3030
3131
Note that typically the preconfigured Atlas Dev clusters are used for testing, in Evergreen and locally. The URIs can be
3232
fetched from the `drivers/oidc` Secrets vault, see
@@ -35,18 +35,18 @@ Use `OIDC_ATLAS_URI_SINGLE` for the `MONGODB_URI`. If using local servers is pre
3535
[Local Testing](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/auth_oidc/README.md#local-testing)
3636
method, use `mongodb://localhost/?authMechanism=MONGODB-OIDC` for `MONGODB_URI`.
3737

38-
### (1) OIDC Callback Authentication
38+
### Callback Authentication
3939

4040
**1.1 Callback is called during authentication**
4141

42-
- Create a `MongoClient` configured with an OIDC callback that implements the AWS provider logic.
42+
- Create a `MongoClient` configured with an OIDC callback that implements the `ENVIRONMENT:test` logic.
4343
- Perform a `find` operation that succeeds.
4444
- Assert that the callback was called 1 time.
4545
- Close the client.
4646

4747
**1.2 Callback is called once for multiple connections**
4848

49-
- Create a `MongoClient` configured with an OIDC callback that implements the AWS provider logic.
49+
- Create a `MongoClient` configured with an OIDC callback that implements the `ENVIRONMENT:test` logic.
5050
- Start 10 threads and run 100 `find` operations in each thread that all succeed.
5151
- Assert that the callback was called 1 time.
5252
- Close the client.
@@ -75,14 +75,14 @@ method, use `mongodb://localhost/?authMechanism=MONGODB-OIDC` for `MONGODB_URI`.
7575

7676
**2.4 Invalid Client Configuration with Callback**
7777

78-
- Create a `MongoClient` configured with an OIDC callback and auth mechanism property `PROVIDER_NAME:aws`.
78+
- Create a `MongoClient` configured with an OIDC callback and auth mechanism property `ENVIRONMENT:test`.
7979
- Assert it returns a client configuration error.
8080

8181
### (3) Authentication Failure
8282

8383
**3.1 Authentication failure with cached tokens fetch a new token and retry auth**
8484

85-
- Create a `MongoClient` configured with an OIDC callback that implements the AWS provider logic.
85+
- Create a `MongoClient` configured with an OIDC callback that implements the `ENVIRONMENT:test` logic.
8686
- Poison the *Client Cache* with an invalid access token.
8787
- Perform a `find` operation that succeeds.
8888
- Assert that the callback was called 1 time.
@@ -97,7 +97,7 @@ method, use `mongodb://localhost/?authMechanism=MONGODB-OIDC` for `MONGODB_URI`.
9797

9898
### (4) Reauthentication
9999

100-
- Create a `MongoClient` configured with an OIDC callback that implements the AWS provider logic.
100+
- Create a `MongoClient` configured with an OIDC callback that implements the `ENVIRONMENT:test` logic.
101101
- Set a fail point for `find` commands of the form:
102102

103103
```javascript

source/auth/tests/unified/mongodb-oidc-no-retry.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ createEntities:
1515
authMechanism: "MONGODB-OIDC"
1616
# The $$placeholder document should be replaced by auth mechanism
1717
# properties that enable OIDC auth on the target cloud platform. For
18-
# example, when running the test on AWS, replace the $$placeholder
19-
# document with {"PROVIDER_NAME": "aws"}.
18+
# example, when running the test on EC2, replace the $$placeholder
19+
# document with {"ENVIRONMENT": "test"}.
2020
authMechanismProperties: { $$placeholder: 1 }
2121
retryReads: false
2222
retryWrites: false

source/unified-test-format/unified-test-format.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ The structure of this object is as follows:
422422
uriOptions:
423423
authMechanism: "MONGODB-OIDC"
424424
authMechanismProperties:
425-
PROVIDER_NAME: { $$placeholder: 1 }
425+
ENVIRONMENT: { $$placeholder: 1 }
426426
```
427427
428428
<span id="entity_client_useMultipleMongoses" />

0 commit comments

Comments
 (0)