Skip to content

Commit d75ca0a

Browse files
committed
last comments
1 parent ade5e21 commit d75ca0a

File tree

1 file changed

+72
-64
lines changed

1 file changed

+72
-64
lines changed

source/security/authentication.txt

Lines changed: 72 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ authentication mechanism.
5353
The following code snippets show how to use the default authentication mechanism by
5454
using the following placeholders:
5555

56-
* ``db_username``: your MongoDB database username
57-
* ``db_password``: your MongoDB database user's password
58-
* ``hostname``: network address of your MongoDB server, accessible by your client
59-
* ``port``: port number of your MongoDB server
60-
* ``authenticationDb``: MongoDB database that contains your user's
56+
* ``db_username``: Your MongoDB database username.
57+
* ``db_password``: Your MongoDB database user's password.
58+
* ``hostname``: The network address of your MongoDB deployment, accessible by your client.
59+
* ``port``: The port number of your MongoDB deployment.
60+
* ``authenticationDb``: The MongoDB database that contains your user's
6161
authentication data. If you omit this parameter, the driver uses the
6262
default value ``admin``.
6363

@@ -107,8 +107,8 @@ SCRAM-SHA-256
107107

108108
.. note::
109109

110-
``SCRAM-SHA-256`` is the default authentication method for MongoDB starting
111-
in MongoDB 4.0.
110+
``SCRAM-SHA-256`` is the default authentication method for {+mdb-server+}
111+
versions 4.0 and later.
112112

113113
``SCRAM-SHA-256``, as defined by `RFC 7677 <https://www.rfc-editor.org/rfc/rfc7677>`__,
114114
is a Salted Challenge Response Authentication Mechanism
@@ -118,11 +118,11 @@ algorithm, to authenticate your user.
118118
The following code snippets show how to specify the authentication mechanism by
119119
using the following placeholders:
120120

121-
* ``db_username``: your MongoDB database username.
122-
* ``db_password``: your MongoDB database user's password.
123-
* ``hostname``: network address of your MongoDB server, accessible by your client.
124-
* ``port``: port number of your MongoDB server.
125-
* ``authenticationDb``: MongoDB database that contains your user's
121+
* ``db_username``: Your MongoDB database username.
122+
* ``db_password``: Your MongoDB database user's password.
123+
* ``hostname``: The network address of your MongoDB deployment, accessible by your client.
124+
* ``port``: The port number of your MongoDB deployment.
125+
* ``authenticationDb``: The MongoDB database that contains your user's
126126
authentication data. If you omit this parameter, the driver uses the
127127
default value ``admin``.
128128

@@ -171,7 +171,7 @@ SCRAM-SHA-1
171171

172172
.. note::
173173
``SCRAM-SHA-1`` is the default authentication method for MongoDB versions
174-
3.0, 3.2, 3.4, and 3.6.
174+
{+mdb-server+} versions 3.6 and earlier.
175175

176176
``SCRAM-SHA-1``, as defined by `RFC 5802 <https://www.rfc-editor.org/rfc/rfc5802>`__,
177177
is a Salted Challenge Response Authentication Mechanism (SCRAM) that uses your
@@ -181,11 +181,11 @@ your user.
181181
The following code snippets show how to specify the authentication mechanism
182182
by using the following placeholders:
183183

184-
* ``db_username``: your MongoDB database username.
185-
* ``db_password``: your MongoDB database user's password.
186-
* ``hostname``: network address of your MongoDB server, accessible by your client.
187-
* ``port``: port number of your MongoDB server.
188-
* ``authenticationDb``: MongoDB database that contains your user's
184+
* ``db_username``: Your MongoDB database username.
185+
* ``db_password``: Your MongoDB database user's password.
186+
* ``hostname``: The network address of your MongoDB deployment, accessible by your client.
187+
* ``port``: The port number of your MongoDB deployment.
188+
* ``authenticationDb``: The MongoDB database that contains your user's
189189
authentication data. If you omit this parameter, the driver uses the
190190
default value ``admin``.
191191

@@ -232,10 +232,9 @@ mechanism:
232232
MONGODB-X509
233233
------------
234234

235-
The ``X.509`` authentication mechanism uses
235+
The ``MONGODB-X509`` authentication mechanism uses
236236
:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
237-
authenticate your user, identified by the relative distinguished names
238-
(RDNs) of your client certificate. When you specify the ``X.509``
237+
authenticate your user. When you specify the ``X.509``
239238
authentication mechanism, the server authenticates the connection by using
240239
the subject name of the client certificate.
241240

@@ -288,7 +287,7 @@ mechanism:
288287
:end-before: end-x509-mcred
289288

290289
For additional information on configuring your application to use
291-
certificates as well as TLS/SSL options, see our
290+
certificates as well as TLS/SSL options, see the
292291
:ref:`TLS/SSL guide <kotlin-sync-tls>`.
293292

294293
.. _kotlin-sync-auth-aws:
@@ -307,12 +306,12 @@ user. To learn more about configuring MongoDB Atlas, see the
307306
:atlas:`Set Up Authentication with AWS IAM </security/aws-iam-authentication>`
308307
guide.
309308

310-
To instruct the driver to use this authentication mechanism, you can specify
311-
``MONGODB-AWS`` either as a parameter in the connection string or by using
309+
To instruct the driver to use this authentication mechanism, you can either
310+
specify ``MONGODB-AWS`` as a parameter in the connection string or call
312311
the ``MongoCredential.createAwsCredential()`` factory method.
313312

314-
Learn how to specify this authentication mechanism and the various ways to
315-
provide your AWS IAM credentials in the next sections.
313+
In the following sections, you can learn different ways to specify the
314+
``MONGODB-AWS`` authentication mechanism and provide your AWS IAM credentials.
316315

317316
These sections contain code examples that use the following placeholders:
318317

@@ -328,24 +327,32 @@ These sections contain code examples that use the following placeholders:
328327
AWS SDK
329328
~~~~~~~
330329

331-
You can use one of the AWS SDK for Java v1 or v2 to specify your credentials.
332-
This method offers the following features:
330+
.. note:: End of Support for AWS SDK for Java v1
331+
332+
The AWS SDK for Java v1 will reach end of support on Decemeber 31, 2025.
333+
AWS recommends migrating to AWS SDK for Java v2. For more information,
334+
see the `end of support announcement
335+
<https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-aws-sdk-for-java-v1-x-on-december-31-2025/>`__
336+
on the AWS site.
337+
338+
AWS provides software development kits (SDKs) for Java v1 and v2.
339+
The AWS SDK offers the following features:
333340

334341
- Multiple options for obtaining credentials
335-
- Credential caching which helps your application avoid rate limiting
336-
- Credential provider management for use with the `Elastic Kubernetes Service <https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html>`__.
342+
- Credential caching, which helps your application avoid rate limiting
343+
- Credential provider management for use with the `Elastic Kubernetes Service <https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html>`__
337344

338-
To use the AWS SDK for Java for ``MONGODB-AWS`` authentication, you must
339-
perform the following:
345+
To use the AWS SDK for ``MONGODB-AWS`` authentication, you must
346+
perform the following steps:
340347

341-
1. Specify the authentication mechanism
342-
#. Add the SDK as a dependency to your project
348+
1. Specify the authentication mechanism.
349+
#. Add the SDK as a dependency to your project.
343350
#. Supply your credentials by using one of the methods in the credential
344-
provider chain
351+
provider chain.
345352

346-
To specify the authentication mechanism by using a ``MongoCredential``,
347-
use the ``MongoCredential.createAwsCredential()`` factory method
348-
and add the ``MongoCredential`` instance to your ``MongoClient`` as shown
353+
To specify the ``MONGODB-AWS`` authentication mechanism by using a ``MongoCredential``
354+
object, call the ``MongoCredential.createAwsCredential()`` factory method
355+
and add the ``MongoCredential`` instance to your ``MongoClient``, as shown
349356
in the following example:
350357

351358
.. literalinclude:: /includes/security/authentication.kt
@@ -355,8 +362,8 @@ in the following example:
355362
:end-before: end-aws-sdk-mcred
356363
:emphasize-lines: 1, 9
357364

358-
To specify the authentication mechanism in the connection string, add
359-
it as a parameter as shown in the following example:
365+
To specify the ``MONGODB-AWS`` authentication mechanism in the connection string,
366+
add it as a parameter, as shown in the following example:
360367

361368
.. literalinclude:: /includes/security/authentication.kt
362369
:language: kotlin
@@ -416,15 +423,15 @@ appropriate environment variables.
416423
To use the environment variables to supply your credentials, you must perform
417424
the following:
418425

419-
1. Specify the authentication mechanism
420-
#. Add the appropriate environment variables
426+
1. Specify the authentication mechanism.
427+
#. Add the appropriate environment variables.
421428

422-
You can specify the authentication mechanism by using a ``MongoCredential``
423-
or on the connection string.
429+
You can specify the ``MONGODB-AWS`` authentication mechanism by using a
430+
``MongoCredential`` object or in the connection string.
424431

425-
To specify the authentication mechanism by using a ``MongoCredential``,
426-
use the ``MongoCredential.createAwsCredential()`` factory method and add the
427-
``MongoCredential`` instance to your ``MongoClient`` as shown in the following
432+
To specify the authentication mechanism by using a ``MongoCredential`` object,
433+
call the ``MongoCredential.createAwsCredential()`` factory method and add the
434+
``MongoCredential`` instance to your ``MongoClient``, as shown in the following
428435
example:
429436

430437
.. literalinclude:: /includes/security/authentication.kt
@@ -434,8 +441,8 @@ example:
434441
:end-before: end-aws-env-mcred
435442
:emphasize-lines: 1, 9
436443

437-
To specify the authentication mechanism in the connection string, add it as a
438-
parameter as shown in the following example:
444+
To specify the ``MONGODB-AWS`` authentication mechanism in the connection
445+
string, add it as a parameter as shown in the following example:
439446

440447
.. literalinclude:: /includes/security/authentication.kt
441448
:language: kotlin
@@ -464,7 +471,7 @@ session token for that role.
464471

465472
To authenticate by using **ECS container credentials**, set the ECS
466473
endpoint relative URI in an environment variable by using ``bash`` or
467-
a similar shell as shown in the following example:
474+
a similar shell, as shown in the following example:
468475

469476
.. code-block:: bash
470477

@@ -481,23 +488,24 @@ Specify Your Credentials in a MongoCredential
481488

482489
You can supply your AWS IAM credentials to a ``MongoClient`` by using a
483490
``MongoCredential`` instance. To construct the ``MongoCredential`` instance
484-
for ``MONGODB-AWS`` authentication, use the `createAwsCredential() <{+core-api+}/com/mongodb/MongoCredential.html#createAwsCredential(java.lang.String,char%5B%5D)>`__
491+
for ``MONGODB-AWS`` authentication, call the
492+
`createAwsCredential() <{+core-api+}/com/mongodb/MongoCredential.html#createAwsCredential(java.lang.String,char%5B%5D)>`__
485493
factory method.
486494

487495
You can supply only programmatic access keys to the
488496
``MongoCredential.createAwsCredential()`` method. If you need to supply ECS
489-
or EC2 container credentials, use the instructions in
497+
or EC2 container credentials, follow the instructions in
490498
:ref:`<kotlin-mongodb-aws-env-variables>` or :ref:`<kotlin-mongodb-aws-sdk>`.
491499

492-
To use the ``MongoCredential`` for ``MONGODB-AWS`` authentication, you
493-
must perform the following:
500+
To use a ``MongoCredential`` object for ``MONGODB-AWS`` authentication, you
501+
must perform the following steps:
494502

495-
1. Specify the authentication mechanism
496-
#. Supply the credentials
503+
1. Specify the authentication mechanism.
504+
#. Supply the credentials.
497505

498-
To specify the authentication mechanism by using a ``MongoCredential``,
499-
use the ``MongoCredential.createAwsCredential()`` factory method
500-
and add the ``MongoCredential`` instance to your ``MongoClient`` as shown
506+
To specify the authentication mechanism by using a ``MongoCredential`` object,
507+
call the ``MongoCredential.createAwsCredential()`` factory method
508+
and add the ``MongoCredential`` instance to your ``MongoClient``, as shown
501509
in the following example:
502510

503511
.. literalinclude:: /includes/security/authentication.kt
@@ -509,7 +517,7 @@ in the following example:
509517

510518
If you need to specify an AWS session token, pass it to the
511519
`withMechanismProperty() <{+core-api+}/com/mongodb/MongoCredential.html#withMechanismProperty(java.lang.String,T)>`__
512-
method as shown in the following example:
520+
method, as shown in the following example:
513521

514522
.. literalinclude:: /includes/security/authentication.kt
515523
:language: kotlin
@@ -519,7 +527,7 @@ method as shown in the following example:
519527
:emphasize-lines: 1, 2, 10
520528

521529
To refresh your credentials, you can declare a ``Supplier`` lambda expression
522-
that returns new credentials as shown in the following example:
530+
that returns new credentials, as shown in the following example:
523531

524532
.. literalinclude:: /includes/security/authentication.kt
525533
:language: kotlin
@@ -529,7 +537,7 @@ that returns new credentials as shown in the following example:
529537
:emphasize-lines: 4-6, 9
530538

531539
If you must provide AWS IAM credentials in a connection string, you can add
532-
it to your ``MongoClientSettings`` by calling the `applyConnectionString() <{+core-api+}/com/mongodb/MongoClientSettings.Builder.html#applyConnectionString(com.mongodb.ConnectionString)>`__
540+
it to your ``MongoClientSettings`` object by calling the `applyConnectionString() <{+core-api+}/com/mongodb/MongoClientSettings.Builder.html#applyConnectionString(com.mongodb.ConnectionString)>`__
533541
method:
534542

535543
.. literalinclude:: /includes/security/authentication.kt
@@ -543,7 +551,7 @@ Additional Information
543551
----------------------
544552

545553
To learn more about authenticating to MongoDB, see
546-
:manual:`Authentication </core/authentication/>` in the Server manual.
554+
:manual:`Authentication </core/authentication/>` in the {+mdb-server+} manual.
547555

548556
To learn more about managing users of your MongoDB deployment, see
549-
:manual:`Users </core/security-users/>` in the Server manual.
557+
:manual:`Users </core/security-users/>` in the {+mdb-server+} manual.

0 commit comments

Comments
 (0)