Skip to content

Commit 55edbc0

Browse files
committed
DOCSP-48719: Update non-Mongo credential placeholders (#240)
(cherry picked from commit fc4211c)
1 parent 4241978 commit 55edbc0

File tree

1 file changed

+51
-3
lines changed

1 file changed

+51
-3
lines changed

source/security.txt

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,19 +445,30 @@ Windows
445445

446446
.. code-block:: python
447447

448+
<<<<<<< HEAD
448449
client = pymongo.MongoClient("mongodb://<hostname>:<port>",
449450
username="<db_username>",
450451
authMechanism="GSSAPI",
451452
password="<db_password>",
452453
authMechanismProperties="SERVICE_NAME:<authentication service name>,
453454
CANONICALIZE_HOST_NAME:true,
454455
SERVICE_REALM:<service realm>")
456+
=======
457+
client = pymongo.MongoClient("mongodb://<hostname>:<port>",
458+
username="<username>",
459+
authMechanism="GSSAPI",
460+
password="<password>",
461+
authMechanismProperties="SERVICE_NAME:<authentication service name>,
462+
CANONICALIZE_HOST_NAME:true,
463+
SERVICE_REALM:<service realm>")
464+
>>>>>>> fc4211c (DOCSP-48719: Update non-Mongo credential placeholders (#240))
455465

456466
.. tab:: Connection String
457467
:tabid: connectionstring
458468

459469
.. code-block:: python
460470

471+
<<<<<<< HEAD
461472
uri = ("mongodb://<percent-encoded username>:<percent-encoded user password>"
462473
"@<hostname>:<port>/?"
463474
"&authMechanism=GSSAPI"
@@ -466,6 +477,43 @@ Windows
466477
"CANONICALIZE_HOST_NAME:true,"
467478
"SERVICE_REALM:<service realm>")
468479
client = pymongo.MongoClient(uri)
480+
=======
481+
uri = ("mongodb://<percent-encoded username>:<percent-encoded user password>"
482+
"@<hostname>:<port>/?"
483+
"&authMechanism=GSSAPI"
484+
"&authMechanismProperties="
485+
"SERVICE_NAME:<authentication service name>,"
486+
"CANONICALIZE_HOST_NAME:true,"
487+
"SERVICE_REALM:<service realm>")
488+
client = pymongo.MongoClient(uri)
489+
490+
.. tab:: MongoClient (Asynchronous)
491+
:tabid: mongoclient-async
492+
493+
.. code-block:: python
494+
495+
client = pymongo.AsyncMongoClient("mongodb://<hostname>:<port>",
496+
username="<username>",
497+
authMechanism="GSSAPI",
498+
password="<password>",
499+
authMechanismProperties="SERVICE_NAME:<authentication service name>,
500+
CANONICALIZE_HOST_NAME:true,
501+
SERVICE_REALM:<service realm>")
502+
503+
.. tab:: Connection String (Asynchronous)
504+
:tabid: connectionstring-async
505+
506+
.. code-block:: python
507+
508+
uri = ("mongodb://<percent-encoded username>:<percent-encoded user password>"
509+
"@<hostname>:<port>/?"
510+
"&authMechanism=GSSAPI"
511+
"&authMechanismProperties="
512+
"SERVICE_NAME:<authentication service name>,"
513+
"CANONICALIZE_HOST_NAME:true,"
514+
"SERVICE_REALM:<service realm>")
515+
client = pymongo.AsyncMongoClient(uri)
516+
>>>>>>> fc4211c (DOCSP-48719: Update non-Mongo credential placeholders (#240))
469517

470518
To learn more about authenticating with Kerberos, see
471519
:ref:`pymongo-kerberos` in the Enterprise Authentication guide.
@@ -485,8 +533,8 @@ PLAIN SASL
485533
.. code-block:: python
486534

487535
client = pymongo.MongoClient("mongodb://<hostname>:<port>",
488-
username="<db_username>",
489-
password="<db_password>",
536+
username="<username>",
537+
password="<password>",
490538
authMechanism="PLAIN",
491539
tls=True)
492540

@@ -495,7 +543,7 @@ PLAIN SASL
495543

496544
.. code-block:: python
497545

498-
uri = ("mongodb://<db_username>:<db_password>@<hostname>:<port>/?"
546+
uri = ("mongodb://<username>:<password>@<hostname>:<port>/?"
499547
"&authMechanism=PLAIN"
500548
"&tls=true")
501549
client = pymongo.MongoClient(uri)

0 commit comments

Comments
 (0)