Class: Net::SSH::Authentication::Methods::Hostbased

Inherits:
Abstract
  • Object
show all
Includes:
Constants
Defined in:
lib/net/ssh/authentication/methods/hostbased.rb

Overview

Implements the host-based SSH authentication method.

Constant Summary

Constants included from Constants

Constants::USERAUTH_BANNER, Constants::USERAUTH_FAILURE, Constants::USERAUTH_METHOD_RANGE, Constants::USERAUTH_PASSWD_CHANGEREQ, Constants::USERAUTH_PK_OK, Constants::USERAUTH_REQUEST, Constants::USERAUTH_SUCCESS

Instance Attribute Summary

Attributes inherited from Abstract

#key_manager, #pubkey_algorithms, #session

Attributes included from Loggable

#logger

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #send_message, #session_id, #userauth_request

Methods included from Loggable

#debug, #error, #fatal, #info, #lwarn

Constructor Details

This class inherits a constructor from Net::SSH::Authentication::Methods::Abstract

Instance Method Details

#authenticate(next_service, username, password = nil) ⇒ Object

Attempts to perform host-based authorization of the user by trying all known keys.



13
14
15
16
17
18
19
20
21
22
# File 'lib/net/ssh/authentication/methods/hostbased.rb', line 13

def authenticate(next_service, username, password = nil)
  return false unless key_manager

  key_manager.each_identity do |identity|
    return true if authenticate_with(identity, next_service,
                                     username, key_manager)
  end

  return false
end