|
| 1 | +{ |
| 2 | + "tests": [ |
| 3 | + { |
| 4 | + "description": "should use the default source and mechanism", |
| 5 | + "uri": "mongodb://user:password@localhost", |
| 6 | + "hosts": [], |
| 7 | + "valid": true, |
| 8 | + "warning": false, |
| 9 | + "auth": { |
| 10 | + "db": "admin" |
| 11 | + }, |
| 12 | + "options": null |
| 13 | + }, |
| 14 | + { |
| 15 | + "description": "should use the database when no authSource is specified", |
| 16 | + "uri": "mongodb://user:password@localhost/foo", |
| 17 | + "hosts": [], |
| 18 | + "valid": true, |
| 19 | + "warning": false, |
| 20 | + "auth": { |
| 21 | + "db": "foo" |
| 22 | + }, |
| 23 | + "options": null |
| 24 | + }, |
| 25 | + { |
| 26 | + "description": "should use the authSource when specified", |
| 27 | + "uri": "mongodb://user:password@localhost/foo?authSource=bar", |
| 28 | + "hosts": [], |
| 29 | + "valid": true, |
| 30 | + "warning": false, |
| 31 | + "auth": { |
| 32 | + "db": "bar" |
| 33 | + }, |
| 34 | + "options": null |
| 35 | + }, |
| 36 | + { |
| 37 | + "description": "should recognize an empty password", |
| 38 | + "uri": "mongodb://user:@localhost", |
| 39 | + "hosts": [], |
| 40 | + "valid": true, |
| 41 | + "warning": false, |
| 42 | + "auth": { |
| 43 | + "username": "user", |
| 44 | + "password": "" |
| 45 | + }, |
| 46 | + "options": null |
| 47 | + }, |
| 48 | + { |
| 49 | + "description": "should recognize no password", |
| 50 | + "uri": "mongodb://user@localhost", |
| 51 | + "hosts": [], |
| 52 | + "valid": true, |
| 53 | + "warning": false, |
| 54 | + "auth": { |
| 55 | + "username": "user", |
| 56 | + "password": null |
| 57 | + }, |
| 58 | + "options": null |
| 59 | + }, |
| 60 | + { |
| 61 | + "description": "should recognize no password", |
| 62 | + "uri": "mongodb://user@localhost", |
| 63 | + "hosts": [], |
| 64 | + "valid": true, |
| 65 | + "warning": false, |
| 66 | + "auth": { |
| 67 | + "username": "user", |
| 68 | + "password": null |
| 69 | + }, |
| 70 | + "options": null |
| 71 | + }, |
| 72 | + { |
| 73 | + "description": "should recognize a url escaped character in the username", |
| 74 | + "uri": "mongodb://user%40DOMAIN.COM:password@localhost", |
| 75 | + "hosts": [], |
| 76 | + "valid": true, |
| 77 | + "warning": false, |
| 78 | + "auth": { |
| 79 | + "username": "user@DOMAIN.COM" |
| 80 | + }, |
| 81 | + "options": null |
| 82 | + }, |
| 83 | + { |
| 84 | + "description": "should recognize the mechanism", |
| 85 | + "uri": "mongodb://user@localhost/?authMechanism=GSSAPI", |
| 86 | + "hosts": [], |
| 87 | + "valid": true, |
| 88 | + "warning": false, |
| 89 | + "auth": null, |
| 90 | + "options": { |
| 91 | + "authmechanism": "GSSAPI" |
| 92 | + } |
| 93 | + }, |
| 94 | + { |
| 95 | + "description": "should use $external as the source", |
| 96 | + "uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI", |
| 97 | + "hosts": [], |
| 98 | + "valid": true, |
| 99 | + "warning": false, |
| 100 | + "auth": { |
| 101 | + "db": "$external" |
| 102 | + }, |
| 103 | + "options": null |
| 104 | + }, |
| 105 | + { |
| 106 | + "description": "should use $external as the source when a database is specified", |
| 107 | + "uri": "mongodb://user%40DOMAIN.COM:password@localhost/foo?authMechanism=GSSAPI", |
| 108 | + "hosts": [], |
| 109 | + "valid": true, |
| 110 | + "warning": false, |
| 111 | + "auth": { |
| 112 | + "db": "$external" |
| 113 | + }, |
| 114 | + "options": null |
| 115 | + }, |
| 116 | + { |
| 117 | + "description": "should throw an exception when an authSource is specified other than $external", |
| 118 | + "uri": "mongodb://user%40DOMAIN.COM:password@localhost/foo?authMechanism=GSSAPI&authSource=bar", |
| 119 | + "hosts": [], |
| 120 | + "valid": false, |
| 121 | + "warning": true, |
| 122 | + "auth": null, |
| 123 | + "options": null |
| 124 | + |
| 125 | + }, |
| 126 | + { |
| 127 | + "description": "should throw an exception when an authMechanism is specified with no username", |
| 128 | + "uri": "mongodb://localhost/?authMechanism=GSSAPI", |
| 129 | + "hosts": [], |
| 130 | + "valid": false, |
| 131 | + "warning": true, |
| 132 | + "auth": null, |
| 133 | + "options": null |
| 134 | + }, |
| 135 | + { |
| 136 | + "description": "should accept generic mechanism property", |
| 137 | + "uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true", |
| 138 | + "hosts": [], |
| 139 | + "valid": true, |
| 140 | + "warning": false, |
| 141 | + "auth": null, |
| 142 | + "options": { |
| 143 | + "authmechanism": "GSSAPI", |
| 144 | + "authmechanismproperties": { |
| 145 | + "SERVICE_NAME": "other", |
| 146 | + "CANONICALIZE_HOST_NAME": true |
| 147 | + } |
| 148 | + } |
| 149 | + }, |
| 150 | + { |
| 151 | + "description": "should accept legacy gssapiServiceName", |
| 152 | + "uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&gssapiServiceName=other", |
| 153 | + "hosts": [], |
| 154 | + "valid": true, |
| 155 | + "warning": false, |
| 156 | + "auth": null, |
| 157 | + "options": { |
| 158 | + "authmechanism": "GSSAPI", |
| 159 | + "authmechanismproperties": { |
| 160 | + "SERVICE_NAME": "other" |
| 161 | + } |
| 162 | + } |
| 163 | + }, |
| 164 | + { |
| 165 | + "description": "should recognize the mechanism", |
| 166 | + "uri": "mongodb://user:pass@localhost/?authMechanism=MONGODB-CR", |
| 167 | + "hosts": [], |
| 168 | + "valid": true, |
| 169 | + "warning": false, |
| 170 | + "auth": null, |
| 171 | + "options": { |
| 172 | + "authmechanism": "MONGODB-CR" |
| 173 | + } |
| 174 | + }, |
| 175 | + { |
| 176 | + "description": "should throw an exception when an authMechanism is specified with no username", |
| 177 | + "uri": "mongodb://localhost/?authMechanism=MONGODB-CR", |
| 178 | + "hosts": [], |
| 179 | + "valid": false, |
| 180 | + "warning": true, |
| 181 | + "auth": null, |
| 182 | + "options": null |
| 183 | + }, |
| 184 | + { |
| 185 | + "description": "should use $external as the source", |
| 186 | + "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509", |
| 187 | + "hosts": [], |
| 188 | + "valid": true, |
| 189 | + "warning": false, |
| 190 | + "auth": { |
| 191 | + "db": "$external" |
| 192 | + }, |
| 193 | + "options": null |
| 194 | + }, |
| 195 | + { |
| 196 | + "description": "should use $external as the source when a database is specified", |
| 197 | + "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509", |
| 198 | + "hosts": [], |
| 199 | + "valid": true, |
| 200 | + "warning": false, |
| 201 | + "auth": { |
| 202 | + "db": "$external" |
| 203 | + }, |
| 204 | + "options": null |
| 205 | + }, |
| 206 | + { |
| 207 | + "description": "should throw an exception when an authSource is specified other than $external", |
| 208 | + "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509&authSource=bar", |
| 209 | + "hosts": [], |
| 210 | + "valid": false, |
| 211 | + "warning": true, |
| 212 | + "auth": null, |
| 213 | + "options": null |
| 214 | + }, |
| 215 | + { |
| 216 | + "description": "should recognize the mechanism", |
| 217 | + "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509", |
| 218 | + "hosts": [], |
| 219 | + "valid": true, |
| 220 | + "warning": false, |
| 221 | + "auth": null, |
| 222 | + "options": { |
| 223 | + "authmechanism": "MONGODB-X509" |
| 224 | + } |
| 225 | + }, |
| 226 | + { |
| 227 | + "description": "should recognize the mechanism with no username", |
| 228 | + "uri": "mongodb://localhost/?authMechanism=MONGODB-X509", |
| 229 | + "hosts": [], |
| 230 | + "valid": true, |
| 231 | + "warning": false, |
| 232 | + "auth": { |
| 233 | + "username": null |
| 234 | + }, |
| 235 | + "options": { |
| 236 | + "authmechanism": "MONGODB-X509" |
| 237 | + } |
| 238 | + }, |
| 239 | + { |
| 240 | + "description": "should recognize the encoded username", |
| 241 | + "uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509", |
| 242 | + "hosts": [], |
| 243 | + "valid": true, |
| 244 | + "warning": false, |
| 245 | + "auth": { |
| 246 | + "username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry" |
| 247 | + }, |
| 248 | + "options": null |
| 249 | + }, |
| 250 | + { |
| 251 | + "description": "should recognize the mechanism", |
| 252 | + "uri": "mongodb://user:password@localhost/?authMechanism=PLAIN", |
| 253 | + "hosts": [], |
| 254 | + "valid": true, |
| 255 | + "warning": false, |
| 256 | + "auth": null, |
| 257 | + "options": { |
| 258 | + "authmechanism": "PLAIN" |
| 259 | + } |
| 260 | + }, |
| 261 | + { |
| 262 | + "description": "should throw an exception when an authMechanism is specified with no username", |
| 263 | + "uri": "mongodb://localhost/?authMechanism=PLAIN", |
| 264 | + "hosts": [], |
| 265 | + "valid": false, |
| 266 | + "warning": true, |
| 267 | + "auth": null, |
| 268 | + "options": null |
| 269 | + }, |
| 270 | + { |
| 271 | + "description": "should recognize the mechanism", |
| 272 | + "uri": "mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-1", |
| 273 | + "hosts": [], |
| 274 | + "valid": true, |
| 275 | + "warning": false, |
| 276 | + "auth": null, |
| 277 | + "options": { |
| 278 | + "authmechanism": "SCRAM-SHA-1" |
| 279 | + } |
| 280 | + }, |
| 281 | + { |
| 282 | + "description": "should throw an exception when an authMechanism is specified with no username", |
| 283 | + "uri": "mongodb://localhost/?authMechanism=SCRAM-SHA-1", |
| 284 | + "hosts": [], |
| 285 | + "valid": false, |
| 286 | + "warning": true, |
| 287 | + "auth": null, |
| 288 | + "options": null |
| 289 | + } |
| 290 | + ] |
| 291 | +} |
0 commit comments