1{
2 "tests": [
3 {
4 "description": "User info for single IPv4 host without database",
5 "uri": "mongodb://alice:foo@127.0.0.1",
6 "valid": true,
7 "warning": false,
8 "hosts": [
9 {
10 "type": "ipv4",
11 "host": "127.0.0.1",
12 "port": null
13 }
14 ],
15 "auth": {
16 "username": "alice",
17 "password": "foo",
18 "db": null
19 },
20 "options": null
21 },
22 {
23 "description": "User info for single IPv4 host with database",
24 "uri": "mongodb://alice:foo@127.0.0.1/test",
25 "valid": true,
26 "warning": false,
27 "hosts": [
28 {
29 "type": "ipv4",
30 "host": "127.0.0.1",
31 "port": null
32 }
33 ],
34 "auth": {
35 "username": "alice",
36 "password": "foo",
37 "db": "test"
38 },
39 "options": null
40 },
41 {
42 "description": "User info for single IP literal host without database",
43 "uri": "mongodb://bob:bar@[::1]:27018",
44 "valid": true,
45 "warning": false,
46 "hosts": [
47 {
48 "type": "ip_literal",
49 "host": "::1",
50 "port": 27018
51 }
52 ],
53 "auth": {
54 "username": "bob",
55 "password": "bar",
56 "db": null
57 },
58 "options": null
59 },
60 {
61 "description": "User info for single IP literal host with database",
62 "uri": "mongodb://bob:bar@[::1]:27018/admin",
63 "valid": true,
64 "warning": false,
65 "hosts": [
66 {
67 "type": "ip_literal",
68 "host": "::1",
69 "port": 27018
70 }
71 ],
72 "auth": {
73 "username": "bob",
74 "password": "bar",
75 "db": "admin"
76 },
77 "options": null
78 },
79 {
80 "description": "User info for single hostname without database",
81 "uri": "mongodb://eve:baz@example.com",
82 "valid": true,
83 "warning": false,
84 "hosts": [
85 {
86 "type": "hostname",
87 "host": "example.com",
88 "port": null
89 }
90 ],
91 "auth": {
92 "username": "eve",
93 "password": "baz",
94 "db": null
95 },
96 "options": null
97 },
98 {
99 "description": "User info for single hostname with database",
100 "uri": "mongodb://eve:baz@example.com/db2",
101 "valid": true,
102 "warning": false,
103 "hosts": [
104 {
105 "type": "hostname",
106 "host": "example.com",
107 "port": null
108 }
109 ],
110 "auth": {
111 "username": "eve",
112 "password": "baz",
113 "db": "db2"
114 },
115 "options": null
116 },
117 {
118 "description": "User info for multiple hosts without database",
119 "uri": "mongodb://alice:secret@127.0.0.1,example.com:27018",
120 "valid": true,
121 "warning": false,
122 "hosts": [
123 {
124 "type": "ipv4",
125 "host": "127.0.0.1",
126 "port": null
127 },
128 {
129 "type": "hostname",
130 "host": "example.com",
131 "port": 27018
132 }
133 ],
134 "auth": {
135 "username": "alice",
136 "password": "secret",
137 "db": null
138 },
139 "options": null
140 },
141 {
142 "description": "User info for multiple hosts with database",
143 "uri": "mongodb://alice:secret@example.com,[::1]:27019/admin",
144 "valid": true,
145 "warning": false,
146 "hosts": [
147 {
148 "type": "hostname",
149 "host": "example.com",
150 "port": null
151 },
152 {
153 "type": "ip_literal",
154 "host": "::1",
155 "port": 27019
156 }
157 ],
158 "auth": {
159 "username": "alice",
160 "password": "secret",
161 "db": "admin"
162 },
163 "options": null
164 },
165 {
166 "description": "Username without password",
167 "uri": "mongodb://alice@127.0.0.1",
168 "valid": true,
169 "warning": false,
170 "hosts": [
171 {
172 "type": "ipv4",
173 "host": "127.0.0.1",
174 "port": null
175 }
176 ],
177 "auth": {
178 "username": "alice",
179 "password": null,
180 "db": null
181 },
182 "options": null
183 },
184 {
185 "description": "Username with empty password",
186 "uri": "mongodb://alice:@127.0.0.1",
187 "valid": true,
188 "warning": false,
189 "hosts": [
190 {
191 "type": "ipv4",
192 "host": "127.0.0.1",
193 "port": null
194 }
195 ],
196 "auth": {
197 "username": "alice",
198 "password": "",
199 "db": null
200 },
201 "options": null
202 },
203 {
204 "description": "Escaped username and database without password",
205 "uri": "mongodb://%40l%3Ace%2F%3D@example.com/my%3Ddb",
206 "valid": true,
207 "warning": false,
208 "hosts": [
209 {
210 "type": "hostname",
211 "host": "example.com",
212 "port": null
213 }
214 ],
215 "auth": {
216 "username": "@l:ce/=",
217 "password": null,
218 "db": "my=db"
219 },
220 "options": null
221 },
222 {
223 "description": "Escaped user info and database (MONGODB-CR)",
224 "uri": "mongodb://%24am:f%3Azzb%40z%2Fz%3D@127.0.0.1/admin%3F?authMechanism=MONGODB-CR",
225 "valid": true,
226 "warning": false,
227 "hosts": [
228 {
229 "type": "ipv4",
230 "host": "127.0.0.1",
231 "port": null
232 }
233 ],
234 "auth": {
235 "username": "$am",
236 "password": "f:zzb@z/z=",
237 "db": "admin?"
238 },
239 "options": {
240 "authmechanism": "MONGODB-CR"
241 }
242 },
243 {
244 "description": "Subdelimiters in user/pass don't need escaping (MONGODB-CR)",
245 "uri": "mongodb://!$&'()*+,;=:!$&'()*+,;=@127.0.0.1/admin?authMechanism=MONGODB-CR",
246 "valid": true,
247 "warning": false,
248 "hosts": [
249 {
250 "type": "ipv4",
251 "host": "127.0.0.1",
252 "port": null
253 }
254 ],
255 "auth": {
256 "username": "!$&'()*+,;=",
257 "password": "!$&'()*+,;=",
258 "db": "admin"
259 },
260 "options": {
261 "authmechanism": "MONGODB-CR"
262 }
263 },
264 {
265 "description": "Escaped username (MONGODB-X509)",
266 "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
267 "valid": true,
268 "warning": false,
269 "hosts": [
270 {
271 "type": "hostname",
272 "host": "localhost",
273 "port": null
274 }
275 ],
276 "auth": {
277 "username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
278 "password": null,
279 "db": null
280 },
281 "options": {
282 "authmechanism": "MONGODB-X509"
283 }
284 },
285 {
286 "description": "Escaped username (GSSAPI)",
287 "uri": "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authMechanism=GSSAPI",
288 "valid": true,
289 "warning": false,
290 "hosts": [
291 {
292 "type": "hostname",
293 "host": "localhost",
294 "port": null
295 }
296 ],
297 "auth": {
298 "username": "user@EXAMPLE.COM",
299 "password": "secret",
300 "db": null
301 },
302 "options": {
303 "authmechanism": "GSSAPI",
304 "authmechanismproperties": {
305 "SERVICE_NAME": "other",
306 "CANONICALIZE_HOST_NAME": true
307 }
308 }
309 },
310 {
311 "description": "At-signs in options aren't part of the userinfo",
312 "uri": "mongodb://alice:secret@example.com/admin?replicaset=my@replicaset",
313 "valid": true,
314 "warning": false,
315 "hosts": [
316 {
317 "type": "hostname",
318 "host": "example.com",
319 "port": null
320 }
321 ],
322 "auth": {
323 "username": "alice",
324 "password": "secret",
325 "db": "admin"
326 },
327 "options": {
328 "replicaset": "my@replicaset"
329 }
330 }
331 ]
332}
View as plain text