| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::ACME2::Authorization; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 18 | use strict; | 
|  | 3 |  |  |  |  | 5 |  | 
|  | 3 |  |  |  |  | 74 |  | 
| 4 | 3 |  |  | 3 |  | 13 | use warnings; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 74 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | =encoding utf-8 | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | =head1 NAME | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | Net::ACME2::Authorization | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | The ACME Authorization object. | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | =cut | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 3 |  |  | 3 |  | 12 | use parent qw( Net::ACME2::AccessorBase ); | 
|  | 3 |  |  |  |  | 5 |  | 
|  | 3 |  |  |  |  | 14 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 3 |  |  | 3 |  | 166 | use Call::Context (); | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 33 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 3 |  |  | 3 |  | 1080 | use Net::ACME2::Challenge (); | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 52 |  | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | #Pre-load challenge classes. | 
| 25 | 3 |  |  | 3 |  | 1107 | use Net::ACME2::Challenge::http_01 (); | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 52 |  | 
| 26 | 3 |  |  | 3 |  | 1363 | use Net::ACME2::Challenge::dns_01 (); | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 51 |  | 
| 27 | 3 |  |  | 3 |  | 1118 | use Net::ACME2::Challenge::tls_alpn_01 (); | 
|  | 3 |  |  |  |  | 9 |  | 
|  | 3 |  |  |  |  | 73 |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 3 |  |  |  |  | 813 | use constant _ACCESSORS => ( | 
| 30 |  |  |  |  |  |  | 'id', | 
| 31 |  |  |  |  |  |  | 'expires', | 
| 32 |  |  |  |  |  |  | 'status', | 
| 33 | 3 |  |  | 3 |  | 16 | ); | 
|  | 3 |  |  |  |  | 6 |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =head1 ACCESSORS | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | These provide text strings as defined in the ACME specification. | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =over | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =item * B | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =item * B | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =item * B | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =back | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 OTHER METHODS | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =head2 I->wildcard() | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | Returns a Perl boolean that indicates whether the authorization is | 
| 54 |  |  |  |  |  |  | for a wildcard DNS name. | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =cut | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub wildcard { | 
| 59 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 60 |  |  |  |  |  |  |  | 
| 61 | 0 |  |  |  |  |  | return !!$self->{'_wildcard'}; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =head2 I->identifier() | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | The order’s identifier, as a hash reference. | 
| 67 |  |  |  |  |  |  | The content matches the ACME specification. (NB: Wildcard | 
| 68 |  |  |  |  |  |  | authorizations do B contain the leading C<*.> in the | 
| 69 |  |  |  |  |  |  | C.) | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =cut | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | sub identifier { | 
| 74 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 75 |  |  |  |  |  |  |  | 
| 76 | 0 |  |  |  |  |  | return { %{ $self->{'_identifier'} } }; | 
|  | 0 |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head2 I->challenges() | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | The order’s challenges, as a list of L | 
| 82 |  |  |  |  |  |  | instances. (C challenges will be instances of | 
| 83 |  |  |  |  |  |  | L.) | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =cut | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | sub challenges { | 
| 88 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 89 |  |  |  |  |  |  |  | 
| 90 | 0 |  |  |  |  |  | Call::Context::must_be_list(); | 
| 91 |  |  |  |  |  |  |  | 
| 92 | 0 |  |  |  |  |  | my @challenges; | 
| 93 |  |  |  |  |  |  |  | 
| 94 | 0 |  |  |  |  |  | for my $c ( @{ $self->{'_challenges'} } ) { | 
|  | 0 |  |  |  |  |  |  | 
| 95 | 0 |  |  |  |  |  | my $class = 'Net::ACME2::Challenge'; | 
| 96 |  |  |  |  |  |  |  | 
| 97 | 0 |  |  |  |  |  | my $module_leaf = $c->{'type'}; | 
| 98 | 0 |  |  |  |  |  | $module_leaf =~ tr<-><_>; | 
| 99 | 0 |  |  |  |  |  | $class .= "::$module_leaf"; | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | #Ignore unrecognized challenges. | 
| 102 | 0 | 0 |  |  |  |  | next if !$class->can('new'); | 
| 103 |  |  |  |  |  |  |  | 
| 104 | 0 |  |  |  |  |  | push @challenges, $class->new( %$c ); | 
| 105 |  |  |  |  |  |  | } | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 0 |  |  |  |  |  | return @challenges; | 
| 108 |  |  |  |  |  |  | } | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | sub update { | 
| 111 | 0 |  |  | 0 | 0 |  | my ($self, $new_hr) = @_; | 
| 112 |  |  |  |  |  |  |  | 
| 113 | 0 |  |  |  |  |  | for my $name ( 'status', 'challenges' ) { | 
| 114 | 0 |  |  |  |  |  | $self->{"_$name"} = $new_hr->{$name}; | 
| 115 |  |  |  |  |  |  | } | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 0 |  |  |  |  |  | return $self; | 
| 118 |  |  |  |  |  |  | } | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | 1; |