@@ -1266,8 +1266,8 @@ in the MONGODB-OIDC specification, including sections or blocks that specificall
1266
1266
- ENVIRONMENT
1267
1267
1268
1268
Drivers MUST allow the user to specify the name of a built-in OIDC application environment integration to use to
1269
- obtain credentials. If provided, the value MUST be one of ` [" test" , " azure" , " gcp" ]` . If both ` ENVIRONMENT ` and an
1270
- [OIDC Callback](#oidc-callback) or [OIDC Human Callback](#oidc-human-callback) are provided for the same
1269
+ obtain credentials. If provided, the value MUST be one of ` [" test" , " azure" , " gcp" , " k8s " ]` . If both ` ENVIRONMENT `
1270
+ and an [OIDC Callback](#oidc-callback) or [OIDC Human Callback](#oidc-human-callback) are provided for the same
1271
1271
` MongoClient` , the driver MUST raise an error.
1272
1272
1273
1273
- TOKEN_RESOURCE
@@ -1428,6 +1428,35 @@ callback had been provided by the user.
1428
1428
For details on test environment setup, see the README in
1429
1429
[Drivers-Evergreen-Tools](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/auth_oidc/gcp/README.md).
1430
1430
1431
+ ***Kubernetes***
1432
+
1433
+ The Kubernetes integration is enabled by setting auth mechanism property ` ENVIRONMENT : k8s` . In this configuration, the
1434
+ driver is expected to be running inside a Kubernetes environment with a configured
1435
+ [ServiceAccount](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#bound-service-account-token-volume).
1436
+
1437
+ If enabled, drivers MUST read the contents of the token from the local file path found using the following algorithm:
1438
+
1439
+ ` ` ` python
1440
+ if ' AZURE_FEDERATED_TOKEN_FILE' in os .environ :
1441
+ fname = os .environ [' AZURE_FEDERATED_TOKEN_FILE' ]
1442
+ elif ' AWS_WEB_IDENTITY_TOKEN_FILE' in os .environ :
1443
+ fname = os .environ [' AWS_WEB_IDENTITY_TOKEN_FILE' ]
1444
+ else:
1445
+ fname = ' /var/run/secrets/kubernetes.io/serviceaccount/token'
1446
+ ` ` `
1447
+
1448
+ Where ` AZURE_FEDERATED_TOKEN_FILE ` contains the file path on Azure Kubernetes Service (AKS),
1449
+ ` AWS_WEB_IDENTITY_TOKEN_FILE ` contains the file path on Elastic Kubernetes Service (EKS), and
1450
+ ` / var / run/ secrets/ kubernetes .io / serviceaccount/ token` is the default path for a Kubernetes
1451
+ [ServiceAccount token](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#serviceaccount-admission-controller),
1452
+ which is used by Google Kubernetes Engine (GKE).
1453
+
1454
+ The callback itself MUST not perform any caching, and the driver MUST cache its tokens in the same way as if a custom
1455
+ callback had been provided by the user.
1456
+
1457
+ For details on test environment setup, see the README in
1458
+ [Drivers-Evergreen-Tools](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/auth_oidc/k8s/README.md).
1459
+
1431
1460
#### OIDC Callback
1432
1461
1433
1462
Drivers MUST allow users to provide a callback that returns an OIDC access token. The purpose of the callback is to
@@ -2105,6 +2134,8 @@ practice to avoid this. (See
2105
2134
2106
2135
## Changelog
2107
2136
2137
+ - 2024-10-02: Add Kubernetes built-in OIDC provider integration.
2138
+
2108
2139
- 2024-08-19: Clarify Reauthentication and Speculative Authentication combination behavior.
2109
2140
2110
2141
- 2024-05-29: Disallow comma character when `TOKEN_RESOURCE` is given in a connection string.
0 commit comments