| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::ACME::Authorization; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=encoding utf-8 |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::ACME::Authorization - fulfilled ACME authorization object |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Net::ACME::Authorization (); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $authz = Net::ACME::Authorization->new( |
|
16
|
|
|
|
|
|
|
status => 'valid', #or “invalid” |
|
17
|
|
|
|
|
|
|
challenges => [ @list_of_challenge_objects ], |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @challenge_objs = $authz->challenges(); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $payload; |
|
23
|
|
|
|
|
|
|
while (!$cert) { |
|
24
|
|
|
|
|
|
|
if ($need_retry->is_time_to_poll()) { |
|
25
|
|
|
|
|
|
|
$cert = $need_retry->poll(); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sleep 1; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#NOTE: For now, this assumes a domain name. |
|
34
|
|
|
|
|
|
|
#Might be useful moving forward to separate out other types |
|
35
|
|
|
|
|
|
|
#of authz as per ACME spec expansion. (As of April 2016 only |
|
36
|
|
|
|
|
|
|
#domain names are handled.) |
|
37
|
|
|
|
|
|
|
|
|
38
|
4
|
|
|
4
|
|
69993
|
use strict; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
83
|
|
|
39
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
|
4
|
|
|
|
|
3
|
|
|
|
4
|
|
|
|
|
67
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
4
|
|
|
4
|
|
372
|
use Call::Context (); |
|
|
4
|
|
|
|
|
192
|
|
|
|
4
|
|
|
|
|
39
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
4
|
|
|
4
|
|
306
|
use Net::ACME::Utils (); |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
36
|
|
|
44
|
4
|
|
|
4
|
|
10
|
use Net::ACME::X (); |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
742
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $CHALLENGE_CLASS = 'Net::ACME::Challenge'; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
|
49
|
4
|
|
|
4
|
0
|
1066
|
my ( $class, %opts ) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $self = { |
|
52
|
|
|
|
|
|
|
_status => $opts{'status'} || die('Need “status”!'), |
|
53
|
4
|
|
50
|
|
|
20
|
_challenges => $opts{'challenges'}, |
|
54
|
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
4
|
50
|
|
|
|
15
|
if ( $opts{'challenges'} ) { |
|
57
|
4
|
|
|
|
|
4
|
for my $c ( 0 .. $#{ $opts{'challenges'} } ) { |
|
|
4
|
|
|
|
|
15
|
|
|
58
|
4
|
|
|
|
|
7
|
my $challenge = $opts{'challenges'}[$c]; |
|
59
|
|
|
|
|
|
|
|
|
60
|
4
|
100
|
|
|
|
15
|
if ( !Net::ACME::Utils::thing_isa($challenge, $CHALLENGE_CLASS) ) { |
|
61
|
1
|
|
|
|
|
7
|
die Net::ACME::X::create( 'InvalidParameter', "“challenges” index $c ($challenge) is not an instance of “$CHALLENGE_CLASS”!" ); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
3
|
|
|
|
|
18
|
return bless $self, $class; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub status { |
|
70
|
3
|
|
|
3
|
0
|
4641
|
my ($self) = @_; |
|
71
|
3
|
|
|
|
|
16
|
return $self->{'_status'}; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub challenges { |
|
75
|
4
|
|
|
4
|
0
|
5995
|
my ($self) = @_; |
|
76
|
|
|
|
|
|
|
|
|
77
|
4
|
|
|
|
|
15
|
Call::Context::must_be_list(); |
|
78
|
|
|
|
|
|
|
|
|
79
|
3
|
|
|
|
|
53
|
return @{ $self->{'_challenges'} }; |
|
|
3
|
|
|
|
|
10
|
|
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |