Method: Net::SSH::Authentication::Methods::Publickey#authenticate

Defined in:
lib/net/ssh/authentication/methods/publickey.rb

#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