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