feat(object_store): Add support for session token in AWS credentials

- Pass session token, either null or with value, to the AWS Credentials constructor

Signed-off-by: Hector Valcarcel <hmvalcarcel@gmail.com>
This commit is contained in:
Hector Valcarcel 2025-02-06 15:43:47 +01:00 committed by Hector Manuel
parent 796055e8b2
commit 6b4c859a41
2 changed files with 5 additions and 2 deletions

View file

@ -560,6 +560,7 @@
- fnuesse <felix.nuesse@t-online.de>
- fnuesse <fnuesse@techfak.uni-bielefeld.de>
- greta <gretadoci@gmail.com>
- Hector Valcarcel <hmvalcarcel@gmail.com>
- helix84 <helix84@centrum.sk>
- hkjolhede <hkjolhede@gmail.com>
- hoellen <dev@hoellen.eu>

View file

@ -128,7 +128,7 @@ trait S3ConnectionTrait {
$logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.',
['app' => 'objectstore']);
}
if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) {
try {
$logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']);
@ -185,10 +185,12 @@ trait S3ConnectionTrait {
return function () {
$key = empty($this->params['key']) ? null : $this->params['key'];
$secret = empty($this->params['secret']) ? null : $this->params['secret'];
$sessionToken = empty($this->params['session_token']) ? null : $this->params['session_token'];
if ($key && $secret) {
return Create::promiseFor(
new Credentials($key, $secret)
// a null sessionToken match the default signature of the constructor
new Credentials($key, $secret, $sessionToken)
);
}