Implements the “password” SSH authentication method.
Attempt to authenticate the given user for the given service. If the password parameter is nil, this will never do anything except return false.
# File lib/net/ssh/authentication/methods/password.rb, line 14 14: def authenticate(next_service, username, password=nil) 15: return false unless password 16: 17: send_message(userauth_request(username, next_service, "password", false, password)) 18: message = session.next_message 19: 20: case message.type 21: when USERAUTH_SUCCESS 22: debug { "password succeeded" } 23: return true 24: when USERAUTH_FAILURE 25: debug { "password failed" } 26: 27: raise Net::SSH::Authentication::DisallowedMethod unless 28: message[:authentications].split(/,/).include? 'password' 29: 30: return false 31: when USERAUTH_PASSWD_CHANGEREQ 32: debug { "password change request received, failing" } 33: return false 34: else 35: raise Net::SSH::Exception, "unexpected reply to USERAUTH_REQUEST: #{message.type} (#{message.inspect})" 36: end 37: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.