| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Paws::Credential::ProviderChain; |
|
2
|
1
|
|
|
1
|
|
963
|
use Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has providers => ( |
|
5
|
|
|
|
|
|
|
is => 'ro', |
|
6
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
|
7
|
|
|
|
|
|
|
default => sub { |
|
8
|
|
|
|
|
|
|
[ 'Paws::Credential::Environment', |
|
9
|
|
|
|
|
|
|
'Paws::Credential::File', |
|
10
|
|
|
|
|
|
|
'Paws::Credential::ECSContainerProfile', |
|
11
|
|
|
|
|
|
|
'Paws::Credential::InstanceProfile' ] |
|
12
|
|
|
|
|
|
|
}, |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has selected_provider => ( |
|
16
|
|
|
|
|
|
|
is => 'rw', |
|
17
|
|
|
|
|
|
|
does => 'Paws::Credential', |
|
18
|
|
|
|
|
|
|
handles => [ 'access_key', 'secret_key', 'session_token' ], |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub BUILD { |
|
22
|
1
|
|
|
1
|
0
|
2194
|
my ($self) = @_; |
|
23
|
1
|
|
|
|
|
3
|
foreach my $prov (@{ $self->providers }) { |
|
|
1
|
|
|
|
|
30
|
|
|
24
|
1
|
|
|
|
|
7
|
Paws->load_class($prov); |
|
25
|
1
|
|
|
|
|
11
|
my $creds = $prov->new; |
|
26
|
1
|
50
|
|
|
|
323
|
if ($creds->are_set) { |
|
27
|
1
|
|
|
|
|
41
|
$self->selected_provider($creds); |
|
28
|
1
|
|
|
|
|
3
|
return; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
# Tried all the providers... none got creds |
|
32
|
0
|
|
|
|
|
|
die "Can't find any credentials. I tried with " . (join ',', @{ $self->providers }) |
|
|
0
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
with 'Paws::Credential'; |
|
36
|
|
|
|
|
|
|
1; |
|
37
|
|
|
|
|
|
|
### main pod documentation begin ### |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding UTF-8 |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Paws::Credential::ProviderChain |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Paws::Credential::ProviderChain; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $paws = Paws->new(config => { |
|
50
|
|
|
|
|
|
|
credentials => Paws::Credential::ProviderChain->new( |
|
51
|
|
|
|
|
|
|
providers => [ 'Paws::Credential::Environment', 'Paws::Credential::InstanceProfile' ], |
|
52
|
|
|
|
|
|
|
) |
|
53
|
|
|
|
|
|
|
}); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The ProviderChain is used to call different credential providers, one by one, in order, until one of them returns credentials. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
If none return credentials: an exception is raised. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
It is the default provider for Paws |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 providers: ArrayRef[Str] |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Defaults to C<[ 'Paws::Credential::Environment', 'Paws::Credential::File', 'Paws::Credential::InstanceProfile' ]> |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |