summaryrefslogtreecommitdiff
path: root/jstests/auth/user_special_chars.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/user_special_chars.js')
-rw-r--r--jstests/auth/user_special_chars.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/jstests/auth/user_special_chars.js b/jstests/auth/user_special_chars.js
new file mode 100644
index 00000000000..f4dc218aeb7
--- /dev/null
+++ b/jstests/auth/user_special_chars.js
@@ -0,0 +1,14 @@
+// Test creating and authenticating a user with special characters.
+var conn = MongoRunner.runMongod({auth: ''});
+
+var testUserSpecialCharacters = function(){
+ // Create a user with special characters, make sure it can auth.
+ var adminDB = conn.getDB('admin');
+ adminDB.createUser({user: '~`!@#$%^&*()-_+={}[]||;:",.//><', pwd: 'pass',
+ roles: jsTest.adminUserRoles});
+ assert(adminDB.auth({user: '~`!@#$%^&*()-_+={}[]||;:",.//><',
+ pwd: 'pass'}));
+}
+
+testUserSpecialCharacters();
+MongoRunner.stopMongod(conn);