summaryrefslogtreecommitdiff
path: root/src/mongo/shell/db.js
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2018-08-21 21:23:52 +0000
committerSara Golemon <sara.golemon@mongodb.com>2018-08-22 18:18:25 +0000
commit21f5d50fbc12b1690486813d8c48882d37723bdf (patch)
tree3d3e015ace41ad2fd3f97804da010461067a8187 /src/mongo/shell/db.js
parent7618295b2fd4cba46d76afbb97ed732e4228932f (diff)
downloadmongo-21f5d50fbc12b1690486813d8c48882d37723bdf.tar.gz
SERVER-36406 Respect _defaultAuthenticationMechanism when provided
Diffstat (limited to 'src/mongo/shell/db.js')
-rw-r--r--src/mongo/shell/db.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 692205ff78e..1f0133f4449 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -1587,6 +1587,12 @@ var DB;
if (!Array.isArray(mechs)) {
throw Error("Server replied with invalid saslSupportedMechs response");
}
+
+ if ((this._defaultAuthenticationMechanism != null) &&
+ mechs.includes(this._defaultAuthenticationMechanism)) {
+ return this._defaultAuthenticationMechanism;
+ }
+
// Never include PLAIN in auto-negotiation.
const priority = ["GSSAPI", "SCRAM-SHA-256", "SCRAM-SHA-1"];
for (var i = 0; i < priority.length; ++i) {