class Mongo::Crypt::KMS::Azure::AccessToken
Azure access token for temporary credentials.
@api private
Attributes
access_token[R]
@return [ String ] Azure access token.
expires_in[R]
@return [ Integer ] Azure access token expiration time.
Public Class Methods
new(access_token, expires_in)
click to toggle source
Creates an Azure access token object.
@param [ String ] #access_token Azure access token. @param [ Integer ] #expires_in Azure access token expiration time.
# File lib/mongo/crypt/kms/azure/access_token.rb, line 34 def initialize(access_token, expires_in) @access_token = access_token @expires_in = expires_in @expires_at = Time.now.to_i + @expires_in end
Public Instance Methods
expired?()
click to toggle source
Checks if the access token is expired.
The access token is considered expired if it is within 60 seconds of its expiration time.
@return [ true | false ] Whether the access token is expired.
# File lib/mongo/crypt/kms/azure/access_token.rb, line 46 def expired? Time.now.to_i >= @expires_at - 60 end