Class: Net::SSH::Authentication::Methods::Publickey
- Defined in:
- lib/net/ssh/authentication/methods/publickey.rb
Overview
Implements the “publickey” 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
Instance Method Summary collapse
-
#authenticate(next_service, username, password = nil) ⇒ Object
Attempts to perform public-key authentication for the given username, trying each identity known to the key manager.
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 public-key authentication for the given username, trying each identity known to the key manager. If any of them succeed, returns true
, otherwise returns false
. This requires the presence of a key manager.
15 16 17 18 19 20 21 22 23 |
# File 'lib/net/ssh/authentication/methods/publickey.rb', line 15 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) end return false end |