| Class | Net::SSH::UserAuth::Methods::PublicKey |
| In: |
lib/net/ssh/userauth/methods/publickey.rb
|
| Parent: | Object |
Implements the "publickey" SSH authentication method.
| messenger | [W] | The messenger instance to use to send and receive messages |
| session_id | [W] | The session id of the current SSH session |
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. The data hash must contain a UserKeyManager instance under the :key_manager key.
# File lib/net/ssh/userauth/methods/publickey.rb, line 46
46: def authenticate( next_service, username, data={} )
47: key_manager = data[:key_manager]
48: return false unless key_manager
49:
50: key_manager.identities.each do |identity|
51: return true if authenticate_with( identity, next_service,
52: username, key_manager )
53: end
54:
55: return false
56:
57: ensure
58: key_manager.finish if key_manager
59: end