module Conjur::API::TokenExpiration

Constants

TOKEN_STALE

The four minutes is to work around a bug in Conjur < 4.7 causing a 404 on long-running operations (when the token is used right around the 5 minute mark).

Attributes

token_born[RW]

Public Instance Methods

gettime() click to toggle source
# File lib/conjur/base.rb, line 198
def gettime
  Process.clock_gettime Process::CLOCK_MONOTONIC
rescue
  # fall back to normal clock if there's no CLOCK_MONOTONIC
  Time.now.to_f
end
needs_token_refresh?() click to toggle source
# File lib/conjur/base.rb, line 186
def needs_token_refresh?
  token_age > TOKEN_STALE
end
token_age() click to toggle source
# File lib/conjur/base.rb, line 194
def token_age
  gettime - token_born
end
update_token_born() click to toggle source
# File lib/conjur/base.rb, line 190
def update_token_born
  self.token_born = gettime
end