初始化仓库
This commit is contained in:
63
vendor/aliyuncs/oss-sdk-php/src/OSS/Credentials/Credentials.php
vendored
Normal file
63
vendor/aliyuncs/oss-sdk-php/src/OSS/Credentials/Credentials.php
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace OSS\Credentials;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
/**
|
||||
* Basic implementation of the OSS Credentials that allows callers to
|
||||
* pass in the OSS Access Key and OSS Secret Access Key in the constructor.
|
||||
*/
|
||||
class Credentials
|
||||
{
|
||||
private $key;
|
||||
private $secret;
|
||||
private $token;
|
||||
|
||||
/**
|
||||
* Constructor a new BasicOSSCredentials object, with the specified OSS
|
||||
* access key and OSS secret key
|
||||
*
|
||||
* @param string $key OSS access key ID
|
||||
* @param string $secret OSS secret access key
|
||||
* @param string $token Security token to use
|
||||
*/
|
||||
public function __construct($key, $secret, $token = null)
|
||||
{
|
||||
if (empty($key)) {
|
||||
throw new OssException("access key id is empty");
|
||||
}
|
||||
if (empty($secret)) {
|
||||
throw new OssException("access key secret is empty");
|
||||
}
|
||||
$this->key = trim($key);
|
||||
$this->secret = trim($secret);
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeyId()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessKeySecret()
|
||||
{
|
||||
return $this->secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSecurityToken()
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
}
|
||||
11
vendor/aliyuncs/oss-sdk-php/src/OSS/Credentials/CredentialsProvider.php
vendored
Normal file
11
vendor/aliyuncs/oss-sdk-php/src/OSS/Credentials/CredentialsProvider.php
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace OSS\Credentials;
|
||||
|
||||
interface CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @return Credentials
|
||||
*/
|
||||
public function getCredentials();
|
||||
}
|
||||
35
vendor/aliyuncs/oss-sdk-php/src/OSS/Credentials/StaticCredentialsProvider.php
vendored
Normal file
35
vendor/aliyuncs/oss-sdk-php/src/OSS/Credentials/StaticCredentialsProvider.php
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace OSS\Credentials;
|
||||
|
||||
/**
|
||||
* Basic implementation of the OSS Credentials interface that allows callers to
|
||||
* pass in the OSS Access Key Id and OSS Secret Access Key in the constructor.
|
||||
*/
|
||||
class StaticCredentialsProvider implements CredentialsProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Credentials
|
||||
*/
|
||||
private $credentials;
|
||||
/**
|
||||
* Constructs a new StaticCredentialsProvider object, with the specified OSS
|
||||
* access key and OSS secret key
|
||||
*
|
||||
* @param string $key OSS access key ID
|
||||
* @param string $secret OSS access key secret
|
||||
* @param string $token Security token to use
|
||||
*/
|
||||
public function __construct($key, $secret, $token = null)
|
||||
{
|
||||
$this->credentials = new Credentials($key, $secret, $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Credentials
|
||||
*/
|
||||
public function getCredentials()
|
||||
{
|
||||
return $this->credentials;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user