Skip to content

Commit 08fda1f

Browse files
committed
refactor: revert change to disallow authSource without username
1 parent bede1f0 commit 08fda1f

File tree

3 files changed

+0
-13
lines changed

3 files changed

+0
-13
lines changed

lib/core/uri_parser.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,6 @@ function applyAuthExpectations(parsed) {
335335
const options = parsed.options;
336336
const authSource = options.authsource || options.authSource;
337337
if (authSource != null) {
338-
if (parsed.auth == null || parsed.auth.username == null) {
339-
throw new MongoParseError('Auth source provided without username');
340-
}
341-
342338
parsed.auth = Object.assign({}, parsed.auth, { db: authSource });
343339
}
344340

test/spec/auth/connection-string.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@
351351
"valid": true,
352352
"credential": null
353353
},
354-
{
355-
"description": "authSource without username is invalid (default mechanism)",
356-
"uri": "mongodb://localhost/?authSource=foo",
357-
"valid": false
358-
},
359354
{
360355
"description": "should throw an exception if no username provided (userinfo implies default mechanism)",
361356
"uri": "mongodb://@localhost.com/",

test/spec/auth/connection-string.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@ tests:
287287
uri: "mongodb://localhost/foo"
288288
valid: true
289289
credential: ~
290-
-
291-
description: "authSource without username is invalid (default mechanism)"
292-
uri: "mongodb://localhost/?authSource=foo"
293-
valid: false
294290
-
295291
description: "should throw an exception if no username provided (userinfo implies default mechanism)"
296292
uri: "mongodb://@localhost.com/"

0 commit comments

Comments
 (0)