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

Instance Method Details

#expirationTime?

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.

Returns:

  • (Time, nil)


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(options = {})
  @mutex = Mutex.new
  @before_refresh = options.delete(:before_refresh) if Hash === options

  @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

#tokenToken

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.

Returns:



27
28
29
30
# File 'lib/aws-sdk-core/refreshing_token.rb', line 27

def token
  refresh_if_near_expiration
  @token
end