Class: Azure::Storage::Common::Core::TokenCredential

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/storage/common/core/token_credential.rb

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ TokenCredential

Public: Initializes an instance of [Azure::Storage::Common::Core::TokenCredential]

Attributes

  • token - String. The initial access token.



37
38
39
40
# File 'lib/azure/storage/common/core/token_credential.rb', line 37

def initialize(token)
  @token = token
  @mutex = Mutex.new
end

Instance Method Details

#renew_token(new_token) ⇒ Object

Public: Renews the access token

Attributes

  • new_token - String. The new access token.



58
59
60
61
62
# File 'lib/azure/storage/common/core/token_credential.rb', line 58

def renew_token(new_token)
  @mutex.synchronize do
    @token = new_token
  end
end

#tokenObject

Public: Gets the access token

Note: Providing this getter under the protect of a mutex



46
47
48
49
50
# File 'lib/azure/storage/common/core/token_credential.rb', line 46

def token
  @mutex.synchronize do
    @token
  end
end