@@ -53,11 +53,11 @@ authentication mechanism.
53
53
The following code snippets show how to use the default authentication mechanism by
54
54
using the following placeholders:
55
55
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
61
61
authentication data. If you omit this parameter, the driver uses the
62
62
default value ``admin``.
63
63
@@ -107,8 +107,8 @@ SCRAM-SHA-256
107
107
108
108
.. note::
109
109
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 .
112
112
113
113
``SCRAM-SHA-256``, as defined by `RFC 7677 <https://www.rfc-editor.org/rfc/rfc7677>`__,
114
114
is a Salted Challenge Response Authentication Mechanism
@@ -118,11 +118,11 @@ algorithm, to authenticate your user.
118
118
The following code snippets show how to specify the authentication mechanism by
119
119
using the following placeholders:
120
120
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
126
126
authentication data. If you omit this parameter, the driver uses the
127
127
default value ``admin``.
128
128
@@ -171,7 +171,7 @@ SCRAM-SHA-1
171
171
172
172
.. note::
173
173
``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 .
175
175
176
176
``SCRAM-SHA-1``, as defined by `RFC 5802 <https://www.rfc-editor.org/rfc/rfc5802>`__,
177
177
is a Salted Challenge Response Authentication Mechanism (SCRAM) that uses your
@@ -181,11 +181,11 @@ your user.
181
181
The following code snippets show how to specify the authentication mechanism
182
182
by using the following placeholders:
183
183
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
189
189
authentication data. If you omit this parameter, the driver uses the
190
190
default value ``admin``.
191
191
@@ -232,10 +232,9 @@ mechanism:
232
232
MONGODB-X509
233
233
------------
234
234
235
- The ``X.509 `` authentication mechanism uses
235
+ The ``MONGODB-X509 `` authentication mechanism uses
236
236
: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``
239
238
authentication mechanism, the server authenticates the connection by using
240
239
the subject name of the client certificate.
241
240
@@ -288,7 +287,7 @@ mechanism:
288
287
:end-before: end-x509-mcred
289
288
290
289
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
292
291
:ref:`TLS/SSL guide <kotlin-sync-tls>`.
293
292
294
293
.. _kotlin-sync-auth-aws:
@@ -307,12 +306,12 @@ user. To learn more about configuring MongoDB Atlas, see the
307
306
:atlas:`Set Up Authentication with AWS IAM </security/aws-iam-authentication>`
308
307
guide.
309
308
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
312
311
the ``MongoCredential.createAwsCredential()`` factory method.
313
312
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.
316
315
317
316
These sections contain code examples that use the following placeholders:
318
317
@@ -328,24 +327,32 @@ These sections contain code examples that use the following placeholders:
328
327
AWS SDK
329
328
~~~~~~~
330
329
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:
333
340
334
341
- 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>`__
337
344
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 :
340
347
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.
343
350
#. Supply your credentials by using one of the methods in the credential
344
- provider chain
351
+ provider chain.
345
352
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
349
356
in the following example:
350
357
351
358
.. literalinclude:: /includes/security/authentication.kt
@@ -355,8 +362,8 @@ in the following example:
355
362
:end-before: end-aws-sdk-mcred
356
363
:emphasize-lines: 1, 9
357
364
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:
360
367
361
368
.. literalinclude:: /includes/security/authentication.kt
362
369
:language: kotlin
@@ -416,15 +423,15 @@ appropriate environment variables.
416
423
To use the environment variables to supply your credentials, you must perform
417
424
the following:
418
425
419
- 1. Specify the authentication mechanism
420
- #. Add the appropriate environment variables
426
+ 1. Specify the authentication mechanism.
427
+ #. Add the appropriate environment variables.
421
428
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.
424
431
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
428
435
example:
429
436
430
437
.. literalinclude:: /includes/security/authentication.kt
@@ -434,8 +441,8 @@ example:
434
441
:end-before: end-aws-env-mcred
435
442
:emphasize-lines: 1, 9
436
443
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:
439
446
440
447
.. literalinclude:: /includes/security/authentication.kt
441
448
:language: kotlin
@@ -464,7 +471,7 @@ session token for that role.
464
471
465
472
To authenticate by using **ECS container credentials**, set the ECS
466
473
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:
468
475
469
476
.. code-block:: bash
470
477
@@ -481,23 +488,24 @@ Specify Your Credentials in a MongoCredential
481
488
482
489
You can supply your AWS IAM credentials to a ``MongoClient`` by using a
483
490
``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)>`__
485
493
factory method.
486
494
487
495
You can supply only programmatic access keys to the
488
496
``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
490
498
:ref:`<kotlin-mongodb-aws-env-variables>` or :ref:`<kotlin-mongodb-aws-sdk>`.
491
499
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 :
494
502
495
- 1. Specify the authentication mechanism
496
- #. Supply the credentials
503
+ 1. Specify the authentication mechanism.
504
+ #. Supply the credentials.
497
505
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
501
509
in the following example:
502
510
503
511
.. literalinclude:: /includes/security/authentication.kt
@@ -509,7 +517,7 @@ in the following example:
509
517
510
518
If you need to specify an AWS session token, pass it to the
511
519
`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:
513
521
514
522
.. literalinclude:: /includes/security/authentication.kt
515
523
:language: kotlin
@@ -519,7 +527,7 @@ method as shown in the following example:
519
527
:emphasize-lines: 1, 2, 10
520
528
521
529
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:
523
531
524
532
.. literalinclude:: /includes/security/authentication.kt
525
533
:language: kotlin
@@ -529,7 +537,7 @@ that returns new credentials as shown in the following example:
529
537
:emphasize-lines: 4-6, 9
530
538
531
539
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)>`__
533
541
method:
534
542
535
543
.. literalinclude:: /includes/security/authentication.kt
@@ -543,7 +551,7 @@ Additional Information
543
551
----------------------
544
552
545
553
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.
547
555
548
556
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