def initialize( *args )
@open = false
process_arguments( *args )
@registry.define do |b|
b.crypto_backend { @crypto_backend }
b.transport_host { @host }
b.transport_options { @options }
b.userauth_keys { @keys }
b.userauth_host_keys { @host_keys }
b.userauth_method_order { @auth_methods }
b.session( :pipeline => [] ) { self }
b.prompter do
require 'net/ssh/util/prompter'
Net::SSH::Util::Prompter.new
end
b.require 'net/ssh/transport/services', "Net::SSH::Transport"
b.require 'net/ssh/connection/services', "Net::SSH::Connection"
b.require 'net/ssh/userauth/services', "Net::SSH::UserAuth"
b.require 'net/ssh/service/services', "Net::SSH::Service"
end
userauth = @registry[:userauth][:driver]
if userauth.authenticate( "ssh-connection", @username, @password )
@open = true
@connection = @registry[:connection][:driver]
if block_given?
yield self
close
end
else
@registry[:transport][:session].close
raise AuthenticationFailed, @username
end
end