summaryrefslogtreecommitdiff
path: root/jstests/auth
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 22:34:37 +0000
commit7142a7322ef19355a20e1f5f02e80f54dddbafaf (patch)
tree6ed0b07aeca558bd0fbf7064f3e39853b4b1294c /jstests/auth
parent8a6dca23acec76fe64ab0f490af5b3bdf45cdaee (diff)
downloadmongo-7142a7322ef19355a20e1f5f02e80f54dddbafaf.tar.gz
SERVER-46725 Add testcase for speculative sasl auth using user not in admin DB
(cherry picked from commit e6a7eb26ea65829eaea4b8544bdcd8db5e238a4b)
Diffstat (limited to 'jstests/auth')
-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);
})();