|
1 | 1 | --TEST--
|
2 |
| -MongoDB\Driver\Manager::__construct(): authentication options are validated |
| 2 | +MongoDB\Driver\Manager::__construct(): GSSAPI authentication options are validated |
3 | 3 | --FILE--
|
4 | 4 | <?php
|
5 | 5 |
|
6 | 6 | require_once __DIR__ . '/../utils/basic.inc';
|
7 | 7 |
|
| 8 | +// GSSAPI requires a username |
8 | 9 | echo throws(function() {
|
9 |
| - create_test_manager('mongodb://localhost:27017/?authMechanism=GSSAPI&authSource=admin'); |
| 10 | + create_test_manager('mongodb://localhost:27017/?authMechanism=GSSAPI'); |
10 | 11 | }, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
|
11 |
| - |
12 |
| -echo throws(function() { |
13 |
| - create_test_manager('mongodb://localhost:27017/', ['authMechanism' => 'GSSAPI', 'authSource' => 'admin']); |
14 |
| -}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; |
15 |
| - |
16 |
| -echo throws(function() { |
17 |
| - create_test_manager('mongodb://localhost:27017/?authMechanism=MONGODB-X509&authSource=admin'); |
18 |
| -}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; |
19 |
| - |
20 | 12 | echo throws(function() {
|
21 |
| - create_test_manager('mongodb://localhost:27017/', ['authMechanism' => 'MONGODB-X509', 'authSource' => 'admin']); |
| 13 | + create_test_manager('mongodb://localhost:27017/', ['authMechanism' => 'GSSAPI']); |
22 | 14 | }, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
|
23 | 15 |
|
| 16 | +// GSSAPI requires $external auth source |
24 | 17 | echo throws(function() {
|
25 |
| - create_test_manager('mongodb://@localhost:27017/?authMechanism=SCRAM-SHA-1'); |
| 18 | + create_test_manager('mongodb://user@localhost:27017/?authMechanism=GSSAPI&authSource=admin'); |
26 | 19 | }, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
|
27 |
| - |
28 |
| -echo throws(function() { |
29 |
| - create_test_manager('mongodb://localhost:27017/', ['username' => '', 'authMechanism' => 'SCRAM-SHA-1']); |
30 |
| -}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n"; |
31 |
| - |
32 | 20 | echo throws(function() {
|
33 |
| - create_test_manager('mongodb://localhost:27017/', ['password' => 'password', 'authMechanism' => 'MONGODB-X509']); |
| 21 | + create_test_manager('mongodb://localhost:27017/', ['authMechanism' => 'GSSAPI', 'authSource' => 'admin', 'username' => 'user']); |
34 | 22 | }, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
|
35 | 23 |
|
36 | 24 | ?>
|
37 | 25 | ===DONE===
|
38 | 26 | <?php exit(0); ?>
|
39 | 27 | --EXPECT--
|
40 | 28 | OK: Got MongoDB\Driver\Exception\InvalidArgumentException
|
41 |
| -Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=GSSAPI&authSource=admin'. 'GSSAPI' authentication mechanism requires a username. |
| 29 | +Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=GSSAPI'. 'GSSAPI' authentication mechanism requires a username. |
42 | 30 | OK: Got MongoDB\Driver\Exception\InvalidArgumentException
|
43 | 31 | Failed to parse URI options: 'GSSAPI' authentication mechanism requires a username
|
44 | 32 | OK: Got MongoDB\Driver\Exception\InvalidArgumentException
|
45 |
| -Failed to parse MongoDB URI: 'mongodb://localhost:27017/?authMechanism=MONGODB-X509&authSource=admin'. 'MONGODB-X509' authentication mechanism requires "$external" authSource, but "admin" was specified. |
46 |
| -OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
47 |
| -Failed to parse URI options: 'MONGODB-X509' authentication mechanism requires "$external" authSource, but "admin" was specified |
48 |
| -OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
49 |
| -Failed to parse MongoDB URI: 'mongodb://@localhost:27017/?authMechanism=SCRAM-SHA-1'. 'SCRAM-SHA-1' authentication mechanism requires a username. |
50 |
| -OK: Got MongoDB\Driver\Exception\InvalidArgumentException |
51 |
| -Failed to parse URI options: 'SCRAM-SHA-1' authentication mechanism requires a username |
| 33 | +Failed to parse MongoDB URI: 'mongodb://user@localhost:27017/?authMechanism=GSSAPI&authSource=admin'. 'GSSAPI' authentication mechanism requires "$external" authSource, but "admin" was specified. |
52 | 34 | OK: Got MongoDB\Driver\Exception\InvalidArgumentException
|
53 |
| -Failed to parse URI options: 'MONGODB-X509' authentication mechanism does not accept a password |
| 35 | +Failed to parse URI options: 'GSSAPI' authentication mechanism requires "$external" authSource, but "admin" was specified |
54 | 36 | ===DONE===
|
0 commit comments