1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestRequest;
use Apache::TestUtil;
# Digest auth tests
plan tests => 12, (need_lwp &&
need_module('mod_auth_digest'));
my $url = '/digest/index.html';
my $response = GET $url;
ok t_cmp($response->code,
401,
"GET $url");
# bad pass
$response = GET $url, username => 'user1', password => 'foo';
ok t_cmp($response->code,
401,
GET $url, username => 'user1', password => 'foo');
# authenticated in the first provider
$response = GET $url, username => 'user1', password => 'digest1';
ok t_cmp($response->code,
200,
GET $url, username => 'user1', password => 'digest1');
# declined in the first provider
$response = GET $url, username => 'user2', password => 'digest2';
ok t_cmp($response->code,
401,
"GET $url, username => 'user2', password => 'digest2'");
# bad pass
$response = GET $url, username => 'user3', password => 'foo';
ok t_cmp($response->code,
401,
"GET $url, username => 'user3', password => 'foo'");
# authenticated in the second provider
$response = GET $url, username => 'user3', password => 'digest3';
ok t_cmp($response->code,
200,
"GET $url, username => 'user3', password => 'digest3'");
# declined in the second provider
$response = GET $url, username => 'user4', password => 'digest4';
ok t_cmp($response->code,
401,
"GET $url, username => 'user4', password => 'digest4'");
# bad pass
$response = GET $url, username => 'user5', password => 'foo';
skip(! need_module('mod_authn_file'),
ok t_cmp($response->code,
401,
"GET $url, username => 'user5', password => 'foo'")
);
# authenticated in the file provider
$response = GET $url, username => 'user5', password => 'digest5';
skip(! have_module('mod_authn_file'),
ok t_cmp($response->code,
200,
"GET $url, username => 'user5', password => 'digest5'")
);
# non-existent anywhere
$response = GET $url, username => 'user6', password => 'digest6';
ok t_cmp($response->code,
401,
"GET $url, username => 'user6', password => 'digest6'");
|