Class: AWS::Core::CredentialProviders::SessionProvider
- Inherits:
-
Object
- Object
- AWS::Core::CredentialProviders::SessionProvider
- Includes:
- Provider
- Defined in:
- lib/aws/core/credential_providers.rb
Overview
Session Credential Provider
The session provider consumes long term credentials (:access_key_id
and :secret_access_key
) and requests a session from STS. It then returns the short term credential set from STS.
Calling #refresh causes the session provider to request a new set of credentials.
This session provider is currently only used for DynamoDB which requires session credentials.
Constant Summary
Constants included from Provider
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(long_term_credentials) ⇒ SessionProvider
constructor
A new instance of SessionProvider.
-
#refresh ⇒ nil
Clears out cached/memoized credentials.
Methods included from Provider
#access_key_id, #credentials, #secret_access_key, #session_token
Constructor Details
#initialize(long_term_credentials) ⇒ SessionProvider
Returns a new instance of SessionProvider.
370 371 372 373 374 375 376 |
# File 'lib/aws/core/credential_providers.rb', line 370 def initialize long_term_credentials @static = StaticProvider.new(long_term_credentials) if @static.session_token raise ArgumentError, 'invalid option :session_token' end @session_mutex = Mutex.new end |
Class Method Details
.for(long_term_credentials) ⇒ Object
353 354 355 356 357 358 359 |
# File 'lib/aws/core/credential_providers.rb', line 353 def for long_term_credentials @create_mutex.synchronize do @session_providers ||= {} @session_providers[long_term_credentials[:access_key_id]] = self.new(long_term_credentials) end end |
Instance Method Details
#refresh ⇒ nil
Clears out cached/memoized credentials. Causes the provider to refetch credentials from the source.
384 385 386 387 |
# File 'lib/aws/core/credential_providers.rb', line 384 def refresh refresh_session orig_refresh end |