Class: Azure::Storage::Common::Core::TokenCredential
- Inherits:
-
Object
- Object
- Azure::Storage::Common::Core::TokenCredential
- Defined in:
- lib/azure/storage/common/core/token_credential.rb
Instance Method Summary collapse
-
#initialize(token) ⇒ TokenCredential
constructor
Public: Initializes an instance of [Azure::Storage::Common::Core::TokenCredential].
-
#renew_token(new_token) ⇒ Object
Public: Renews the access token.
-
#token ⇒ Object
Public: Gets the access token.
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 |
#token ⇒ Object
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 |