Skip to content

Commit 3aab4a2

Browse files
author
iwysiu
committed
GODRIVER-1021 specify behavior when URI has auth database but no credentials
Change-Id: Ib3d07fea98402f680a2c1adddae5708005e7b7d7
1 parent 37f7720 commit 3aab4a2

File tree

9 files changed

+623
-222
lines changed

9 files changed

+623
-222
lines changed

data/auth/README.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
==========
2+
Auth Tests
3+
==========
4+
5+
The YAML and JSON files in this directory tree are platform-independent tests
6+
that drivers can use to prove their conformance to the Auth Spec at least with
7+
respect to connection string URI input.
8+
9+
Drivers should do additional unit testing if there are alternate ways of
10+
configuring credentials on a client.
11+
12+
Driver must also conduct the prose tests in the Auth Spec test plan section.
13+
14+
Format
15+
------
16+
17+
Each YAML file contains an object with a single ``tests`` key. This key is an
18+
array of test case objects, each of which have the following keys:
19+
20+
- ``description``: A string describing the test.
21+
- ``uri``: A string containing the URI to be parsed.
22+
- ``valid:`` A boolean indicating if the URI should be considered valid.
23+
- ``credential``: If null, the credential must not be considered configured for the
24+
the purpose of deciding if the driver should authenticate to the topology. If non-null,
25+
it is an object containing one or more of the following properties of a credential:
26+
27+
- ``username``: A string containing the username. For auth mechanisms
28+
that do not utilize a password, this may be the entire ``userinfo`` token
29+
from the connection string.
30+
- ``password``: A string containing the password.
31+
- ``source``: A string containing the authentication database.
32+
- ``mechanism``: A string containing the authentication mechanism. A null value for
33+
this key is used to indicate that a mechanism wasn't specified and that mechanism
34+
negotiation is required. Test harnesses should modify the mechanism test as needed
35+
to assert this condition.
36+
- ``mechanism_properties``: A document containing mechanism-specific properties. It
37+
specifies a subset of properties that must match. If a key exists in the test data,
38+
it must exist with the corresponding value in the credential. Other values may
39+
exist in the credential without failing the test.
40+
41+
If any key is missing, no assertion about that key is necessary. Except as
42+
specified explicitly above, if a key is present, but the test value is null,
43+
the observed value for that key must be uninitialized (whatever that means for
44+
a given driver and data type).
45+
46+
Implementation notes
47+
====================
48+
49+
Testing whether a URI is valid or not should simply be a matter of checking
50+
whether URI parsing (or MongoClient construction) raises an error or exception.
51+
52+
If a credential is configured, its properties must be compared to the
53+
``credential`` field.

0 commit comments

Comments
 (0)