summaryrefslogtreecommitdiff
path: root/jstests/ssl/x509_client.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/ssl/x509_client.js')
-rw-r--r--jstests/ssl/x509_client.js46
1 files changed, 27 insertions, 19 deletions
diff --git a/jstests/ssl/x509_client.js b/jstests/ssl/x509_client.js
index 82c726fc0fd..8c3b7254198 100644
--- a/jstests/ssl/x509_client.js
+++ b/jstests/ssl/x509_client.js
@@ -29,16 +29,22 @@ function authAndTest(mongo) {
test = mongo.getDB("test");
// It should be impossible to create users with the same name as the server's subject
- assert.throws(function() {
- external.createUser(
- {user: SERVER_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
- }, {}, "Created user with same name as the server's x.509 subject");
+ assert.throws(
+ function() {
+ external.createUser(
+ {user: SERVER_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
+ },
+ {},
+ "Created user with same name as the server's x.509 subject");
// It should be impossible to create users with names recognized as cluster members
- assert.throws(function() {
- external.createUser(
- {user: INTERNAL_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
- }, {}, "Created user which would be recognized as a cluster member");
+ assert.throws(
+ function() {
+ external.createUser(
+ {user: INTERNAL_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
+ },
+ {},
+ "Created user which would be recognized as a cluster member");
// Add user using localhost exception
external.createUser({
@@ -56,9 +62,12 @@ function authAndTest(mongo) {
});
// Localhost exception should not be in place anymore
- assert.throws(function() {
- test.foo.findOne();
- }, {}, "read without login");
+ assert.throws(
+ function() {
+ test.foo.findOne();
+ },
+ {},
+ "read without login");
assert(!external.auth({user: INVALID_CLIENT_USER, mechanism: 'MONGODB-X509'}),
"authentication with invalid user failed");
@@ -71,17 +80,16 @@ function authAndTest(mongo) {
test.foo.findOne();
external.logout();
- assert.throws(function() {
- test.foo.findOne();
- }, {}, "read after logout");
+ assert.throws(
+ function() {
+ test.foo.findOne();
+ },
+ {},
+ "read after logout");
}
print("1. Testing x.509 auth to mongod");
-var x509_options = {
- sslMode: "requireSSL",
- sslPEMKeyFile: SERVER_CERT,
- sslCAFile: CA_CERT
-};
+var x509_options = {sslMode: "requireSSL", sslPEMKeyFile: SERVER_CERT, sslCAFile: CA_CERT};
var mongo = MongoRunner.runMongod(Object.merge(x509_options, {auth: ""}));