summaryrefslogtreecommitdiff
path: root/jstests/ssl
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2021-10-18 18:21:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-19 21:16:38 +0000
commit93fc544da4f7752a5ce2ab2166e94c50ea70221f (patch)
treeb9cab89efe8d039b0ea99afb0f42a630f636af1a /jstests/ssl
parent5510efff15cc6c9895530c2e42abd6371a73f605 (diff)
downloadmongo-93fc544da4f7752a5ce2ab2166e94c50ea70221f.tar.gz
SERVER-59970 Fix reply value from authenticate command
Diffstat (limited to 'jstests/ssl')
-rw-r--r--jstests/ssl/x509_client.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/jstests/ssl/x509_client.js b/jstests/ssl/x509_client.js
index 26f4ecc4c71..f764575227b 100644
--- a/jstests/ssl/x509_client.js
+++ b/jstests/ssl/x509_client.js
@@ -32,10 +32,18 @@ function authAndTest(mongo) {
"authentication with valid user failed");
assert(external.auth({mechanism: 'MONGODB-X509'}),
"authentication with valid client cert and no user field failed");
- assert(external.runCommand({authenticate: 1, mechanism: 'MONGODB-X509', user: CLIENT_USER}).ok,
- "runCommand authentication with valid client cert and user field failed");
- assert(external.runCommand({authenticate: 1, mechanism: 'MONGODB-X509'}).ok,
- "runCommand authentication with valid client cert and no user field failed");
+
+ const withUserReply = assert.commandWorked(
+ external.runCommand({authenticate: 1, mechanism: 'MONGODB-X509', user: CLIENT_USER}),
+ "runCommand authentication with valid client cert and user field failed");
+ assert.eq(withUserReply.user, CLIENT_USER);
+ assert.eq(withUserReply.dbname, '$external');
+
+ const noUserReply = assert.commandWorked(
+ external.runCommand({authenticate: 1, mechanism: 'MONGODB-X509'}),
+ "runCommand authentication with valid client cert and no user field failed");
+ assert.eq(noUserReply.user, CLIENT_USER);
+ assert.eq(noUserReply.dbname, '$external');
// Check that there's a "Successfully authenticated" message that includes the client IP
const log =