Skip to content

Commit

Permalink
feat(object_store): Add support for session token in AWS credentials
Browse files Browse the repository at this point in the history
- Pass session token, either null or with value, to the AWS Credentials constructor

Signed-off-by: Hector Valcarcel <hmvalcarcel@gmail.com>
  • Loading branch information
refucktor committed Feb 6, 2025
1 parent 796055e commit 6b4c859
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 4 additions & 2 deletions lib/private/Files/ObjectStore/S3ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function getConnection() {
$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']);
Expand Down Expand Up @@ -185,10 +185,12 @@ protected function paramCredentialProvider(): callable {
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)
);
}

Expand Down

0 comments on commit 6b4c859

Please sign in to comment.