authenticate (Net::SSH::Authentication::Session)

        # File lib/net/ssh/authentication/session.rb, line 49
    49:     def authenticate(next_service, username, password=nil)
    50:       debug { "beginning authentication of `#{username}'" }
    51:
    52:       transport.send_message(transport.service_request("ssh-userauth"))
    53:       message = expect_message(SERVICE_ACCEPT)
    54:
    55:       key_manager = KeyManager.new(logger, options)
    56:       keys.each { |key| key_manager.add(key) } unless keys.empty?
    57:       key_data.each { |key2| key_manager.add_key_data(key2) } unless key_data.empty?
    58:
    59:       attempted = []
    60:
    61:       @auth_methods.each do |name|
    62:         next unless @allowed_auth_methods.include?(name)
    63:         attempted << name
    64:
    65:         debug { "trying #{name}" }
    66:         method = Methods.const_get(name.split(/\W+/).map { |p| p.capitalize }.join).new(self, :key_manager => key_manager)
    67:
    68:         return true if method.authenticate(next_service, username, password)
    69:       end
    70:
    71:       error { "all authorization methods failed (tried #{attempted.join(', ')})" }
    72:       return false
    73:     ensure
    74:       key_manager.finish if key_manager
    75:     end