Class: HrrRbSsh::Authentication::Method::KeyboardInteractive::InfoResponse

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_response.rb

Instance Attribute Summary collapse

Attributes included from Loggable

#log_key, #logger

Instance Method Summary collapse

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn

Constructor Details

#initialize(payload, logger: nil) ⇒ InfoResponse

Returns a new instance of InfoResponse.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_response.rb', line 17

def initialize payload, logger: nil
  self.logger = logger
  case payload[0,1].unpack("C")[0]
  when Message::SSH_MSG_USERAUTH_INFO_RESPONSE::VALUE
    message = Message::SSH_MSG_USERAUTH_INFO_RESPONSE.new(logger: logger).decode payload
    @num_responses = message[:'num-responses']
    @responses = Array.new(message[:'num-responses']){ |i| message[:"response[#{i+1}]"] }
  else
    raise "Expected SSH_MSG_USERAUTH_INFO_RESPONSE, but got message number #{payload[0,1].unpack("C")[0]}"
  end
end

Instance Attribute Details

#num_responsesObject (readonly)

Returns the value of attribute num_responses.



13
14
15
# File 'lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_response.rb', line 13

def num_responses
  @num_responses
end

#responsesObject (readonly)

Returns the value of attribute responses.



13
14
15
# File 'lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_response.rb', line 13

def responses
  @responses
end