@@ -20,41 +20,42 @@ Authentication Mechanisms
20
20
Overview
21
21
--------
22
22
23
- In this guide, you can learn how to authenticate with MongoDB using each
24
- **authentication mechanism** available in the MongoDB Community Edition .
25
- Authentication mechanisms are processes by which the driver and server
26
- confirm identity and establish trust to ensure security.
23
+ In this guide, you can learn how to authenticate to a MongoDB Server by using
24
+ each **authentication mechanism** available in the {+driver-long+} .
25
+ Authentication is the process by which the driver proves its identity to the
26
+ server to ensure security.
27
27
28
- To select a specific authentication mechanism, you can specify the
29
- mechanism, your credentials, and other necessary information
30
- in the options of your connection string or in a ``Credential`` struct.
28
+ To learn more about the connection string formats and authentication options,
29
+ see the :manual:`Connection String Formats
30
+ </reference/connection-string/#authentication-options >` section
31
+ of the Connection Strings guide in the Server manual.
31
32
32
- To learn more about the connection string options for authentication,
33
- see the :manual:`Authentication Options
34
- </reference/connection-string/#authentication-options>` section
35
- of the Connection String URI Format guide in the Server manual.
33
+ .. note:: Enterprise Authentication Mechanisms
36
34
37
- To authenticate using ``Kerberos`` or ``LDAP``, see the
38
- :ref:`Enterprise Authentication Mechanisms guide <kotlin-sync-enterprise-auth>`.
35
+ This page describes the authentication mechanisms available in MongoDB
36
+ Community Edition. To authenticate with mechanisms available in
37
+ the MongoDB Enterprise Edition, like ``Kerberos`` or ``LDAP``, see the
38
+ :ref:`Enterprise Authentication Mechanisms guide <kotlin-sync-enterprise-auth>`.
39
39
40
- For more information on establishing a connection to your MongoDB cluster,
41
- see :ref:`Connect to MongoDB <kotlin-sync-connect>`.
42
-
43
- .. _kotlin-sybc-auth-default:
40
+ .. _kotlin-sync-auth-default:
44
41
45
42
Default
46
43
-------
47
44
48
45
The default authentication mechanism setting uses one of the following
49
46
authentication mechanisms depending on what your MongoDB server supports:
50
47
51
- #. ``SCRAM-SHA-256``
52
- #. ``SCRAM-SHA-1``
48
+ #. ``SCRAM-SHA-256``: An authentication mechanism that
49
+ uses your database username and password, encrypted with the ``SHA-256``
50
+ algorithm
51
+ #. ``SCRAM-SHA-1``: An authentication mechanism that
52
+ uses your database username and password, encrypted with the ``SHA-1``
53
+ algorithm
53
54
54
55
Server versions 4.0 and later use ``SCRAM-SHA-256`` as the default
55
56
mechanism.
56
57
57
- The following code snippets show how to use the default authentication mechanism,
58
+ The following code snippets show how to use the default authentication mechanism by
58
59
using the following placeholders:
59
60
60
61
* ``db_username`` - your MongoDB database username
@@ -74,7 +75,7 @@ mechanism:
74
75
.. tab::
75
76
:tabid: Connection String
76
77
77
- To specify the default authentication mechanism using a connection
78
+ To specify the default authentication mechanism by using a connection
78
79
string, omit the mechanism. Your code to instantiate a ``MongoClient``
79
80
should resemble the following:
80
81
@@ -87,7 +88,7 @@ mechanism:
87
88
.. tab::
88
89
:tabid: MongoCredential
89
90
90
- To specify the default authentication mechanism using the
91
+ To specify the default authentication mechanism by using the
91
92
``MongoCredential`` class, use the ``createCredential()`` method.
92
93
Also, enable TLS by calling the
93
94
`applyToSslSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToSslSettings(com.mongodb.Block)>`__
@@ -101,9 +102,8 @@ mechanism:
101
102
:end-before: end-default-mongo-cred
102
103
:dedent:
103
104
104
- For more information on salted challenge-response authentication mechanisms (SCRAM)
105
- that MongoDB supports, see the :manual:`SCRAM </core/security-scram/>` section of
106
- the Server manual.
105
+ For more information about using SCRAM with MongoDB, see the
106
+ :manual:`SCRAM </core/security-scram/>` section of the Server manual.
107
107
108
108
.. _kotlin-sync-auth-scramsha256:
109
109
@@ -116,11 +116,11 @@ SCRAM-SHA-256
116
116
in MongoDB 4.0.
117
117
118
118
``SCRAM-SHA-256``, as defined by `RFC 7677 <https://www.rfc-editor.org/rfc/rfc7677>`__,
119
- is a salted challenge-response authentication mechanism
119
+ is a Salted Challenge Response Authentication Mechanism
120
120
(SCRAM) that uses your username and password, encrypted with the ``SHA-256``
121
121
algorithm, to authenticate your user.
122
122
123
- The following code snippets show how to specify the authentication mechanism,
123
+ The following code snippets show how to specify the authentication mechanism by
124
124
using the following placeholders:
125
125
126
126
* ``db_username`` - your MongoDB database username.
@@ -140,7 +140,7 @@ mechanism:
140
140
.. tab::
141
141
:tabid: Connection String
142
142
143
- To specify the ``SCRAM-SHA-256`` authentication mechanism using a
143
+ To specify the ``SCRAM-SHA-256`` authentication mechanism by using a
144
144
connection string, assign the ``authMechanism`` parameter the value
145
145
``SCRAM-SHA-256`` in your connection string. Your code to instantiate
146
146
a ``MongoClient`` should resemble the following:
@@ -154,7 +154,7 @@ mechanism:
154
154
.. tab::
155
155
:tabid: MongoCredential
156
156
157
- To specify the default authentication mechanism using the
157
+ To specify the default authentication mechanism by using the
158
158
``MongoCredential`` class, use the
159
159
`createScramSha256Credential() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#createScramSha256Credential(java.lang.String,java.lang.String,char[])>`__
160
160
method. Also, enable TLS by calling the
@@ -179,12 +179,12 @@ SCRAM-SHA-1
179
179
3.0, 3.2, 3.4, and 3.6.
180
180
181
181
``SCRAM-SHA-1``, as defined by `RFC 5802 <https://www.rfc-editor.org/rfc/rfc5802>`__,
182
- is a salted challenge-response mechanism (SCRAM) that uses your
182
+ is a Salted Challenge Response Authentication Mechanism (SCRAM) that uses your
183
183
username and password, encrypted with the ``SHA-1`` algorithm, to authenticate
184
184
your user.
185
185
186
- The following code snippets show how to specify the authentication mechanism,
187
- using the following placeholders:
186
+ The following code snippets show how to specify the authentication mechanism
187
+ by using the following placeholders:
188
188
189
189
* ``db_username`` - your MongoDB database username.
190
190
* ``db_password`` - your MongoDB database user's password.
@@ -203,7 +203,7 @@ mechanism:
203
203
.. tab::
204
204
:tabid: Connection String
205
205
206
- To specify the ``SCRAM-SHA-1`` authentication mechanism using a
206
+ To specify the ``SCRAM-SHA-1`` authentication mechanism by using a
207
207
connection string, assign the ``authMechanism`` parameter the value
208
208
``SCRAM-SHA-1`` in your connection string. Your code to instantiate
209
209
a ``MongoClient`` should resemble the following:
@@ -217,7 +217,7 @@ mechanism:
217
217
.. tab::
218
218
:tabid: MongoCredential
219
219
220
- To specify the default authentication mechanism using the
220
+ To specify the default authentication mechanism by using the
221
221
``MongoCredential`` class, use the
222
222
`createScramSha1Credential() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#createScramSha1Credential(java.lang.String,java.lang.String,char[])>`__
223
223
method. Also, enable TLS by calling the
@@ -241,11 +241,11 @@ The ``X.509`` authentication mechanism uses
241
241
:wikipedia:`TLS <Transport_Layer_Security>` with X.509 certificates to
242
242
authenticate your user, identified by the relative distinguished names
243
243
(RDNs) of your client certificate. When you specify the ``X.509``
244
- authentication mechanism, the server authenticates the connection using
244
+ authentication mechanism, the server authenticates the connection by using
245
245
the subject name of the client certificate.
246
246
247
- The following code snippets show how to specify the authentication mechanism,
248
- using the following placeholders:
247
+ The following code snippets show how to specify the authentication mechanism
248
+ by using the following placeholders:
249
249
250
250
* ``hostname`` - network address of your MongoDB server, accessible by your client.
251
251
* ``port`` - port number of your MongoDB server.
@@ -262,7 +262,7 @@ mechanism:
262
262
.. tab::
263
263
:tabid: Connection String
264
264
265
- To specify the ``X.509`` authentication mechanism using a connection
265
+ To specify the ``X.509`` authentication mechanism by using a connection
266
266
string, assign the ``authMechanism`` parameter the value ``MONGODB-X509``
267
267
and enable TLS by assigning the ``tls``
268
268
parameter a ``true`` value. Your code to instantiate a ``MongoClient``
@@ -277,7 +277,7 @@ mechanism:
277
277
.. tab::
278
278
:tabid: MongoCredential
279
279
280
- To specify the ``X.509`` authentication mechanism using the
280
+ To specify the ``X.509`` authentication mechanism by using the
281
281
``MongoCredential`` class, use the
282
282
`createMongoX509Credential() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#createMongoX509Credential(java.lang.String)>`__
283
283
method. Also, enable TLS by calling the
@@ -345,7 +345,7 @@ perform the following:
345
345
346
346
1. Specify the authentication mechanism
347
347
#. Add the SDK as a dependency to your project
348
- #. Supply your credentials using one of the methods in the credential
348
+ #. Supply your credentials by using one of the methods in the credential
349
349
provider chain
350
350
351
351
To specify the authentication mechanism by using a ``MongoCredential``,
@@ -379,10 +379,10 @@ AWS documentation for the version you need:
379
379
380
380
.. note::
381
381
382
- For the AWS SDK for Java v2, the Java driver currently tests using the
382
+ For the AWS SDK for Java v2, the Java driver currently tests by using the
383
383
``software.amazon.awssdk:auth:2.18.9`` dependency.
384
384
385
- For the AWS SDK for Java v1, the Java driver currently tests using the
385
+ For the AWS SDK for Java v1, the Java driver currently tests by using the
386
386
``com.amazonaws:aws-java-sdk-core:1.12.337`` dependency.
387
387
388
388
To supply your credentials, see the following AWS documentation for the
@@ -475,7 +475,7 @@ a similar shell as shown in the following example:
475
475
476
476
export AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=<your ECS endpoint>
477
477
478
- To authenticate using **EC2 container credentials**, make sure none of the
478
+ To authenticate by using **EC2 container credentials**, make sure none of the
479
479
aforementioned environment variables are set. The driver obtains the
480
480
credentials from the default IPv4 EC2 instance metadata endpoint.
481
481
0 commit comments