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 static
getConfigDefaults ( )
Get the available keys for the factory method
-
public static
factory ( 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 static
fromIni ( 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
-
public
serialize ( )
-
public
unserialize ( mixed $serialized )
-
public
getAccessKeyId ( )
Returns the AWS access key ID for this credentials object.
-
public
getSecretKey ( )
Returns the AWS secret access key for this credentials object.
-
public
getSecurityToken ( )
Get the associated security token if available
-
public
getExpiration ( )
Get the UNIX timestamp in which the credentials will expire
-
public
isExpired ( )
Check if the credentials are expired
-
public
setAccessKeyId ( string $key )
Set the AWS access key ID for this credentials object.
-
public
setSecretKey ( string $secret )
Set the AWS secret access key for this credentials object.
-
public
setSecurityToken ( string $token )
Set the security token to use with this credentials object
-
public
setExpiration ( int $timestamp )
Set the UNIX timestamp in which the credentials will expire
Methods detail
Get the available keys for the factory method
Returns
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.
Parameters
- $config
array
$config Options to use when instantiating the credentials
Returns
Throws
Aws\Common\Exception\InvalidArgumentException
If the caching options are invalid
Aws\Common\Exception\RuntimeException
If 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
string
Implementation of
Returns the AWS secret access key for this credentials object.
Returns
string
Implementation of
Get the associated security token if available
Returns
string|null
Implementation of
Get the UNIX timestamp in which the credentials will expire
Returns
integer|null
Implementation of
Check if the credentials are expired
Returns
boolean
Implementation 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 |