Class: Conjur::API::LocalAuthenticator

Inherits:
Object
  • Object
show all
Includes:
TokenExpiration
Defined in:
lib/conjur/base.rb

Overview

Obtains access tokens from the +authn-local+ service.

Constant Summary

Constants included from TokenExpiration

TokenExpiration::TOKEN_STALE

Instance Attribute Summary collapse

Attributes included from TokenExpiration

#token_born

Instance Method Summary collapse

Methods included from TokenExpiration

#gettime, #needs_token_refresh?, #token_age, #update_token_born

Constructor Details

#initialize(account, username, expiration, cidr) ⇒ LocalAuthenticator

Returns a new instance of LocalAuthenticator.



233
234
235
236
237
238
239
240
# File 'lib/conjur/base.rb', line 233

def initialize , username, expiration, cidr
  @account = 
  @username = username
  @expiration = expiration
  @cidr = cidr

  update_token_born
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



231
232
233
# File 'lib/conjur/base.rb', line 231

def 
  @account
end

#cidrObject (readonly)

Returns the value of attribute cidr.



231
232
233
# File 'lib/conjur/base.rb', line 231

def cidr
  @cidr
end

#expirationObject (readonly)

Returns the value of attribute expiration.



231
232
233
# File 'lib/conjur/base.rb', line 231

def expiration
  @expiration
end

#usernameObject (readonly)

Returns the value of attribute username.



231
232
233
# File 'lib/conjur/base.rb', line 231

def username
  @username
end

Instance Method Details

#refresh_tokenObject



242
243
244
245
246
# File 'lib/conjur/base.rb', line 242

def refresh_token
  Conjur::API.authenticate_local(username, account: , expiration: expiration, cidr: cidr).tap do
    update_token_born
  end
end