80
80
},
81
81
{
82
82
"description" : " should accept generic mechanism property (GSSAPI)" ,
83
- "uri" : " mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true " ,
83
+ "uri" : " mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:forward,SERVICE_HOST:example.com " ,
84
84
"valid" : true ,
85
85
"credential" : {
86
86
89
89
"mechanism" : " GSSAPI" ,
90
90
"mechanism_properties" : {
91
91
"SERVICE_NAME" : " other" ,
92
- "CANONICALIZE_HOST_NAME" : true
92
+ "SERVICE_HOST" : " example.com" ,
93
+ "CANONICALIZE_HOST_NAME" : " forward"
93
94
}
94
95
}
95
96
},
97
+ {
98
+ "description" : " should accept forwardAndReverse hostname canonicalization (GSSAPI)" ,
99
+ "uri" : " mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:forwardAndReverse" ,
100
+ "valid" : true ,
101
+ "credential" : {
102
+
103
+ "password" : null ,
104
+ "source" : " $external" ,
105
+ "mechanism" : " GSSAPI" ,
106
+ "mechanism_properties" : {
107
+ "SERVICE_NAME" : " other" ,
108
+ "CANONICALIZE_HOST_NAME" : " forwardAndReverse"
109
+ }
110
+ }
111
+ },
112
+ {
113
+ "description" : " should accept no hostname canonicalization (GSSAPI)" ,
114
+ "uri" : " mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:none" ,
115
+ "valid" : true ,
116
+ "credential" : {
117
+
118
+ "password" : null ,
119
+ "source" : " $external" ,
120
+ "mechanism" : " GSSAPI" ,
121
+ "mechanism_properties" : {
122
+ "SERVICE_NAME" : " other" ,
123
+ "CANONICALIZE_HOST_NAME" : " none"
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "description" : " must raise an error when the hostname canonicalization is invalid" ,
129
+ "uri" : " mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:invalid" ,
130
+ "valid" : false
131
+ },
96
132
{
97
133
"description" : " should accept the password (GSSAPI)" ,
98
134
"uri" : " mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&authSource=$external" ,
127
163
"uri" : " mongodb://localhost/?authMechanism=GSSAPI" ,
128
164
"valid" : false
129
165
},
130
- {
131
- "description" : " should recognize the mechanism (MONGODB-CR)" ,
132
- "uri" : " mongodb://user:password@localhost/?authMechanism=MONGODB-CR" ,
133
- "valid" : true ,
134
- "credential" : {
135
- "username" : " user" ,
136
- "password" : " password" ,
137
- "source" : " admin" ,
138
- "mechanism" : " MONGODB-CR" ,
139
- "mechanism_properties" : null
140
- }
141
- },
142
- {
143
- "description" : " should use the database when no authSource is specified (MONGODB-CR)" ,
144
- "uri" : " mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR" ,
145
- "valid" : true ,
146
- "credential" : {
147
- "username" : " user" ,
148
- "password" : " password" ,
149
- "source" : " foo" ,
150
- "mechanism" : " MONGODB-CR" ,
151
- "mechanism_properties" : null
152
- }
153
- },
154
- {
155
- "description" : " should use the authSource when specified (MONGODB-CR)" ,
156
- "uri" : " mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR&authSource=bar" ,
157
- "valid" : true ,
158
- "credential" : {
159
- "username" : " user" ,
160
- "password" : " password" ,
161
- "source" : " bar" ,
162
- "mechanism" : " MONGODB-CR" ,
163
- "mechanism_properties" : null
164
- }
165
- },
166
- {
167
- "description" : " should throw an exception if no username is supplied (MONGODB-CR)" ,
168
- "uri" : " mongodb://localhost/?authMechanism=MONGODB-CR" ,
169
- "valid" : false
170
- },
171
166
{
172
167
"description" : " should recognize the mechanism (MONGODB-X509)" ,
173
168
"uri" : " mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509" ,
474
469
}
475
470
},
476
471
{
477
- "description" : " should throw an exception if username and password is specified for test environment (MONGODB-OIDC)" ,
472
+ "description" : " should throw an exception if supplied a password (MONGODB-OIDC)" ,
478
473
"uri" : " mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:test" ,
479
474
"valid" : false ,
480
475
"credential" : null
481
476
},
482
477
{
483
- "description" : " should throw an exception if username is specified for test environment (MONGODB-OIDC)" ,
484
- "uri" : " mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&ENVIRONMENT:test" ,
478
+ "description" : " should throw an exception if username is specified for test (MONGODB-OIDC)" ,
479
+ "uri" : " mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties= ENVIRONMENT:test" ,
485
480
"valid" : false ,
486
481
"credential" : null
487
482
},
492
487
"credential" : null
493
488
},
494
489
{
495
- "description" : " should throw an exception if neither provider nor callbacks specified (MONGODB-OIDC)" ,
490
+ "description" : " should throw an exception if neither environment nor callbacks specified (MONGODB-OIDC)" ,
496
491
"uri" : " mongodb://localhost/?authMechanism=MONGODB-OIDC" ,
497
492
"valid" : false ,
498
493
"credential" : null
499
494
},
495
+ {
496
+ "description" : " should throw an exception when unsupported auth property is specified (MONGODB-OIDC)" ,
497
+ "uri" : " mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=UnsupportedProperty:unexisted" ,
498
+ "valid" : false ,
499
+ "credential" : null
500
+ },
500
501
{
501
502
"description" : " should recognise the mechanism with azure provider (MONGODB-OIDC)" ,
502
503
"uri" : " mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:foo" ,
625
626
"uri" : " mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp" ,
626
627
"valid" : false ,
627
628
"credential" : null
629
+ },
630
+ {
631
+ "description" : " should recognise the mechanism with k8s provider (MONGODB-OIDC)" ,
632
+ "uri" : " mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:k8s" ,
633
+ "valid" : true ,
634
+ "credential" : {
635
+ "username" : null ,
636
+ "password" : null ,
637
+ "source" : " $external" ,
638
+ "mechanism" : " MONGODB-OIDC" ,
639
+ "mechanism_properties" : {
640
+ "ENVIRONMENT" : " k8s"
641
+ }
642
+ }
643
+ },
644
+ {
645
+ "description" : " should throw an error for a username and password with k8s provider (MONGODB-OIDC)" ,
646
+ "uri" : " mongodb://user:pass@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:k8s" ,
647
+ "valid" : false ,
648
+ "credential" : null
628
649
}
629
650
]
630
- }
651
+ }
0 commit comments