Class: HrrRbSsh::Authentication::Method::KeyboardInteractive::InfoRequest
- Inherits:
-
Object
- Object
- HrrRbSsh::Authentication::Method::KeyboardInteractive::InfoRequest
- Includes:
- Loggable
- Defined in:
- lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb
Instance Attribute Summary
Attributes included from Loggable
Instance Method Summary collapse
-
#initialize(name, instruction, language_tag, prompts, logger: nil) ⇒ InfoRequest
constructor
A new instance of InfoRequest.
- #to_message ⇒ Object
- #to_payload ⇒ Object
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn
Constructor Details
#initialize(name, instruction, language_tag, prompts, logger: nil) ⇒ InfoRequest
Returns a new instance of InfoRequest.
14 15 16 17 18 19 20 |
# File 'lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb', line 14 def initialize name, instruction, language_tag, prompts, logger: nil self.logger = logger @name = name @instruction = instruction @language_tag = language_tag @prompts = prompts end |
Instance Method Details
#to_message ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb', line 22 def = { :'message number' => Message::SSH_MSG_USERAUTH_INFO_REQUEST::VALUE, :'name' => @name, :'instruction' => @instruction, :'language tag' => @language_tag, :'num-prompts' => @prompts.size, } = @prompts.map.with_index{ |(prompt, echo), i| [ [:"prompt[#{i+1}]", prompt], [:"echo[#{i+1}]", echo], ].inject(Hash.new){ |h, (k, v)| h.update({k => v}) } }.inject(Hash.new){ |a, b| a.merge(b) } .merge() end |
#to_payload ⇒ Object
39 40 41 |
# File 'lib/hrr_rb_ssh/authentication/method/keyboard_interactive/info_request.rb', line 39 def to_payload Message::SSH_MSG_USERAUTH_INFO_REQUEST.new(logger: logger).encode self. end |