@@ -40,13 +40,8 @@ mechanisms.
40
40
Default Authentication Mechanism
41
41
--------------------------------
42
42
43
- In MongoDB 3.0, MongoDB changed the default authentication mechanism
44
- from ``MONGODB-CR`` to ``SCRAM-SHA-1``. In MongoDB 4.0, support for
45
- the deprecated ``MONGODB-CR`` mechanism was removed and ``SCRAM-
46
- SHA-256`` support was added.
47
-
48
43
To create a credential that authenticates by using the default
49
- authentication mechanism, regardless of server version , create a
44
+ authentication mechanism, ``SCRAM-SHA-256`` , create a
50
45
credential by using the ``createCredential()`` static factory method:
51
46
52
47
.. code-block:: java
@@ -71,33 +66,24 @@ authentication mechanism:
71
66
72
67
MongoClient mongoClient = MongoClients.create("mongodb://user1:pwd1@host1/?authSource=db1");
73
68
74
- For challenge and response mechanisms, using the default
75
- authentication mechanism is the recommended approach, as it makes
76
- upgrading from MongoDB 2.6 to MongoDB 3.0 more simple, even after
77
- upgrading the authentication schema. For MongoDB 4.0 users, using the
78
- default authentication mechanism is also recommended as the mechanisms are
79
- checked and the correct hashing algorithm is used.
69
+ For challenge and response mechanisms, we recommend using the default
70
+ authentication mechanism. This simplifies upgrades and ensures that the correct hashing
71
+ algorithm is used.
80
72
81
73
SCRAM-Based Mechanisms
82
74
----------------------
83
75
84
- Salted Challenge-Response Authentication Mechanism (``SCRAM``) has been
85
- the default authentication mechanism for MongoDB since 3.0. ``SCRAM`` is
76
+ Salted Challenge-Response Authentication Mechanism (``SCRAM``) is
86
77
based on the `IETF RFC 5802
87
78
<https://datatracker.ietf.org/doc/html/rfc5802>`__ standard that defines
88
79
best practices for implementation of challenge-response mechanisms for authenticating
89
- users with passwords.
90
-
91
- MongoDB 3.0 introduced support for ``SCRAM-SHA-1``, which uses the
92
- ``SHA-1`` hashing function. MongoDB 4.0 introduced support for ``SCRAM-
93
- SHA-256`` which uses the ``SHA-256`` hashing function.
80
+ users with passwords. MongoDB supports both ``SCRAM-SHA-1``, which uses the
81
+ ``SHA-1`` hashing function, and ``SCRAM-
82
+ SHA-256``, which uses the ``SHA-256`` hashing function.
94
83
95
84
SCRAM-SHA-256
96
85
~~~~~~~~~~~~~
97
86
98
- Using this mechanism requires MongoDB 4.0 and
99
- ``featureCompatibilityVersion`` to be set to 4.0.
100
-
101
87
To explicitly create a credential of type ``SCRAM-SHA-256``, use
102
88
the ``createScramSha256Credential()`` method:
103
89
@@ -147,7 +133,6 @@ To explicitly create a credential of type ``SCRAM-SHA-1``, use the
147
133
Or, you can use a connection string that explicitly specifies
148
134
``authMechanism=SCRAM-SHA-1``:
149
135
150
-
151
136
.. code-block:: java
152
137
153
138
MongoClient mongoClient = MongoClients.create("mongodb://user1:pwd1@host1/?authSource=db1&authMechanism=SCRAM-SHA-1");
@@ -157,12 +142,10 @@ MONGODB-CR
157
142
158
143
.. important::
159
144
160
- Starting in version 4.0, MongoDB removes support for the deprecated
145
+ MongoDB no longer supports the deprecated
161
146
MongoDB Challenge-Response (``MONGODB-CR``) authentication mechanism.
162
-
163
147
If your deployment has user credentials stored in a ``MONGODB-CR`` schema,
164
- you must upgrade to use a ``SCRAM``-based mechanism before you
165
- upgrade to version 4.0.
148
+ you must upgrade to a ``SCRAM``-based mechanism.
166
149
167
150
To explicitly create a credential of type ``MONGODB-CR`` use the
168
151
``createMongCRCredential()`` static factory method:
0 commit comments