Class: HrrRbSsh::Authentication::Method::Password

Inherits:
Method
  • Object
show all
Defined in:
lib/hrr_rb_ssh/authentication/method/password.rb,
lib/hrr_rb_ssh/authentication/method/password/context.rb

Defined Under Namespace

Classes: Context

Constant Summary collapse

NAME =
'password'

Instance Method Summary collapse

Methods inherited from Method

[], inherited, list, name_list

Constructor Details

#initialize(options) ⇒ Password

Returns a new instance of Password.



12
13
14
15
16
# File 'lib/hrr_rb_ssh/authentication/method/password.rb', line 12

def initialize options
  super

  @authenticator = options.fetch( 'authentication_password_authenticator', Authenticator.new { false } )
end

Instance Method Details

#authenticate(userauth_request_message) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/hrr_rb_ssh/authentication/method/password.rb', line 18

def authenticate userauth_request_message
  @logger.info("authenticate")
  @logger.debug("userauth request: " + userauth_request_message.inspect)
  username = userauth_request_message['user name']
  password = userauth_request_message['plaintext password']
  context = Context.new(username, password)
  @authenticator.authenticate context
end