@@ -179,102 +179,100 @@ func TestHTTPAuthentication(t *testing.T) {
179
179
expectedAuths : []string {"" , "Bearer PleaseUseThis" },
180
180
expectedResponseCodes : []int {http .StatusOK },
181
181
},
182
- // Digest authentication is not supported for now so temperatily comment out the tests.
183
- /*
184
- {
185
- name: "digest auth",
186
- // Example from https://en.wikipedia.org/wiki/Digest_access_authentication#Example_with_explanation
187
- httpAuth: &datasource.HTTPAuthentication{
188
- SupportedMethods: []datasource.HTTPAuthMethod{datasource.AuthDigest},
189
- AlwaysAuth: false,
190
- Username: "Mufasa",
191
- Password: "Circle Of Life",
192
- CnonceFunc: func() string { return "0a4f113b" },
193
- },
194
- requestURL: "https://127.0.0.1/dir/index.html",
195
- wwwAuth: []string{
196
- "Digest realm=\"[email protected] \", " +
197
- "qop=\"auth,auth-int\", " +
198
- "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " +
199
- "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"",
200
- },
201
- expectedAuths: []string{
202
- "",
203
- // The order of these fields shouldn't actually matter
204
- "Digest username=\"Mufasa\", " +
205
-
206
- "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " +
207
- "uri=\"/dir/index.html\", " +
208
- "qop=auth, " +
209
- "nc=00000001, " +
210
- "cnonce=\"0a4f113b\", " +
211
- "response=\"6629fae49393a05397450978507c4ef1\", " +
212
- "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"",
213
- },
214
- expectedResponseCodes: []int{http.StatusOK},
182
+ {
183
+ name : "digest auth" ,
184
+ // Example from https://en.wikipedia.org/wiki/Digest_access_authentication#Example_with_explanation
185
+ httpAuth : & datasource.HTTPAuthentication {
186
+ SupportedMethods : []datasource.HTTPAuthMethod {datasource .AuthDigest },
187
+ AlwaysAuth : false ,
188
+ Username : "Mufasa" ,
189
+ Password : "Circle Of Life" ,
190
+ CnonceFunc : func () string { return "0a4f113b" },
191
+ },
192
+ requestURL : "https://127.0.0.1/dir/index.html" ,
193
+ wwwAuth : []string {
194
+ "Digest realm=\" [email protected] \" , " +
195
+ "qop=\" auth,auth-int\" , " +
196
+ "nonce=\" dcd98b7102dd2f0e8b11d0f600bfb0c093\" , " +
197
+ "opaque=\" 5ccc069c403ebaf9f0171e9517f40e41\" " ,
198
+ },
199
+ expectedAuths : []string {
200
+ "" ,
201
+ // The order of these fields shouldn't actually matter
202
+ "Digest username=\" Mufasa\" , " +
203
+
204
+ "nonce=\" dcd98b7102dd2f0e8b11d0f600bfb0c093\" , " +
205
+ "uri=\" /dir/index.html\" , " +
206
+ "qop=auth, " +
207
+ "nc=00000001, " +
208
+ "cnonce=\" 0a4f113b\" , " +
209
+ "response=\" 6629fae49393a05397450978507c4ef1\" , " +
210
+ "opaque=\" 5ccc069c403ebaf9f0171e9517f40e41\" " ,
211
+ },
212
+ expectedResponseCodes : []int {http .StatusOK },
213
+ },
214
+ {
215
+ name : "digest auth rfc2069" , // old spec, without qop header
216
+ httpAuth : & datasource.HTTPAuthentication {
217
+ SupportedMethods : []datasource.HTTPAuthMethod {datasource .AuthDigest },
218
+ AlwaysAuth : false ,
219
+ Username : "Mufasa" ,
220
+ Password : "Circle Of Life" ,
215
221
},
216
- {
217
- name: "digest auth rfc2069", // old spec, without qop header
218
- httpAuth: &datasource.HTTPAuthentication{
219
- SupportedMethods: []datasource.HTTPAuthMethod{datasource.AuthDigest},
220
- AlwaysAuth: false,
221
- Username: "Mufasa",
222
- Password: "Circle Of Life",
223
- },
224
- requestURL: "https://127.0.0.1/dir/index.html",
225
- wwwAuth: []string{
226
- "Digest realm=\"[email protected] \", " +
227
- "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " +
228
- "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"",
229
- },
230
- expectedAuths: []string{
231
- "",
232
- // The order of these fields shouldn't actually matter
233
- "Digest username=\"Mufasa\", " +
234
-
235
- "nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", " +
236
- "uri=\"/dir/index.html\", " +
237
- "response=\"670fd8c2df070c60b045671b8b24ff02\", " +
238
- "opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"",
239
- },
240
- expectedResponseCodes: []int{http.StatusOK},
222
+ requestURL : "https://127.0.0.1/dir/index.html" ,
223
+ wwwAuth : []string {
224
+ "Digest realm=\" [email protected] \" , " +
225
+ "nonce=\" dcd98b7102dd2f0e8b11d0f600bfb0c093\" , " +
226
+ "opaque=\" 5ccc069c403ebaf9f0171e9517f40e41\" " ,
241
227
},
242
- {
243
- name: "digest auth mvn",
244
- // From what mvn sends.
245
- httpAuth: &datasource.HTTPAuthentication{
246
- SupportedMethods: []datasource.HTTPAuthMethod{datasource.AuthDigest},
247
- AlwaysAuth: false,
248
- Username: "my-username",
249
- Password: "cool-password",
250
- CnonceFunc: func() string { return "f7ef2d457dabcd54" },
251
- },
252
- requestURL: "https://127.0.0.1:41565/commons-io/commons-io/1.0/commons-io-1.0.pom",
253
- wwwAuth: []string{
254
- "Digest realm=\"[email protected] \"," +
255
- "qop=\"auth\"," +
256
- "nonce=\"deadbeef\"," +
257
- "opaque=\"aaaa\"," +
258
- "algorithm=\"MD5-sess\"," +
259
- "domain=\"/test\"",
260
- },
261
- expectedAuths: []string{
262
- "",
263
- // The order of these fields shouldn't actually matter
264
- "Digest username=\"my-username\", " +
265
-
266
- "nonce=\"deadbeef\", " +
267
- "uri=\"/commons-io/commons-io/1.0/commons-io-1.0.pom\", " +
268
- "qop=auth, " +
269
- "nc=00000001, " +
270
- "cnonce=\"f7ef2d457dabcd54\", " +
271
- "algorithm=MD5-sess, " +
272
- "response=\"15a35e7018a0fc7db05d31185e0d2c9e\", " +
273
- "opaque=\"aaaa\"",
274
- },
275
- expectedResponseCodes: []int{http.StatusOK},
228
+ expectedAuths : []string {
229
+ "" ,
230
+ // The order of these fields shouldn't actually matter
231
+ "Digest username=\" Mufasa\" , " +
232
+
233
+ "nonce=\" dcd98b7102dd2f0e8b11d0f600bfb0c093\" , " +
234
+ "uri=\" /dir/index.html\" , " +
235
+ "response=\" 670fd8c2df070c60b045671b8b24ff02\" , " +
236
+ "opaque=\" 5ccc069c403ebaf9f0171e9517f40e41\" " ,
276
237
},
277
- */
238
+ expectedResponseCodes : []int {http .StatusOK },
239
+ },
240
+ {
241
+ name : "digest auth mvn" ,
242
+ // From what mvn sends.
243
+ httpAuth : & datasource.HTTPAuthentication {
244
+ SupportedMethods : []datasource.HTTPAuthMethod {datasource .AuthDigest },
245
+ AlwaysAuth : false ,
246
+ Username : "my-username" ,
247
+ Password : "cool-password" ,
248
+ CnonceFunc : func () string { return "f7ef2d457dabcd54" },
249
+ },
250
+ requestURL : "https://127.0.0.1:41565/commons-io/commons-io/1.0/commons-io-1.0.pom" ,
251
+ wwwAuth : []string {
252
+ "Digest realm=\" [email protected] \" ," +
253
+ "qop=\" auth\" ," +
254
+ "nonce=\" deadbeef\" ," +
255
+ "opaque=\" aaaa\" ," +
256
+ "algorithm=\" MD5-sess\" ," +
257
+ "domain=\" /test\" " ,
258
+ },
259
+ expectedAuths : []string {
260
+ "" ,
261
+ // The order of these fields shouldn't actually matter
262
+ "Digest username=\" my-username\" , " +
263
+
264
+ "nonce=\" deadbeef\" , " +
265
+ "uri=\" /commons-io/commons-io/1.0/commons-io-1.0.pom\" , " +
266
+ "qop=auth, " +
267
+ "nc=00000001, " +
268
+ "cnonce=\" f7ef2d457dabcd54\" , " +
269
+ "algorithm=MD5-sess, " +
270
+ "response=\" 15a35e7018a0fc7db05d31185e0d2c9e\" , " +
271
+ "opaque=\" aaaa\" " ,
272
+ },
273
+ expectedResponseCodes : []int {http .StatusOK },
274
+ },
275
+
278
276
{
279
277
name : "basic auth reuse on subsequent" ,
280
278
httpAuth : & datasource.HTTPAuthentication {
0 commit comments