lib/conjur/base.rb in conjur-api-2.2.2 vs lib/conjur/base.rb in conjur-api-2.2.3
- old
+ new
@@ -7,11 +7,10 @@
require 'conjur/path_based'
require 'conjur/escape'
require 'conjur/log'
require 'conjur/log_source'
require 'conjur/standard_methods'
-require 'conjur/token_cache'
module Conjur
class API
include Escape
include LogSource
@@ -56,11 +55,10 @@
def initialize username, api_key, token
@username = username
@api_key = api_key
@token = token
- TokenCache.store(@token) if token
raise "Expecting ( username and api_key ) or token" unless ( username && api_key ) || token
end
attr_reader :api_key, :username
@@ -72,10 +70,10 @@
def host
self.class.host
end
def token
- TokenCache.fetch(username, api_key)
+ @token ||= Conjur::API.authenticate(@username, @api_key)
end
# Authenticate the username and api_key to obtain a request token.
# Tokens are cached by username for a short period of time.
def credentials