Skip to content

Commit

Permalink
DOCSP-42382: Update connection string placeholders (#56)
Browse files Browse the repository at this point in the history
* DOCSP-42382: Update connection string placeholders

* edits
  • Loading branch information
norareidy authored Aug 13, 2024
1 parent 8b34d6e commit 2064458
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions source/connect/client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ A standard connection string includes the following components:
- Required. A prefix that identifies this as a string in the
standard connection format.

* - ``username:password``
* - ``db_username:db_password``

- Optional. Authentication credentials. If you include these, the client
authenticates the user against the database specified in ``authSource``.
Expand All @@ -69,7 +69,7 @@ A standard connection string includes the following components:
* - ``/defaultauthdb``

- Optional. The authentication database to use if the
connection string includes ``username:password@``
connection string includes ``db_username:db_password@``
authentication credentials but not the ``authSource`` option. If you don't include
this component, the client authenticates the user against the ``admin`` database.

Expand Down
8 changes: 4 additions & 4 deletions source/includes/authentication.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// start-scram-sha-256
auto uri = mongocxx::uri("mongodb://<username>:<password>@<hostname>:<port>/?"
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?"
"authSource=admin&authMechanism=SCRAM-SHA-256");
auto client = mongocxx::client(uri);
// end-scram-sha-256

// start-scram-sha-1
auto uri = mongocxx::uri("mongodb://<username>:<password>@<hostname>:<port>/?"
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?"
"authSource=admin&authMechanism=SCRAM-SHA-1");
auto client = mongocxx::client(uri);
// end-scram-sha-1
Expand Down Expand Up @@ -35,14 +35,14 @@ auto client = mongocxx::client(uri);
// end-aws-environment

// start-kerberos
auto uri = mongocxx::uri("mongodb://mongodbuser%40EXAMPLE.COM@<hostname>:<port>/?"
auto uri = mongocxx::uri("mongodb://<Kerberos principal>@<hostname>:<port>/?"
"authMechanism=GSSAPI"
"&authMechanismProperties=SERVICE_NAME:<authentication service name>");
auto client = mongocxx::client(uri);
// end-kerberos

// start-plain
auto uri = mongocxx::uri("mongodb://<username>:<password>@<hostname>:<port>/?"
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?"
"authMechanism=PLAIN&tls=true");
auto client = mongocxx::client(uri);
// end-plain
8 changes: 4 additions & 4 deletions source/security/authentication.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ running MongoDB v4.0 or later.

To authenticate with this mechanism, set the following connection options:

- ``username``: The username to authenticate.
- ``password``: The password to authenticate.
- ``db_username``: The database username to authenticate.
- ``db_password``: The database password to authenticate.
- ``authSource``: The MongoDB database to authenticate against. By default,
{+driver-short+} authenticates against the database in the connection
URI, if you include one. If you don't, it authenticates against the ``admin`` database.
Expand All @@ -61,8 +61,8 @@ running MongoDB v3.6.

To authenticate with this mechanism, set the following connection options:

- ``username``: The username to authenticate.
- ``password``: The password to authenticate.
- ``db_username``: The username to authenticate.
- ``db_password``: The password to authenticate.
- ``authSource``: The MongoDB database to authenticate against. By default,
{+driver-short+} authenticates against the ``admin`` database.
- ``authMechanism``: Set to ``"SCRAM-SHA-1"``.
Expand Down
2 changes: 1 addition & 1 deletion source/security/enterprise-authentication.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Complete the following steps to authenticate with GSSAPI:

Next, set the following connection options:

- ``username``: The Kerbos principal to authenticate.
- ``Kerberos principal``: The Kerberos principal to authenticate.
- ``authMechanism``: Set to ``"GSSAPI"``.
- ``authMechanismProperties``: Optional. By default, MongoDB uses ``mongodb`` as
the authentication service name. To specify a different service name, set
Expand Down

0 comments on commit 2064458

Please sign in to comment.