blob: 10d0ea7c429e04e4711081c9753f9b02dfa456f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package App::Glacier::Signature;
# A wrapper class over Net::Amazon::Signature::V4, that supplies
# the X-Amz-Security-Token header for EC2 instance profile authentication.
sub new {
my ($class, $sig, $token) = @_;
bless { _sig => $sig, _token => $token }, $class;
};
sub sign {
my ($self, $request) = @_;
$request->header('X-Amz-Security-Token' => $self->{_token});
return $self->{_sig}->sign($request);
}
our $AUTOLOAD;
sub AUTOLOAD {
my $self = shift;
(my $meth = $AUTOLOAD) =~ s/.*:://;
$self->{_sig}->method(@_);
}
1;
|