Class: Mongo::Crypt::KMS::Azure::AccessToken Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::KMS::Azure::AccessToken
- Defined in:
- lib/mongo/crypt/kms/azure/access_token.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Azure access token for temporary credentials.
Instance Attribute Summary collapse
-
#access_token ⇒ String
readonly
private
Azure access token.
-
#expires_in ⇒ Integer
readonly
private
Azure access token expiration time.
Instance Method Summary collapse
-
#expired? ⇒ true | false
private
Checks if the access token is expired.
-
#initialize(access_token, expires_in) ⇒ AccessToken
constructor
private
Creates an Azure access token object.
Constructor Details
#initialize(access_token, expires_in) ⇒ AccessToken
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.
Creates an Azure access token object.
35 36 37 38 39 |
# File 'lib/mongo/crypt/kms/azure/access_token.rb', line 35 def initialize(access_token, expires_in) @access_token = access_token @expires_in = expires_in @expires_at = Time.now.to_i + @expires_in end |
Instance Attribute Details
#access_token ⇒ String (readonly)
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 Azure access token.
26 27 28 |
# File 'lib/mongo/crypt/kms/azure/access_token.rb', line 26 def access_token @access_token end |
#expires_in ⇒ Integer (readonly)
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 Azure access token expiration time.
29 30 31 |
# File 'lib/mongo/crypt/kms/azure/access_token.rb', line 29 def expires_in @expires_in end |
Instance Method Details
#expired? ⇒ true | false
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.
Checks if the access token is expired.
The access token is considered expired if it is within 60 seconds of its expiration time.
47 48 49 |
# File 'lib/mongo/crypt/kms/azure/access_token.rb', line 47 def expired? Time.now.to_i >= @expires_at - 60 end |