class HrrRbSsh::Authentication::Method::Password
Constants
- NAME
- PREFERENCE
Public Class Methods
new(transport, options, variables, authentication_methods, logger: nil)
click to toggle source
# File lib/hrr_rb_ssh/authentication/method/password.rb, line 15 def initialize transport, options, variables, authentication_methods, logger: nil self.logger = logger @transport = transport @authenticator = options.fetch( 'authentication_password_authenticator', Authenticator.new{ false } ) @options = options @variables = variables @authentication_methods = authentication_methods end
Public Instance Methods
authenticate(userauth_request_message)
click to toggle source
# File lib/hrr_rb_ssh/authentication/method/password.rb, line 24 def authenticate userauth_request_message log_info { "authenticate" } username = userauth_request_message[:'user name'] password = userauth_request_message[:'plaintext password'] context = Context.new(username, password, @variables, @authentication_methods, logger: logger) @authenticator.authenticate context end
request_authentication(username, service_name)
click to toggle source
# File lib/hrr_rb_ssh/authentication/method/password.rb, line 32 def request_authentication username, service_name password = @options['client_authentication_password'] message = { :'message number' => Message::SSH_MSG_USERAUTH_REQUEST::VALUE, :"user name" => username, :"service name" => service_name, :"method name" => NAME, :"FALSE" => false, :"plaintext password" => password, } payload = Message::SSH_MSG_USERAUTH_REQUEST.new(logger: logger).encode message @transport.send payload payload = @transport.receive end