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 <[email protected]>
  • Loading branch information
refucktor committed Feb 6, 2025
1 parent e71e58e commit fcea40d
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 <[email protected]>
- fnuesse <[email protected]>
- greta <[email protected]>
- Hector Valcarcel <[email protected]>
- helix84 <[email protected]>
- hkjolhede <[email protected]>
- hoellen <[email protected]>
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 fcea40d

Please sign in to comment.