Class: Aptible::CLI::Helpers::SecurityKey::ThrottledAuthenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/aptible/cli/helpers/security_key.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth, pid) ⇒ ThrottledAuthenticator

Returns a new instance of ThrottledAuthenticator.



46
47
48
49
# File 'lib/aptible/cli/helpers/security_key.rb', line 46

def initialize(auth, pid)
  @auth = auth
  @pid = pid
end

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



44
45
46
# File 'lib/aptible/cli/helpers/security_key.rb', line 44

def pid
  @pid
end

Class Method Details

.spawn(auth) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/aptible/cli/helpers/security_key.rb', line 55

def self.spawn(auth)
  pid = Process.spawn(
    'sleep', '2',
    in: :close, out: :close, err: :close,
    close_others: true
  )

  U2F_LOGGER.debug("#{self} #{auth.key_handle}: spawned #{pid}")

  new(auth, pid)
end

Instance Method Details

#exited(_status) ⇒ Object



51
52
53
# File 'lib/aptible/cli/helpers/security_key.rb', line 51

def exited(_status)
  [Authenticator.spawn(@auth), nil]
end