Class: Fog::AWS::Storage::Credentials
- Inherits:
-
Object
- Object
- Fog::AWS::Storage::Credentials
- Defined in:
- lib/fog/aws/storage.rb
Overview
Immutable snapshot of the credential-derived state needed to sign a
request: the access key id, secret, session token, and the matching
signer (v4) or HMAC (v2). These values are correlated. Under
use_iam_profile they are all replaced together whenever credentials
are refreshed.
Bundling them into one frozen object stored in a single instance variable lets a caller read a consistent set with one atomic reference read (see Real#request). Reading the fields as separate instance variables lets a refresh land between two reads and pair, for example, an old session token with a new signer, which S3 rejects with a 403. Keeping this connection safe to share across threads depends on never mutating an instance; build a new one and swap the reference.
Instance Attribute Summary collapse
-
#aws_access_key_id ⇒ Object
readonly
Returns the value of attribute aws_access_key_id.
-
#aws_secret_access_key ⇒ Object
readonly
Returns the value of attribute aws_secret_access_key.
-
#aws_session_token ⇒ Object
readonly
Returns the value of attribute aws_session_token.
-
#hmac ⇒ Object
readonly
Returns the value of attribute hmac.
-
#signer ⇒ Object
readonly
Returns the value of attribute signer.
Instance Method Summary collapse
-
#initialize(aws_access_key_id: nil, aws_secret_access_key: nil, aws_session_token: nil, signer: nil, hmac: nil) ⇒ Credentials
constructor
A new instance of Credentials.
Constructor Details
#initialize(aws_access_key_id: nil, aws_secret_access_key: nil, aws_session_token: nil, signer: nil, hmac: nil) ⇒ Credentials
Returns a new instance of Credentials.
148 149 150 151 152 153 154 155 |
# File 'lib/fog/aws/storage.rb', line 148 def initialize(aws_access_key_id: nil, aws_secret_access_key: nil, aws_session_token: nil, signer: nil, hmac: nil) @aws_access_key_id = aws_access_key_id @aws_secret_access_key = aws_secret_access_key @aws_session_token = aws_session_token @signer = signer @hmac = hmac freeze end |
Instance Attribute Details
#aws_access_key_id ⇒ Object (readonly)
Returns the value of attribute aws_access_key_id.
146 147 148 |
# File 'lib/fog/aws/storage.rb', line 146 def aws_access_key_id @aws_access_key_id end |
#aws_secret_access_key ⇒ Object (readonly)
Returns the value of attribute aws_secret_access_key.
146 147 148 |
# File 'lib/fog/aws/storage.rb', line 146 def aws_secret_access_key @aws_secret_access_key end |
#aws_session_token ⇒ Object (readonly)
Returns the value of attribute aws_session_token.
146 147 148 |
# File 'lib/fog/aws/storage.rb', line 146 def aws_session_token @aws_session_token end |
#hmac ⇒ Object (readonly)
Returns the value of attribute hmac.
146 147 148 |
# File 'lib/fog/aws/storage.rb', line 146 def hmac @hmac end |
#signer ⇒ Object (readonly)
Returns the value of attribute signer.
146 147 148 |
# File 'lib/fog/aws/storage.rb', line 146 def signer @signer end |