Module: TCellAgent::Hooks::LoginFraud

Defined in:
lib/tcell_agent/hooks/login_fraud.rb

Class Method Summary collapse

Class Method Details

.get_loggerObject

Note: mock out in tests



7
8
9
10
11
12
13
# File 'lib/tcell_agent/hooks/login_fraud.rb', line 7

def self.get_logger
  unless defined?(@login_fraud_logger)
    @login_fraud_logger = TCellAgent::ModuleLogger.new(TCellAgent.logger, name)
  end

  @login_fraud_logger
end

.report_login_event(status, env_or_header_keys, tcell_data, user_id, password, user_valid) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tcell_agent/hooks/login_fraud.rb', line 15

def self.(status,
                            env_or_header_keys,
                            tcell_data,
                            user_id,
                            password,
                            user_valid)
  return unless TCellAgent.configuration.should_intercept_requests? && tcell_data

   = TCellAgent.policy(TCellAgent::PolicyTypes::LOGINFRAUD)

  if ![TCellAgent::Hooks::V1::Login::LOGIN_FAILURE,
       TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS].include?(status)
    get_logger.error("Unkown login status: #{status}")
  elsif status == TCellAgent::Hooks::V1::Login::LOGIN_FAILURE
    .(
      user_id,
      password,
      env_or_header_keys,
      user_valid,
      tcell_data
    )
  elsif status == TCellAgent::Hooks::V1::Login::LOGIN_SUCCESS
    .(
      user_id,
      env_or_header_keys,
      tcell_data
    )
  end
end