8000 [Backport v5.4] DOCSP-48713 Update non-MongoDB credentials by github-actions[bot] · Pull Request #677 · mongodb/docs-java · GitHub
[go: up one dir, main page]

Skip to content

[Backport v5.4] DOCSP-48713 Update non-MongoDB credentials #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
DOCSP-48713 Update non-MongoDB credentials (#676)
* DOCSP-48713 Update non-MongoDB credentials

* edits to gssapi

(cherry picked from commit ba0d907)
  • Loading branch information
lindseymoore authored and github-actions[bot] committed Apr 25, 2025
commit c9536e3385d9ff882c9081d6623674d8c1b7a7d4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. code-block:: java

MongoCredential credential = MongoCredential.createGSSAPICredential(<db_username>);
MongoCredential credential = MongoCredential.createGSSAPICredential(<principal_username>);
credential = credential.withMechanismProperty(MongoCredential.SERVICE_NAME_KEY, "myService");

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
loginContext.login();
Subject subject = loginContext.getSubject();

MongoCredential credential = MongoCredential.createGSSAPICredential(<db_username>);
MongoCredential credential = MongoCredential.createGSSAPICredential(<principal_username>);
credential = credential.withMechanismProperty(MongoCredential.JAVA_SUBJECT_KEY, subject);

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* all MongoClient instances sharing this instance of KerberosSubjectProvider
will share a Kerberos ticket cache */
String myLoginContext = "myContext";
MongoCredential credential = MongoCredential.createGSSAPICredential(<db_username>);
MongoCredential credential = MongoCredential.createGSSAPICredential(<principal_username>);
/* login context defaults to "com.sun.security.jgss.krb5.initiate"
if unspecified in KerberosSubjectProvider */
credential = credential.withMechanismProperty(MongoCredential.JAVA_SUBJECT_PROVIDER_KEY,
Expand Down
10000
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. code-block:: java

MongoCredential credential = MongoCredential.createGSSAPICredential(<db_username>);
MongoCredential credential = MongoCredential.createGSSAPICredential(<principal_username>);

MongoClient mongoClient = MongoClients.create(
MongoClientSettings.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. code-block:: java

MongoCredential credential = MongoCredential.createPlainCredential(<db_username>, "$external", <db_password>);
MongoCredential credential = MongoCredential.createPlainCredential(<username>, "$external", <db_password>);

MongoClient mongoClient = MongoClients.create(
MongoClientSettings.builder()
Expand Down
6 changes: 3 additions & 3 deletions source/security/auth/kerberos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Code Placeholders

The code examples on this page use the following placeholders:

- ``<db_username>``: Your :wikipedia:`URL-encoded <Percent-encoding>` principal name. For
- ``<principal_username>``: Your :wikipedia:`URL-encoded <Percent-encoding>` principal name. For
example: ``"username%40REALM.ME"``
- ``<hostname>``: The network address of your MongoDB deployment.
- ``<port>``: The port number of your MongoDB deployment. If you omit this parameter,
Expand Down Expand Up @@ -64,7 +64,7 @@ mechanism:

.. code-block:: java

MongoClient mongoClient = MongoClients.create("<db_username>@<hostname>:<port>/?authSource=$external&authMechanism=GSSAPI");
MongoClient mongoClient = MongoClients.create("<principal_username>@<hostname>:<port>/?authSource=$external&authMechanism=GSSAPI");

.. tab::
:tabid: MongoCredential
Expand Down Expand Up @@ -125,7 +125,7 @@ You might need to specify one or more of the following

.. code-block:: java

MongoClient mongoClient = MongoClients.create("<db_username>@<hostname>:<port>/?authSource=$external&authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:myService");
MongoClient mongoClient = MongoClients.create("<principal_username>@<hostname>:<port>/?authSource=$external&authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:myService");

.. tab::
:tabid: MongoCredential
Expand Down
6 changes: 3 additions & 3 deletions source/security/auth/ldap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Code Placeholders

The code examples on this page use the following placeholders:

- ``<db_username>``: Your LDAP username.
- ``<db_password>``: Your LDAP password.
- ``<username>``: Your LDAP username.
- ``<password>``: Your LDAP password.
- ``<hostname>``: The network address of your MongoDB deployment.
- ``<port>``: The port number of your MongoDB deployment. If you omit this parameter,
the driver uses the default port number (``27017``). You don't need to specify a port
Expand Down Expand Up @@ -70,7 +70,7 @@ mechanism:

.. code-block:: java

MongoClient mongoClient = MongoClients.create("<db_username>:<db_password>@<hostname>:<port>/?authSource=$external&authMechanism=PLAIN");
MongoClient mongoClient = MongoClients.create("<username>:<password>@<hostname>:<port>/?authSource=$external&authMechanism=PLAIN");

.. tab::
:tabid: MongoCredential
Expand Down
0