class HrrRbSsh::Authentication::Method::None

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/none.rb, line 15
def initialize transport, options, variables, authentication_methods, logger: nil
  self.logger = logger
  @transport = transport
  @authenticator = options.fetch( 'authentication_none_authenticator', Authenticator.new{ false } )
  @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/none.rb, line 23
def authenticate userauth_request_message
  log_info { "authenticate" }
  context = Context.new(userauth_request_message[:'user name'], @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/none.rb, line 29
def request_authentication username, service_name
  message = {
    :'message number' => Message::SSH_MSG_USERAUTH_REQUEST::VALUE,
    :"user name"      => username,
    :"service name"   => service_name,
    :"method name"    => NAME,
  }
  payload = Message::SSH_MSG_USERAUTH_REQUEST.new(logger: logger).encode message
  @transport.send payload
  payload = @transport.receive
end