summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2020-03-09 18:14:13 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-09 21:42:48 +0000
commite6a7eb26ea65829eaea4b8544bdcd8db5e238a4b (patch)
tree4a3369510a6995b4f6798f861a9d06c34fb84393 /jstests
parent51c13694fbbcc5309abd39a4728a0920d6157db8 (diff)
downloadmongo-e6a7eb26ea65829eaea4b8544bdcd8db5e238a4b.tar.gz
SERVER-46725 Add testcase for speculative sasl auth using user not in admin DB
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/speculative-sasl-start.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/jstests/auth/speculative-sasl-start.js b/jstests/auth/speculative-sasl-start.js
index c69d6f11aed..8db5d03dcb7 100644
--- a/jstests/auth/speculative-sasl-start.js
+++ b/jstests/auth/speculative-sasl-start.js
@@ -92,5 +92,10 @@ test(baseOKURI + '?authMechanism=SCRAM-SHA-256', false);
assertStats((s) => expectN(s, 'SCRAM-SHA-1', 3, 2));
assertStats((s) => expectN(s, 'SCRAM-SHA-256', 6, 2));
+// Test that a user not in the admin DB can speculate
+mongod.getDB('test').createUser({user: 'alice', pwd: 'secret', roles: []});
+test('mongodb://alice:secret@localhost:' + mongod.port + '/test', true);
+assertStats((s) => expectN(s, 'SCRAM-SHA-256', 7, 3));
+
MongoRunner.stopMongod(mongod);
})();