| 1 | package Net::ACME2::Authorization; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | ▶ | use parent qw( Net::ACME2::AccessorBase ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 3 | ▶ | use Call::Context (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 3 | ▶ | use Net::ACME2::Challenge (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | #Pre-load challenge classes. | ||||||||||
| 25 | 3 | ▶ | use Net::ACME2::Challenge::http_01 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 3 | ▶ | use Net::ACME2::Challenge::dns_01 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 3 | ▶ | use Net::ACME2::Challenge::tls_alpn_01 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | 3 | use constant _ACCESSORS => ( | |||||||||
| 30 | 'id', | ||||||||||
| 31 | 'expires', | ||||||||||
| 32 | 'status', | ||||||||||
| 33 | 3 | ▶ | ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | =head1 ACCESSORS | ||||||||||
| 36 | |||||||||||
| 37 | These provide text strings as defined in the ACME specification. | ||||||||||
| 38 | |||||||||||
| 39 | =over | ||||||||||
| 40 | |||||||||||
| 41 | =item * B<id()> | ||||||||||
| 42 | |||||||||||
| 43 | =item * B<status()> | ||||||||||
| 44 | |||||||||||
| 45 | =item * B<expires()> | ||||||||||
| 46 | |||||||||||
| 47 | =back | ||||||||||
| 48 | |||||||||||
| 49 | =head1 OTHER METHODS | ||||||||||
| 50 | |||||||||||
| 51 | =head2 I<OBJ>->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 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
wildcard: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 60 | |||||||||||
| 61 | 0 | return !!$self->{'_wildcard'}; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | =head2 I<OBJ>->identifier() | ||||||||||
| 65 | |||||||||||
| 66 | The orderâs identifier, as a hash reference. | ||||||||||
| 67 | The content matches the ACME specification. (NB: Wildcard | ||||||||||
| 68 | authorizations do B<NOT> contain the leading C<*.> in the | ||||||||||
| 69 | C<value>.) | ||||||||||
| 70 | |||||||||||
| 71 | =cut | ||||||||||
| 72 | |||||||||||
| 73 | sub identifier { | ||||||||||
| 74 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
identifier: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 75 | |||||||||||
| 76 | 0 | return { %{ $self->{'_identifier'} } }; | |||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | =head2 I<OBJ>->challenges() | ||||||||||
| 80 | |||||||||||
| 81 | The orderâs challenges, as a list of L<Net::ACME2::Challenge> | ||||||||||
| 82 | instances. (C<http-01> challenges will be instances of | ||||||||||
| 83 | L<Net::ACME2::Challenge::http_01>.) | ||||||||||
| 84 | |||||||||||
| 85 | =cut | ||||||||||
| 86 | |||||||||||
| 87 | sub challenges { | ||||||||||
| 88 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
challenges: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 89 | |||||||||||
| 90 | 0 | Call::Context::must_be_list(); | |||||||||
| 91 | |||||||||||
| 92 | 0 | my @challenges; | |||||||||
| 93 | |||||||||||
| 94 | 0 | for my $c ( @{ $self->{'_challenges'} } ) { | |||||||||
| 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 | ▶ | next if !$class->can('new'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 103 | |||||||||||
| 104 | 0 | push @challenges, $class->new( %$c ); | |||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | 0 | return @challenges; | |||||||||
| 108 | } | ||||||||||
| 109 | |||||||||||
| 110 | sub update { | ||||||||||
| 111 | 0 | ▶ | my ($self, $new_hr) = @_; | ||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 112 | |||||||||||
| 113 | 0 | for my $name ( 'status', 'challenges' ) { | |||||||||
| 114 | 0 | $self->{"_$name"} = $new_hr->{$name}; | |||||||||
| 115 | } | ||||||||||
| 116 | |||||||||||
| 117 | 0 | return $self; | |||||||||
| 118 | } | ||||||||||
| 119 | |||||||||||
| 120 | 3 | 1; | |||||||||