Add web identity provider to S3 connection chain

Signed-off-by: James Letendre <james.letendre@gmail.com>
This commit is contained in:
James Letendre 2020-12-15 16:37:46 -05:00 committed by backportbot[bot]
parent 5750d79181
commit b65b2bbf55
1 changed files with 4 additions and 13 deletions

View File

@ -106,22 +106,13 @@ trait S3ConnectionTrait {
CredentialProvider::chain(
$this->paramCredentialProvider(),
CredentialProvider::env(),
CredentialProvider::instanceProfile()
CredentialProvider::assumeRoleWithWebIdentityCredentialProvider()
!empty(getenv(EcsCredentialProvider::ENV_URI))
? CredentialProvider::ecsCredentials()
: CredentialProvider::instanceProfile()
)
);
// If running in an ECS environment, then also include the ECS task role in the chain
if (!empty(getenv(EcsCredentialProvider::ENV_URI))) {
$provider = CredentialProvider::memoize(
CredentialProvider::chain(
$this->paramCredentialProvider(),
CredentialProvider::env(),
CredentialProvider::ecsCredentials(),
CredentialProvider::instanceProfile()
)
);
}
$options = [
'version' => isset($this->params['version']) ? $this->params['version'] : 'latest',
'credentials' => $provider,