Module: Conjur::API::TokenExpiration

Includes:
MonotonicTime
Included in:
APIKeyAuthenticator
Defined in:
lib/conjur/base.rb

Constant Summary collapse

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).

4.minutes

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MonotonicTime

#monotonic_time

Instance Attribute Details

#token_bornObject

Returns the value of attribute token_born.



282
283
284
# File 'lib/conjur/base.rb', line 282

def token_born
  @token_born
end

Instance Method Details

#needs_token_refresh?Boolean



284
285
286
# File 'lib/conjur/base.rb', line 284

def needs_token_refresh?
  token_age > TOKEN_STALE
end

#token_ageObject



288
289
290
# File 'lib/conjur/base.rb', line 288

def token_age
  gettime - token_born
end