« blib/lib/Amazon/Credentials/Provider/AssumeRole.pm
↑ Summary
blib/lib/Amazon/Credentials/Provider/Config.pm »
| 1 | package Amazon::Credentials::Provider::InstanceRole; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use parent qw(Amazon::Credentials::Provider); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 9 | __PACKAGE__->follow_best_practice; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 9 | __PACKAGE__->mk_accessors( | |||||||||||||||||||||||||||
| 13 | qw( | ||||||||||||||||||||||||||||
| 14 | imdsv2 | ||||||||||||||||||||||||||||
| 15 | imdsv2_token | ||||||||||||||||||||||||||||
| 16 | metadata_base_url | ||||||||||||||||||||||||||||
| 17 | role | ||||||||||||||||||||||||||||
| 18 | user_agent | ||||||||||||||||||||||||||||
| 19 | ) | ||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 9 | ▶ | use Amazon::Credentials::HTTP::UserAgent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 9 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 9 | ▶ | use HTTP::Request; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 9 | ▶ | use JSON; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 9 | ▶ | use constant { ## no critic | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 9 | AWS_IAM_SECURITY_CREDENTIALS_URI => q{latest/meta-data/iam/security-credentials/}, | |||||||||||||||||||||||||||
| 30 | IMDSv2_DEFAULT_TTL => 21_600, | ||||||||||||||||||||||||||||
| 31 | IMDSv2_HEADER => q{x-aws-ec2-metadata-token}, | ||||||||||||||||||||||||||||
| 32 | IMDSv2_TTL_HEADER => q{x-aws-ec2-metadata-token-ttl-seconds}, | ||||||||||||||||||||||||||||
| 33 | IMDSv2_URI => q{latest/api/token}, | ||||||||||||||||||||||||||||
| 34 | 9 | }; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | ######################################################################## | ||||||||||||||||||||||||||||
| 37 | 14 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=13 SCAR=25.8
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | ######################################################################## | ||||||||||||||||||||||||||||
| 39 | 14 | my ( $class, @args ) = @_; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 14 | ▶ | my $options = ref $args[0] ? { %{ $args[0] } } : {@args}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 14 | ▶ | my $disabled = $ENV{AWS_EC2_METADATA_DISABLED} // q{}; | ||||||||||||||||||||||||||
|
Condition100%2/2
$ENV{"AWS_EC2_METADATA_DISABLED"} // ""
MC/DC100%1/1
$ENV{"AWS_EC2_METADATA_DISABLED"} // ""
$ENV{"AWS_EC2_METADATA_DISABLED"}
Truth table100%2/2
A
A= $ENV{"AWS_EC2_METADATA_DISABLED"}
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | return | ||||||||||||||||||||||||||||
| 46 | 14 | ▶ | if $disabled eq 'true'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 13 | ▶ | my $metadata_base_url = $options->{metadata_base_url} || q{http://169.254.169.254/}; | ||||||||||||||||||||||||||
|
Condition100%2/2
$options->{'metadata_base_url'} || 'http://169.254.169.254/'
MC/DC100%1/1
$options->{'metadata_base_url'} || 'http://169.254.169.254/'
$options->{'metadata_base_url'}
Truth table100%2/2
A
A= $options->{'metadata_base_url'}
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 13 | ▶ | my $ua = $options->{user_agent} || Amazon::Credentials::HTTP::UserAgent->new; | ||||||||||||||||||||||||||
|
Condition33%1/3
$options->{'user_agent'} || 'Amazon::Credentials::HTTP::UserAgent'->new
MC/DC0%0/2
$options->{'user_agent'} || 'Amazon::Credentials::HTTP::UserAgent'->new
$options->{'user_agent'}
'Amazon::Credentials::HTTP::UserAgent'->new
Truth table33%1/3
A || B
A= $options->{'user_agent'}B= 'Amazon::Credentials::HTTP::UserAgent'->new
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 13 | my $imdsv2 = $options->{imdsv2}; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 13 | ▶ | $imdsv2 = 'preferred' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | if !defined $imdsv2; | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 13 | ▶ | $imdsv2 = $imdsv2 ? 'required' : 'disabled' | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 58 | if $imdsv2 =~ /\A[01]\z/xsm; | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 13 | my $imdsv2_token; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 13 | ▶ | if ( $imdsv2 ne 'disabled' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 8 | my $result = eval { | |||||||||||||||||||||||||||
| 64 | 8 | $imdsv2_token = $class->_get_imdsv2_token( | |||||||||||||||||||||||||||
| 65 | metadata_base_url => $metadata_base_url, | ||||||||||||||||||||||||||||
| 66 | user_agent => $ua, | ||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 4 | return 1; | |||||||||||||||||||||||||||
| 70 | }; | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 8 | ▶ | if ( !$result ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 4 | ▶ | croak $EVAL_ERROR | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | if $imdsv2 eq 'required'; | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 11 | my $role = $class->_get_role_name( | |||||||||||||||||||||||||||
| 79 | imdsv2_token => $imdsv2_token, | ||||||||||||||||||||||||||||
| 80 | metadata_base_url => $metadata_base_url, | ||||||||||||||||||||||||||||
| 81 | user_agent => $ua, | ||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | return | ||||||||||||||||||||||||||||
| 85 | 11 | ▶ | if !$role; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 10 | my $credentials = $class->_get_role_credentials( | |||||||||||||||||||||||||||
| 88 | role => $role, | ||||||||||||||||||||||||||||
| 89 | imdsv2_token => $imdsv2_token, | ||||||||||||||||||||||||||||
| 90 | metadata_base_url => $metadata_base_url, | ||||||||||||||||||||||||||||
| 91 | user_agent => $ua, | ||||||||||||||||||||||||||||
| 92 | ); | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | my $self = $class->SUPER::new( | ||||||||||||||||||||||||||||
| 95 | aws_access_key_id => $credentials->{AccessKeyId}, | ||||||||||||||||||||||||||||
| 96 | aws_secret_access_key => $credentials->{SecretAccessKey}, | ||||||||||||||||||||||||||||
| 97 | expiration => $credentials->{Expiration}, | ||||||||||||||||||||||||||||
| 98 | source => 'instance_role', | ||||||||||||||||||||||||||||
| 99 | token => $credentials->{Token}, | ||||||||||||||||||||||||||||
| 100 | 9 | ); | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 9 | $self->set_imdsv2($imdsv2); | |||||||||||||||||||||||||||
| 103 | 9 | $self->set_imdsv2_token($imdsv2_token); | |||||||||||||||||||||||||||
| 104 | 9 | $self->set_metadata_base_url($metadata_base_url); | |||||||||||||||||||||||||||
| 105 | 9 | $self->set_role($role); | |||||||||||||||||||||||||||
| 106 | 9 | $self->set_user_agent($ua); | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 9 | return $self; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | ######################################################################## | ||||||||||||||||||||||||||||
| 112 | 8 | ▶ | sub _get_imdsv2_token { | ||||||||||||||||||||||||||
|
Subroutine
_get_imdsv2_token: called CC=6 SCAR=18.6
| |||||||||||||||||||||||||||||
| 113 | ######################################################################## | ||||||||||||||||||||||||||||
| 114 | 8 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 8 | ▶ | my $options | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | = ref $args[0] | ||||||||||||||||||||||||||||
| 118 | ? $args[0] | ||||||||||||||||||||||||||||
| 119 | : {@args}; | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 8 | my $url = $options->{metadata_base_url} . IMDSv2_URI; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 8 | my $req = HTTP::Request->new( PUT => $url ); | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 8 | $req->header( IMDSv2_TTL_HEADER, IMDSv2_DEFAULT_TTL ); | |||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 8 | my $rsp = $options->{user_agent}->request($req); | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 8 | ▶ | croak 'no response from IMDSv2 token endpoint' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | if !$rsp; | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 8 | ▶ | croak 'could not retrieve IMDSv2 token' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | if !$rsp->is_success; | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 4 | my $token = $rsp->content; | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 4 | ▶ | croak 'IMDSv2 token endpoint returned no token' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $token and length $token
MC/DC0%0/2
defined $token and length $token
defined $token
length $token
Truth table33%1/3
A and B
A= defined $tokenB= length $token
| |||||||||||||||||||||||||||||
| 138 | if !defined $token || !length $token; | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 4 | return $token; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | ######################################################################## | ||||||||||||||||||||||||||||
| 144 | 11 | ▶ | sub _get_role_name { | ||||||||||||||||||||||||||
|
Subroutine
_get_role_name: called CC=7 SCAR=19.9
| |||||||||||||||||||||||||||||
| 145 | ######################################################################## | ||||||||||||||||||||||||||||
| 146 | 11 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 11 | ▶ | my $options = ref $args[0] ? $args[0] : {@args}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 11 | my $url = $options->{metadata_base_url} . AWS_IAM_SECURITY_CREDENTIALS_URI; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 11 | my $req = HTTP::Request->new( GET => $url ); | |||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 11 | ▶ | if ( $options->{imdsv2_token} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 4 | $req->header( IMDSv2_HEADER, $options->{imdsv2_token} ); | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 11 | my $rsp = $options->{user_agent}->request($req); | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | return | ||||||||||||||||||||||||||||
| 161 | 11 | ▶ | if !$rsp || !$rsp->is_success; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$rsp and $rsp->is_success
MC/DC50%1/2
$rsp and $rsp->is_success
$rsp
$rsp->is_success
Truth table66%2/3
A and B
A= $rspB= $rsp->is_success
| |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 10 | my $role = $rsp->content; | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | return | ||||||||||||||||||||||||||||
| 166 | 10 | ▶ | if !defined $role || !length $role; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $role and length $role
MC/DC0%0/2
defined $role and length $role
defined $role
length $role
Truth table33%1/3
A and B
A= defined $roleB= length $role
| |||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 10 | chomp $role; | |||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 10 | return $role; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | ######################################################################## | ||||||||||||||||||||||||||||
| 174 | 12 | ▶ | sub _get_role_credentials { | ||||||||||||||||||||||||||
|
Subroutine
_get_role_credentials: called CC=9 SCAR=22.9
| |||||||||||||||||||||||||||||
| 175 | ######################################################################## | ||||||||||||||||||||||||||||
| 176 | 12 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 12 | ▶ | my $options = ref $args[0] ? $args[0] : {@args}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 12 | my $url = $options->{metadata_base_url} . AWS_IAM_SECURITY_CREDENTIALS_URI . $options->{role}; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 12 | my $req = HTTP::Request->new( GET => $url ); | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 12 | ▶ | if ( $options->{imdsv2_token} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | 5 | $req->header( IMDSv2_HEADER, $options->{imdsv2_token} ); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 12 | my $rsp = $options->{user_agent}->request($req); | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 12 | ▶ | croak 'no response from instance role credential endpoint' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | if !$rsp; | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 12 | ▶ | croak sprintf 'instance role credential request failed: %s', $rsp->status_line | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | if !$rsp->is_success; | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 12 | my $credentials = eval { return decode_json( $rsp->content ); }; | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 12 | ▶ | croak 'could not decode instance role credentials' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$Amazon::Credentials::Provider::InstanceRole::EVAL_ERROR or not ref $credentials
MC/DC0%0/2
$Amazon::Credentials::Provider::InstanceRole::EVAL_ERROR or not ref $credentials
$Amazon::Credentials::Provider::InstanceRole::EVAL_ERROR
not ref $credentials
Truth table33%1/3
A or not(B)
A= $Amazon::Credentials::Provider::InstanceRole::EVAL_ERRORB= not ref $credentials
| |||||||||||||||||||||||||||||
| 199 | if $EVAL_ERROR || !ref $credentials; | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | croak 'instance role response contains no AccessKeyId' | ||||||||||||||||||||||||||||
| 202 | 12 | ▶ | if !$credentials->{AccessKeyId}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | croak 'instance role response contains no SecretAccessKey' | ||||||||||||||||||||||||||||
| 205 | 12 | ▶ | if !$credentials->{SecretAccessKey}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 11 | return $credentials; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | ######################################################################## | ||||||||||||||||||||||||||||
| 211 | 1 | ▶ | sub is_refreshable { | ||||||||||||||||||||||||||
|
Subroutine
is_refreshable: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 212 | ######################################################################## | ||||||||||||||||||||||||||||
| 213 | 1 | return 1; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | ######################################################################## | ||||||||||||||||||||||||||||
| 217 | 2 | ▶ | sub refresh_credentials { | ||||||||||||||||||||||||||
|
Subroutine
refresh_credentials: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 218 | ######################################################################## | ||||||||||||||||||||||||||||
| 219 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 2 | my $credentials = $self->_get_role_credentials( | |||||||||||||||||||||||||||
| 222 | role => $self->get_role, | ||||||||||||||||||||||||||||
| 223 | imdsv2_token => $self->get_imdsv2_token, | ||||||||||||||||||||||||||||
| 224 | metadata_base_url => $self->get_metadata_base_url, | ||||||||||||||||||||||||||||
| 225 | user_agent => $self->get_user_agent, | ||||||||||||||||||||||||||||
| 226 | ); | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 2 | $self->set_aws_access_key_id( $credentials->{AccessKeyId} ); | |||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 2 | $self->set_aws_secret_access_key( $credentials->{SecretAccessKey} ); | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 2 | $self->set_token( $credentials->{Token} ); | |||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 2 | $self->set_expiration( $credentials->{Expiration} ); | |||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 2 | $self->set_last_refreshed(time); | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 2 | return $self; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 9 | 1; | |||||||||||||||||||||||||||