Class: OpenSesame::GithubAuth

Inherits:
OmniAuth::Strategies::GitHub
  • Object
show all
Defined in:
lib/open_sesame/github_auth.rb

Instance Method Summary collapse

Instance Method Details

#fail!(message_key, exception = nil) ⇒ Object

overrides OmniAuth::Strategy#fail!



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/open_sesame/github_auth.rb', line 11

def fail!(message_key, exception = nil)
  self.env['omniauth.error'] = exception
  self.env['omniauth.error.type'] = message_key.to_sym
  self.env['omniauth.error.strategy'] = self

  if exception
    log :error, "Authentication failure! #{message_key}: #{exception.class.to_s}, #{exception.message}"
  else
    log :error, "Authentication failure! #{message_key} encountered."
  end

  options.on_failure.call(self.env)
end