class Cryptoprocessing::Api::Auth::TokenStore

Constants

AUTHORIZATION_URI
TOKEN_CREDENTIAL_URI

Attributes

store[RW]

@return [Object] Storage object.

Public Class Methods

new(store) click to toggle source

Initializes the Storage object.

@param [Object] store

Storage object
# File lib/cryptoprocessing/authentication/token_store.rb, line 20
def initialize(store)
  @store = store
end

Public Instance Methods

credentials_hash() click to toggle source

@return [Hash] with credentials

# File lib/cryptoprocessing/authentication/token_store.rb, line 45
def credentials_hash
  {
      :authorization_uri => AUTHORIZATION_URI,
      :token_credential_uri => TOKEN_CREDENTIAL_URI,
      :issued_at => authorization.issued_at.to_i,
      :auth_token => '',
      :user_id => '',
  }
end
load_credentials() click to toggle source

Attempt to read in credentials from the specified store.

# File lib/cryptoprocessing/authentication/token_store.rb, line 39
def load_credentials
  store.load_credentials
end
refresh_authorization() click to toggle source

refresh credentials and save them to store

# File lib/cryptoprocessing/authentication/token_store.rb, line 33
def refresh_authorization
  self.write_credentials
end
write_credentials() click to toggle source

Write the credentials to the specified store.

# File lib/cryptoprocessing/authentication/token_store.rb, line 27
def write_credentials
  store.write_credentials(credentials_hash)
end