Module: CASinoCore::Helper::Authentication

Included in:
Processor::API::LoginCredentialAcceptor, Processor::LoginCredentialAcceptor
Defined in:
lib/casino_core/helper/authentication.rb

Instance Method Summary collapse

Instance Method Details

#validate_login_credentials(username, password) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/casino_core/helper/authentication.rb', line 5

def (username, password)
  authentication_result = nil
  CASinoCore::Settings.authenticators.each do |authenticator_name, authenticator|
    begin
      data = authenticator.validate(username, password)
    rescue CASinoCore::Authenticator::AuthenticatorError => e
      logger.error "Authenticator '#{authenticator_name}' (#{authenticator.class}) raised an error: #{e}"
    end
    if data
      authentication_result = { authenticator: authenticator_name, user_data: data }
      logger.info("Credentials for username '#{data[:username]}' successfully validated using authenticator '#{authenticator_name}' (#{authenticator.class})")
      break
    end
  end
  authentication_result
end