class Azure::Auth::TokenProvider::Token

Azure OAuth2 access token

Attributes

access_token[R]

JWT access token @return [String]

client_id[R]

Client Id @return [String]

expires_in[R]

TTL in seconds @return [Number]

expires_on[R]

Date and time when token expires @return [Time]

ext_expires_in[R]

Ext expires in @return [Time]

not_before[R]

Date and time before which token is not valid @return [Time]

resource[R]

URI of resource token is valid for @return [String]

subscription[R]

Azure subscription id @return [String]

tenant[R]

Azure app tenant id @return [String]

token_type[R]

Token type @return [String]

Public Class Methods

new(access_token, expires_on, token_type, ext) click to toggle source

Initializes new instance of Token @param access_token [String] JWT access token @param expires_on [Time] Date and time when token expires @param token_type [String] Token type @param ext [Hash] extra data

# File lib/azure/auth/token_provider/token.rb, line 39
def initialize(access_token, expires_on, token_type, ext)
  @access_token = access_token
  @expires_on = expires_on
  @token_type = token_type

  @subscription = ext.fetch(:subscription, nil)
  @tenant = ext.fetch(:tenant, nil)
  @client_id = ext.fetch(:client_id, nil)
  @expires_in = ext.fetch(:expires_in, nil)
  @ext_expires_in = ext.fetch(:ext_expires_in, nil)
  @not_before = ext.fetch(:not_before, nil)
  @resource = ext.fetch(:resource, nil)
end

Public Instance Methods

expired?() click to toggle source

Is token expired? @return [Boolean]

# File lib/azure/auth/token_provider/token.rb, line 95
def expired?
  Time.now > @expires_on
end