Skip to content

Commit 5abdc0e

Browse files
committed
Add tests for allowed cases when authSource is given but username is not
JAVA-3698
1 parent 2ef3f43 commit 5abdc0e

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

driver-core/src/test/resources/auth/connection-string.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,18 @@
216216
"mechanism_properties": null
217217
}
218218
},
219+
{
220+
"description": "should recognize the mechanism with no username when auth source is explicitly specified (MONGODB-X509)",
221+
"uri": "mongodb://localhost/?authMechanism=MONGODB-X509&authSource=$external",
222+
"valid": true,
223+
"credential": {
224+
"username": null,
225+
"password": null,
226+
"source": "$external",
227+
"mechanism": "MONGODB-X509",
228+
"mechanism_properties": null
229+
}
230+
},
219231
{
220232
"description": "should throw an exception if supplied a password (MONGODB-X509)",
221233
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-X509",
@@ -362,7 +374,7 @@
362374
"credential": null
363375
},
364376
{
365-
"description": "authSource without username doesn't create credential",
377+
"description": "authSource without username doesn't create credential (default mechanism)",
366378
"uri": "mongodb://localhost/?authSource=foo",
367379
"valid": true,
368380
"credential": null
@@ -389,6 +401,18 @@
389401
"mechanism_properties": null
390402
}
391403
},
404+
{
405+
"description": "should recognise the mechanism when auth source is explicitly specified (MONGODB-AWS)",
406+
"uri": "mongodb://localhost/?authMechanism=MONGODB-AWS&authSource=$external",
407+
"valid": true,
408+
"credential": {
409+
"username": null,
410+
"password": null,
411+
"source": "$external",
412+
"mechanism": "MONGODB-AWS",
413+
"mechanism_properties": null
414+
}
415+
},
392416
{
393417
"description": "should throw an exception if username and no password (MONGODB-AWS)",
394418
"uri": "mongodb://user@localhost/?authMechanism=MONGODB-AWS",

0 commit comments

Comments
 (0)