Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/3rdparty.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'aws/aws-sdk-php/src/Credentials/Credentials.php')
-rw-r--r--aws/aws-sdk-php/src/Credentials/Credentials.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/aws/aws-sdk-php/src/Credentials/Credentials.php b/aws/aws-sdk-php/src/Credentials/Credentials.php
index bd2bdc90..aca605a9 100644
--- a/aws/aws-sdk-php/src/Credentials/Credentials.php
+++ b/aws/aws-sdk-php/src/Credentials/Credentials.php
@@ -76,16 +76,38 @@ class Credentials implements CredentialsInterface, \Serializable
public function serialize()
{
- return json_encode($this->toArray());
+ return json_encode($this->__serialize());
}
public function unserialize($serialized)
{
$data = json_decode($serialized, true);
+ $this->__unserialize($data);
+ }
+
+ public function __serialize()
+ {
+ return $this->toArray();
+ }
+
+ public function __unserialize($data)
+ {
$this->key = $data['key'];
$this->secret = $data['secret'];
$this->token = $data['token'];
$this->expires = $data['expires'];
}
+
+ public function extendExpiration() {
+ $extension = mt_rand(5, 10);
+ $this->expires = time() + $extension * 60;
+
+ $message = <<<EOT
+Attempting credential expiration extension due to a credential service
+availability issue. A refresh of these credentials will be attempted again
+after {$extension} minutes.\n
+EOT;
+ error_log($message);
+ }
}