Methods
Classes and Modules
Class Net::SSH::UserAuth::Methods::HostBasedClass Net::SSH::UserAuth::Methods::KeyboardInteractive
Class Net::SSH::UserAuth::Methods::Password
Class Net::SSH::UserAuth::Methods::PublicKey
Public Instance methods
[ show source ]
# File lib/net/ssh/userauth/methods/services.rb, line 22 22: def register_services( container ) 23: container.namespace_define :methods do |b| 24: 25: b.password do |c,p| 26: require 'net/ssh/userauth/methods/password' 27: method = Password.new( c[:transport][:buffers] ) 28: method.messenger = c[:userauth][:driver] 29: method 30: end 31: 32: b.keyboard_interactive do |c,p| 33: require 'net/ssh/userauth/methods/keyboard-interactive' 34: method = KeyboardInteractive.new( c[:transport][:buffers], 35: c[:keyboard_interactive_callback] ) 36: method.messenger = c[:userauth][:driver] 37: method 38: end 39: 40: b.keyboard_interactive_prompter do 41: require 'net/ssh/util/prompter' 42: Net::SSH::Util::Prompter.new 43: end 44: 45: b.keyboard_interactive_callback do |c,p| 46: proc do |req| 47: if req.password 48: [ req.password ] * req.prompts.length 49: else 50: responses = [] 51: puts req.name unless req.name.empty? 52: puts req.instruction unless req.instruction.empty? 53: req.prompts.each do |prompt| 54: response = prompt.echo ? 55: gets.chomp : 56: c[:keyboard_interactive_prompter]. 57: password( prompt.prompt ) 58: responses << response 59: end 60: responses 61: end 62: end 63: end 64: 65: b.publickey do |c,p| 66: require 'net/ssh/userauth/methods/publickey' 67: method = PublicKey.new( c[:transport][:buffers] ) 68: method.messenger = c[:userauth][:driver] 69: method.session_id = c[:transport][:session].session_id 70: method 71: end 72: 73: b.hostbased do |c,p| 74: require 'net/ssh/userauth/methods/hostbased' 75: method = HostBased.new( c[:transport][:buffers] ) 76: session = c[:transport][:session] 77: method.messenger = c[:userauth][:driver] 78: method.hostname = session.client_name 79: method.session_id = session.session_id 80: method 81: end 82: 83: end 84: end