Class: Sqreen::Actions::BlockUser

Inherits:
Base
  • Object
show all
Extended by:
UserActionClass
Defined in:
lib/sqreen/actions/block_user.rb

Overview

Blocks a user at the point Sqreen::identify() or Sqreen::auth_track() are called

Instance Attribute Summary

Attributes inherited from Base

#expiry, #id, #send_response

Instance Method Summary collapse

Methods included from UserActionClass

new_index

Methods inherited from Base

get_type_class, inherited, known_subclasses, known_types, new_index, #run

Constructor Details

#initialize(id, opts, _params = {}) ⇒ BlockUser

Returns a new instance of BlockUser.



20
21
22
# File 'lib/sqreen/actions/block_user.rb', line 20

def initialize(id, opts, _params = {})
  super(id, opts)
end

Instance Method Details

#do_run(identity_params) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/sqreen/actions/block_user.rb', line 24

def do_run(identity_params)
  Sqreen.log.debug(
    "Will raise due to user being blocked by action #{id}. " \
    "Blocked user identity: #{identity_params}"
  )

  e = Sqreen::AttackBlocked.new(
    "Blocked user with identity #{identity_params} " \
    'due to automatic security response. No action is required'
  )

  {
    :status => :raise,
    :exception => e,
  }
end

#event_properties(identity_params) ⇒ Object



41
42
43
# File 'lib/sqreen/actions/block_user.rb', line 41

def event_properties(identity_params)
  { 'user' => identity_params }
end