File Coverage

blib/lib/Net/Amazon/S3/Signature.pm
Criterion Covered Total %
statement 17 27 62.9
branch 2 8 25.0
condition n/a
subroutine 4 7 57.1
pod 2 2 100.0
total 25 44 56.8


line stmt bran cond sub pod time code
1             # ABSTRACT: S3 Signature implementation base class
2             $Net::Amazon::S3::Signature::VERSION = '0.991';
3             use Moose;
4 99     99   45744  
  99         213  
  99         545  
5             has http_request => (
6             is => 'ro',
7             isa => 'Net::Amazon::S3::HTTPRequest',
8             );
9              
10             my ($self, $request) = @_;
11              
12 210     210   529 my %headers = $self->http_request->s3->authorization_context->authorization_headers;
13              
14 210         5676 while (my ($key, $value) = each %headers) {
15             $self->_populate_default_header ($request, $key => $value);
16 210         794 }
17 1         6  
18             ();
19             }
20 210         485  
21             my ($self, $request) = @_;
22              
23             my %headers = $self->http_request->s3->authorization_context->authorization_headers;
24 6     6   13  
25             while (my ($key, $value) = each %headers) {
26 6         150 $self->_populate_default_query_param ($request, $key => $value);
27             }
28 6         21  
29 0         0 ();
30             }
31              
32 6         14 my ($self, $request, $key, $value) = @_;
33              
34             return unless defined $value;
35             return if defined $request->header ($key);
36 1     1   3  
37             $request->header ($key => $value);
38 1 50       3  
39 1 50       5 ();
40             }
41 1         59  
42             my ($self, $request, $key, $value) = @_;
43 1         44  
44             return unless defined $value;
45             return if defined $request->uri->query_param ($key);
46              
47 0     0     $request->uri->query_param ($key => $value);
48              
49 0 0         ();
50 0 0         }
51              
52 0           my ($self, $request);
53              
54 0           return;
55             }
56              
57             my ($self, $uri, $expires_at);
58 0     0 1    
59             return;
60 0           }
61              
62             1;
63              
64 0     0 1    
65             =pod
66 0            
67             =encoding UTF-8
68              
69             =head1 NAME
70              
71             Net::Amazon::S3::Signature - S3 Signature implementation base class
72              
73             =head1 VERSION
74              
75             version 0.991
76              
77             =head1 METHODS
78              
79             =head2 new
80              
81             Signature class should accept HTTPRequest instance and determine every
82             required parameter via this instance
83              
84             =head2 sign_request( $request )
85              
86             Signature class should return authenticated request based on given parameter.
87             Parameter can be modified.
88              
89             =head2 sign_uri( $request, $expires_at?, $method? )
90              
91             Signature class should return authenticated uri based on given request.
92              
93             $expires_at is expiration time in seconds (epoch).
94             Default and maximal allowed value may depend on signature version.
95              
96             Default request date is current time.
97             Signature class should accept provided C<< X-Amz-Date >> header instead (if signing request)
98             or query parameter (if signing uri)
99              
100             =head1 AUTHOR
101              
102             Branislav Zahradník <barney@cpan.org>
103              
104             =head1 COPYRIGHT AND LICENSE
105              
106             This software is copyright (c) 2022 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník.
107              
108             This is free software; you can redistribute it and/or modify it under
109             the same terms as the Perl 5 programming language system itself.
110              
111             =cut