@@ -211,8 +211,9 @@ The following sections describe how to use the MONGODB-OIDC authentication mecha
211
211
authenticate to various platforms.
212
212
213
213
For more information about the MONGODB-OIDC authentication mechanism, see
214
- :manual:`OpenID Connect Authentication </core/security-oidc/>` in the MongoDB Server
215
- manual.
214
+ :manual:`OpenID Connect Authentication </core/security-oidc/>` and
215
+ :manual:`MongoDB Server Parameters </reference/parameters/#mongodb-parameter-param.oidcIdentityProviders>`
216
+ in the MongoDB Server manual.
216
217
217
218
.. _pymongo-mongodb-oidc-azure-imds:
218
219
@@ -233,9 +234,11 @@ You can configure OIDC for Azure IMDS in two ways: by passing arguments to the
233
234
:tabid: mongoclient
234
235
235
236
First, create a Python dictionary for your authentication mechanism properties, as shown
236
- in the following example. Replace the ``<audience>`` placeholder with
237
- the percent-encoded audience configured on your MongoDB deployment.
238
-
237
+ in the following example. Replace the ``<audience>`` placeholder with the
238
+ value of the ``audience`` parameter configured on your MongoDB deployment.
239
+
240
+ The following code example shows how to set these options in your connection string:
241
+
239
242
.. literalinclude:: /includes/authentication/azure-imds-mongoclient.py
240
243
:language: python
241
244
:copyable: true
@@ -268,12 +271,12 @@ You can configure OIDC for Azure IMDS in two ways: by passing arguments to the
268
271
of the managed identity. If you're using a service principal to represent an
269
272
enterprise application, set this to the application ID of the service principal.
270
273
- ``authMechanism``: Set to ``MONGODB-OIDC``.
271
- - ``authMechanismProperties``: Set to ``ENVIRONMENT:azure,TOKEN_RESOURCE:<audience>``.
272
- Replace the ``< audience>`` placeholder with the audience
273
- configured on your MongoDB deployment. You must percent-encode the audience value
274
- if it contains a comma (``,``), plus sign (``+``), or ampersand (``&``).
275
-
276
- The following code example shows how to set these options in your connection string:
274
+ - ``authMechanismProperties``: Set to
275
+ ``ENVIRONMENT:azure,TOKEN_RESOURCE:<percent-encoded audience>``.
276
+ Replace the ``<percent-encoded audience>`` placeholder with the percent-encoded
277
+ value of the ``audience`` parameter configured on your MongoDB deployment.
278
+
279
+ The following code example shows how to set these options in your connection string:
277
280
278
281
.. literalinclude:: /includes/authentication/azure-imds-connection-string.py
279
282
:language: python
@@ -305,7 +308,7 @@ You can configure OIDC for GCP IMDS in two ways: by passing arguments to the
305
308
306
309
First, create a Python dictionary for your authentication mechanism properties, as shown
307
310
in the following example. Replace the ``<audience>`` placeholder with
308
- the percent-encoded audience configured on your MongoDB deployment.
311
+ the value of the `` audience`` parameter configured on your MongoDB deployment.
309
312
310
313
.. literalinclude:: /includes/authentication/gcp-imds-mongoclient.py
311
314
:language: python
@@ -315,7 +318,6 @@ You can configure OIDC for GCP IMDS in two ways: by passing arguments to the
315
318
316
319
Then, set the following connection options:
317
320
318
- - ``username``: The client ID of the GCP managed identity.
319
321
- ``authMechanism``: Set to ``"MONGODB-OIDC"``.
320
322
- ``authMechanismProperties``: Set to the ``properties`` dictionary that you
321
323
created in the previous step.
@@ -326,26 +328,25 @@ You can configure OIDC for GCP IMDS in two ways: by passing arguments to the
326
328
.. literalinclude:: /includes/authentication/gcp-imds-mongoclient.py
327
329
:language: python
328
330
:copyable: true
329
- :emphasize-lines: 5-10
331
+ :emphasize-lines: 5-9
330
332
331
333
.. tab:: Connection String
332
334
:tabid: connectionstring
333
335
334
336
Include the following connection options in your connection string:
335
337
336
- - ``username``: The client ID of the GCP managed identity.
337
338
- ``authMechanism``: Set to ``MONGODB-OIDC``.
338
- - ``authMechanismProperties``: Set to ``ENVIRONMENT:gcp,TOKEN_RESOURCE:<audience>``.
339
- Replace the ``< audience>`` placeholder with the audience
340
- configured on your MongoDB deployment. You must percent-encode the audience value
341
- if it contains a comma (``,``), plus sign (``+``), or ampersand (``&``) .
339
+ - ``authMechanismProperties``: Set to
340
+ ``ENVIRONMENT:gcp,TOKEN_RESOURCE:<percent-encoded audience>``.
341
+ Replace the ``<percent-encoded audience>`` placeholder with the percent-encoded
342
+ value of the ``audience`` parameter configured on your MongoDB deployment .
342
343
343
344
The following code example shows how to set these options in your connection string:
344
345
345
346
.. literalinclude:: /includes/authentication/gcp-imds-connection-string.py
346
347
:language: python
347
348
:copyable: true
348
- :emphasize-lines: 4-7
349
+ :emphasize-lines: 4-6
349
350
350
351
.. _pymongo-mongodb-oidc-azure-envs:
351
352
0 commit comments