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.



171
172
173
# File 'lib/conjur/base.rb', line 171

def token_born
  @token_born
end

Instance Method Details

#needs_token_refresh?Boolean

Returns:

  • (Boolean)


173
174
175
# File 'lib/conjur/base.rb', line 173

def needs_token_refresh?
  token_age > TOKEN_STALE
end

#token_ageObject



177
178
179
# File 'lib/conjur/base.rb', line 177

def token_age
  gettime - token_born
end