-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
connection-string.json
372 lines (372 loc) · 12.1 KB
/
connection-string.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
{
"tests": [
{
"description": "should use the default source and mechanism",
"uri": "mongodb://user:password@localhost",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": null,
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified",
"uri": "mongodb://user:password@localhost/foo",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": null,
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified",
"uri": "mongodb://user:password@localhost/foo?authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": null,
"mechanism_properties": null
}
},
{
"description": "should recognise the mechanism (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should ignore the database (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/foo?authMechanism=GSSAPI",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should accept valid authSource (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authSource=$external",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should accept generic mechanism property (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true,SERVICE_HOST:example.com",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "other",
"CANONICALIZE_HOST_NAME": true,
"SERVICE_HOST": "example.com"
}
}
},
{
"description": "should accept the password (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&authSource=$external",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": "password",
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should throw an exception if authSource is invalid (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authSource=foo",
"valid": false
},
{
"description": "should throw an exception if no username (GSSAPI)",
"uri": "mongodb://localhost/?authMechanism=GSSAPI",
"valid": false
},
{
"description": "should recognize the mechanism (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-CR",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username is supplied (MONGODB-CR)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-CR",
"valid": false
},
{
"description": "should recognize the mechanism (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
"valid": true,
"credential": {
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should ignore the database (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509",
"valid": true,
"credential": {
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should accept valid authSource (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509&authSource=$external",
"valid": true,
"credential": {
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should recognize the mechanism with no username (MONGODB-X509)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-X509",
"valid": true,
"credential": {
"username": null,
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if supplied a password (MONGODB-X509)",
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-X509",
"valid": false
},
{
"description": "should throw an exception if authSource is invalid (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509&authSource=bar",
"valid": false
},
{
"description": "should recognize the mechanism (PLAIN)",
"uri": "mongodb://user:password@localhost/?authMechanism=PLAIN",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "$external",
"mechanism": "PLAIN",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (PLAIN)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=PLAIN",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "PLAIN",
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified (PLAIN)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=PLAIN&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "PLAIN",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username (PLAIN)",
"uri": "mongodb://localhost/?authMechanism=PLAIN",
"valid": false
},
{
"description": "should recognize the mechanism (SCRAM-SHA-1)",
"uri": "mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-1",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "SCRAM-SHA-1",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (SCRAM-SHA-1)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-1",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "SCRAM-SHA-1",
"mechanism_properties": null
}
},
{
"description": "should accept valid authSource (SCRAM-SHA-1)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-1&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "SCRAM-SHA-1",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username (SCRAM-SHA-1)",
"uri": "mongodb://localhost/?authMechanism=SCRAM-SHA-1",
"valid": false
},
{
"description": "should recognize the mechanism (SCRAM-SHA-256)",
"uri": "mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-256",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "SCRAM-SHA-256",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (SCRAM-SHA-256)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-256",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "SCRAM-SHA-256",
"mechanism_properties": null
}
},
{
"description": "should accept valid authSource (SCRAM-SHA-256)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-256&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "SCRAM-SHA-256",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username (SCRAM-SHA-256)",
"uri": "mongodb://localhost/?authMechanism=SCRAM-SHA-256",
"valid": false
},
{
"description": "URI with no auth-related info doesn't create credential",
"uri": "mongodb://localhost/",
"valid": true,
"credential": null
},
{
"description": "database in URI path doesn't create credentials",
"uri": "mongodb://localhost/foo",
"valid": true,
"credential": null
},
{
"description": "authSource without username doesn't create credential",
"uri": "mongodb://localhost/?authSource=foo",
"valid": true,
"credential": null
},
{
"description": "should throw an exception if no username provided (userinfo implies default mechanism)",
"uri": "mongodb://@localhost.com/",
"valid": false
},
{
"description": "should throw an exception if no username/password provided (userinfo implies default mechanism)",
"uri": "mongodb://:@localhost.com/",
"valid": false
}
]
}