Module: Immunio::Authentication

Included in:
Immunio
Defined in:
lib/immunio/authentication.rb

Overview

API for triggering the Immunio authentication hooks.

Instance Method Summary collapse

Instance Method Details

#failed_login(options_ro = {}) ⇒ Object

Call after an unsuccessful login.



22
23
24
25
26
# File 'lib/immunio/authentication.rb', line 22

def (options_ro={})
  plugin, options = parse_opts(options_ro)
  return unless plugin
  Immunio.run_hook! plugin, "authenticate", options.merge({is_valid: false})
end

#failed_password_reset(options_ro = {}) ⇒ Object

Call after a failed password reset has been requested.



51
52
53
54
55
56
# File 'lib/immunio/authentication.rb', line 51

def failed_password_reset(options_ro={})
  plugin, options = parse_opts(options_ro)
  return unless plugin
  options[:is_valid] = false
  Immunio.run_hook! plugin, "framework_password_reset", options
end

#login(options_ro = {}) ⇒ Object

Call after a successful login.



14
15
16
17
18
19
# File 'lib/immunio/authentication.rb', line 14

def (options_ro={})
  plugin, options = parse_opts(options_ro)
  return unless plugin
  Immunio.run_hook! plugin, "authenticate", options.merge({is_valid: true})
  Immunio.run_hook! plugin, "framework_login", options
end

#logout(options_ro = {}) ⇒ Object

Call after a user logs out.



29
30
31
32
33
# File 'lib/immunio/authentication.rb', line 29

def logout(options_ro={})
  plugin, options = parse_opts(options_ro)
  return unless plugin
  Immunio.run_hook! plugin, "framework_logout", options
end

#password_reset(options_ro = {}) ⇒ Object

Call after a successful password reset has been requested for a user.



43
44
45
46
47
48
# File 'lib/immunio/authentication.rb', line 43

def password_reset(options_ro={})
  plugin, options = parse_opts(options_ro)
  return unless plugin
  options[:is_valid] = true
  Immunio.run_hook! plugin, "framework_password_reset", options
end

#set_user(options_ro = {}) ⇒ Object

Call after the current user is changed.



36
37
38
39
40
# File 'lib/immunio/authentication.rb', line 36

def set_user(options_ro={})
  plugin, options = parse_opts(options_ro)
  return unless plugin
  Immunio.run_hook! plugin, "framework_user", options
end