Module: EM::FTPD::FSD::Authentication::Plain

Defined in:
lib/em-ftpd-fsd/authentication/plain.rb

Overview

Simple plain authentication

Instance Method Summary collapse

Instance Method Details

#authenticate(user, password) {|Boolean| ... } ⇒ Object

Check if stored username and password validates given user and password

Parameters:

  • user (String)

    Username

  • password (String)

    Password

Yields:

  • (Boolean)

    True if username and password are correct



39
40
41
# File 'lib/em-ftpd-fsd/authentication/plain.rb', line 39

def authenticate( user, password, &block )
  yield ( @auth_user == user && @auth_password == password )
end

#configure_authentication(opts) ⇒ Object

Configure the authentication module

Parameters:

  • opts (Hash)

Options Hash (opts):

  • user (Object)

    Username

  • password (Object)

    Password



30
31
32
33
# File 'lib/em-ftpd-fsd/authentication/plain.rb', line 30

def configure_authentication( opts )
  @auth_user     = opts[:user]
  @auth_password = opts[:password]
end