Implements the "publickey" SSH authentication method.
Methods
Included Modules
Attributes
| [W] | messenger | The messenger instance to use to send and receive messages |
| [W] | session_id | The session id of the current SSH session |
Public Class methods
[ show source ]
# File lib/net/ssh/userauth/methods/publickey.rb, line 37
37: def initialize( buffers )
38: @buffers = buffers
39: end
Public Instance methods
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.
[ show source ]
# 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