class Sqreen::Actions::RedirectUser

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

Public Class Methods

new(id, opts, params = {}) click to toggle source
Calls superclass method Sqreen::Actions::Base::new
# File lib/sqreen/actions/redirect_user.rb, line 20
def initialize(id, opts, params = {})
  super(id, opts)
  @redirect_url = params['url']
  raise "no url provided for action #{id}" unless @redirect_url
end

Public Instance Methods

do_run(identity_params) click to toggle source
# File lib/sqreen/actions/redirect_user.rb, line 26
def do_run(identity_params)
  Sqreen.log.debug 'Will request redirect for user with identity ' \
    "#{identity_params} (action: #{id})."

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

  {
    :status => :raise,
    :exception => e,
  }
end
event_properties(identity_params) click to toggle source
# File lib/sqreen/actions/redirect_user.rb, line 42
def event_properties(identity_params)
  { 'user' => identity_params }
end