Module: Aws::RefreshingToken Private
- Included in:
- SSOTokenProvider
- Defined in:
- lib/aws-sdk-core/refreshing_token.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Module/mixin used by token provider classes that can be refreshed. This provides basic refresh logic in a thread-safe manner. Classes mixing in this module are expected to implement a #refresh method that populates the following instance variable:
-
‘@token` [Token] - Token object with the `expiration` and `token`
fields set.
Instance Method Summary collapse
- #expiration ⇒ Time? private
- #initialize(options = {}) ⇒ Object private
-
#refresh! ⇒ void
private
Refresh token.
- #token ⇒ Token private
Instance Method Details
#expiration ⇒ Time?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 |
# File 'lib/aws-sdk-core/refreshing_token.rb', line 33 def expiration refresh_if_near_expiration @expiration end |
#initialize(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 |
# File 'lib/aws-sdk-core/refreshing_token.rb', line 18 def initialize( = {}) @mutex = Mutex.new @before_refresh = .delete(:before_refresh) if Hash === @before_refresh.call(self) if @before_refresh refresh end |
#refresh! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Refresh token.
40 41 42 43 44 45 |
# File 'lib/aws-sdk-core/refreshing_token.rb', line 40 def refresh! @mutex.synchronize do @before_refresh.call(self) if @before_refresh refresh end end |
#token ⇒ Token
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 |
# File 'lib/aws-sdk-core/refreshing_token.rb', line 27 def token refresh_if_near_expiration @token end |