Skip to content

Commit a80b26c

Browse files
committed
Fix
1 parent 1146de3 commit a80b26c

File tree

2 files changed

+33
-85
lines changed

2 files changed

+33
-85
lines changed

source/includes/connect/key-file-password.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
.. code-block:: python
3838
39-
uri = ("mongodb://<db_username>:<db_password
39+
uri = ("mongodb://<db_username>:<db_password"
4040
"@<hostname>:<port>/?"
4141
"tls=true"
4242
"&tlsCertificateKeyFile=path/to/client.pem"

source/security/authentication/oidc.txt

Lines changed: 32 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -222,59 +222,33 @@ implement a ``fetch()`` method, which returns the OIDC token in the form of an
222222

223223
The following example shows how to define a callback class named ``MyCallback``. This class
224224
includes a ``fetch()`` method that retrieves an OIDC token from a file in the standard
225-
service-account token-file location. Select the :guilabel:`Synchronous` or
226-
:guilabel:`Asynchronous` tab to see the corresponding code:
225+
service-account token-file location.
227226

228-
.. tabs::
229-
230-
.. tab:: Synchronous
231-
:tabid: sync
232-
233-
.. literalinclude:: /includes/authentication/azure-envs-mongoclient.py
234-
:language: python
235-
:copyable: true
236-
:start-after: # define callback, properties, and MongoClient
237-
:end-before: properties = {"OIDC_CALLBACK": MyCallback()}
238-
239-
.. tab:: Asynchronous
240-
:tabid: async
241-
242-
.. literalinclude:: /includes/authentication/azure-envs-mongoclient-async.py
243-
:language: python
244-
:copyable: true
245-
:start-after: # define callback, properties, and MongoClient
246-
:end-before: properties = {"OIDC_CALLBACK": MyCallback()}
227+
.. literalinclude:: /includes/authentication/azure-envs-mongoclient.py
228+
:language: python
229+
:copyable: true
230+
:start-after: # define callback, properties, and MongoClient
231+
:end-before: properties = {"OIDC_CALLBACK": MyCallback()}
247232

248233
After you define your callback class, create a Python dictionary that contains one key,
249234
``"OIDC_CALLBACK"``, whose value is an instance of your custom callback class:
250235

251-
.. tabs::
252-
253-
.. tab:: Synchronous
254-
:tabid: sync
255-
256-
.. literalinclude:: /includes/authentication/azure-envs-mongoclient.py
257-
:language: python
258-
:copyable: true
259-
:start-after: return OIDCCallbackResult(access_token=token)
260-
:end-before: client = MongoClient(
236+
.. literalinclude:: /includes/authentication/azure-envs-mongoclient.py
237+
:language: python
238+
:copyable: true
239+
:start-after: return OIDCCallbackResult(access_token=token)
240+
:end-before: client = MongoClient(
261241

262-
.. tab:: Asynchronous
263-
:tabid: async
264-
265-
.. literalinclude:: /includes/authentication/azure-envs-mongoclient-async.py
266-
:language: python
267-
:copyable: true
268-
:start-after: return OIDCCallbackResult(access_token=token)
269-
:end-before: client = AsyncMongoClient(
270-
271-
Finally, set the following connection options by passing arguments to the ``MongoClient``
272-
constructor:
242+
Finally, set the following connection options by passing the followingarguments to the
243+
``MongoClient`` constructor:
273244

274245
- ``authMechanism``: Set to ``"MONGODB-OIDC"``.
275246
- ``authMechanismProperties``: Set to the ``properties`` dictionary that you created in the
276247
previous step.
277248

249+
Select the :guilabel:`Synchronous` or :guilabel:`Asynchronous` tab to see the corresponding
250+
code:
251+
278252
.. tabs::
279253

280254
.. tab:: Synchronous
@@ -308,59 +282,33 @@ implement a ``fetch()`` method, which returns the OIDC token in the form of an
308282

309283
The following example shows how to define a callback class named ``MyCallback``. This class
310284
includes a ``fetch()`` method that retrieves an OIDC token from a file in the standard
311-
service-account token-file location. Select the :guilabel:`Synchronous` or
312-
:guilabel:`Asynchronous` tab to see the corresponding code:
285+
service-account token-file location.
313286

314-
.. tabs::
315-
316-
.. tab:: Synchronous
317-
:tabid: sync
318-
319-
.. literalinclude:: /includes/authentication/gcp-gke-mongoclient.py
320-
:language: python
321-
:copyable: true
322-
:start-after: # define callback, properties, and MongoClient
323-
:end-before: properties = {"OIDC_CALLBACK": MyCallback()}
324-
325-
.. tab:: Asynchronous
326-
:tabid: async
327-
328-
.. literalinclude:: /includes/authentication/gcp-gke-mongoclient-async.py
329-
:language: python
330-
:copyable: true
331-
:start-after: # define callback, properties, and MongoClient
332-
:end-before: properties = {"OIDC_CALLBACK": MyCallback()}
287+
.. literalinclude:: /includes/authentication/gcp-gke-mongoclient.py
288+
:language: python
289+
:copyable: true
290+
:start-after: # define callback, properties, and MongoClient
291+
:end-before: properties = {"OIDC_CALLBACK": MyCallback()}
333292

334293
After you define your callback class, create a Python dictionary that contains one key,
335294
``"OIDC_CALLBACK"``, whose value is an instance of your custom callback class:
336295

337-
.. tabs::
338-
339-
.. tab:: Synchronous
340-
:tabid: sync
341-
342-
.. literalinclude:: /includes/authentication/gcp-gke-mongoclient.py
343-
:language: python
344-
:copyable: true
345-
:start-after: return OIDCCallbackResult(access_token=token)
346-
:end-before: client = MongoClient(
296+
.. literalinclude:: /includes/authentication/gcp-gke-mongoclient.py
297+
:language: python
298+
:copyable: true
299+
:start-after: return OIDCCallbackResult(access_token=token)
300+
:end-before: client = MongoClient(
347301

348-
.. tab:: Asynchronous
349-
:tabid: async
350-
351-
.. literalinclude:: /includes/authentication/gcp-gke-mongoclient-async.py
352-
:language: python
353-
:copyable: true
354-
:start-after: return OIDCCallbackResult(access_token=token)
355-
:end-before: client = AsyncMongoClient(
356-
357-
Finally, set the following connection options by passing arguments to the ``MongoClient``
358-
constructor:
302+
Finally, set the following connection options by passing the following arguments to the
303+
``MongoClient`` constructor:
359304

360305
- ``authMechanism``: Set to ``"MONGODB-OIDC"``.
361306
- ``authMechanismProperties``: Set to the ``properties`` dictionary that you created
362307
in the previous step.
363308

309+
Select the :guilabel:`Synchronous` or :guilabel:`Asynchronous` tab to see the corresponding
310+
code:
311+
364312
.. tabs::
365313

366314
.. tab:: Synchronous

0 commit comments

Comments
 (0)