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.



32
33
34
35
# File 'lib/aptible/cli/helpers/security_key.rb', line 32

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

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



30
31
32
# File 'lib/aptible/cli/helpers/security_key.rb', line 30

def pid
  @pid
end

Class Method Details

.spawn(auth) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/aptible/cli/helpers/security_key.rb', line 41

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



37
38
39
# File 'lib/aptible/cli/helpers/security_key.rb', line 37

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