Class Credentials
Basic implementation of the AWSCredentials interface that allows callers to pass in the AWS access key and secret access in the constructor.
- Aws\Common\Credentials\Credentials implements Aws\Common\Credentials\CredentialsInterface, Guzzle\Common\FromConfigInterface
Methods summary
-
public staticgetConfigDefaults ( )Get the available keys for the factory method
-
public staticfactory ( array $config = array() )Factory method for creating new credentials. This factory method will create the appropriate credentials object with appropriate decorators based on the passed configuration options.
-
public staticfromIni ( string|null $profile = null, string|null $filename = null )Create credentials from the credentials ini file in the HOME directory.
-
public__construct ( string $accessKeyId, string $secretAccessKey, string $token = null, int $expiration = null )Constructs a new BasicAWSCredentials object, with the specified AWS access key and AWS secret key
-
publicserialize ( ) -
publicunserialize ( mixed $serialized ) -
publicgetAccessKeyId ( )Returns the AWS access key ID for this credentials object.
-
publicgetSecretKey ( )Returns the AWS secret access key for this credentials object.
-
publicgetSecurityToken ( )Get the associated security token if available
-
publicgetExpiration ( )Get the UNIX timestamp in which the credentials will expire
-
publicisExpired ( )Check if the credentials are expired
-
publicsetAccessKeyId ( string $key )Set the AWS access key ID for this credentials object.
-
publicsetSecretKey ( string $secret )Set the AWS secret access key for this credentials object.
-
publicsetSecurityToken ( string $token )Set the security token to use with this credentials object
-
publicsetExpiration ( int $timestamp )Set the UNIX timestamp in which the credentials will expire
Methods detail
Get the available keys for the factory method
Returns
arrayFactory method for creating new credentials. This factory method will create the appropriate credentials object with appropriate decorators based on the passed configuration options.
Parameters
- $config
array
$config Options to use when instantiating the credentials
Returns
Throws
Aws\Common\Exception\InvalidArgumentExceptionIf the caching options are invalid
Aws\Common\Exception\RuntimeExceptionIf using the default cache and APC is disabled
Implementation of
public static
Aws\Common\Credentials\CredentialsInterface
fromIni( string|null $profile = null, string|null $filename = null )
Create credentials from the credentials ini file in the HOME directory.
Parameters
- $profile
string|null
$profile Pass a specific profile to use. If no profile is specified we will attempt to use the value specified in the AWS_PROFILE environment variable. If AWS_PROFILE is not set, the "default" profile is used.- $filename
string|null
$filename Pass a string to specify the location of the credentials files. If null is passed, the SDK will attempt to find the configuration file at in your HOME directory at ~/.aws/credentials.
Returns
Throws
public
__construct( string $accessKeyId, string $secretAccessKey, string $token = null, integer $expiration = null )
Constructs a new BasicAWSCredentials object, with the specified AWS access key and AWS secret key
Parameters
- $accessKeyId
string
$accessKeyId AWS access key ID- $secretAccessKey
string
$secretAccessKey AWS secret access key- $token
string
$token Security token to use- $expiration
integer
$expiration UNIX timestamp for when credentials expire
Implementation of
Implementation of
Returns the AWS access key ID for this credentials object.
Returns
stringImplementation of
Returns the AWS secret access key for this credentials object.
Returns
stringImplementation of
Get the associated security token if available
Returns
string|nullImplementation of
Get the UNIX timestamp in which the credentials will expire
Returns
integer|nullImplementation of
Check if the credentials are expired
Returns
booleanImplementation of
Set the AWS access key ID for this credentials object.
Parameters
- $key
string
$key AWS access key ID
Returns
Implementation of
Set the AWS secret access key for this credentials object.
Parameters
- $secret
string
$secret AWS secret access key
Returns
Implementation of
Set the security token to use with this credentials object
Parameters
- $token
string
$token Security token
Returns
Implementation of
Set the UNIX timestamp in which the credentials will expire
Parameters
- $timestamp
integer
$timestamp UNIX timestamp expiration
Returns
Implementation of
Magic methods summary
Constants summary
string |
ENV_KEY |
'AWS_ACCESS_KEY_ID' |
|
string |
ENV_SECRET |
'AWS_SECRET_KEY' |
|
string |
ENV_SECRET_ACCESS_KEY |
'AWS_SECRET_ACCESS_KEY' |
|
string |
ENV_PROFILE |
'AWS_PROFILE' |
Properties summary
protected
string
|
$key |
#
AWS Access Key ID |
protected
string
|
$secret |
#
AWS Secret Access Key |
protected
string
|
$token |
#
AWS Security Token |
protected
integer
|
$ttd |
#
Time to die of token |