Method: J1WardenOmniAuth::Strategy#authenticate!

Defined in:
lib/j1_app/j1_auth_manager/warden_omniauth.rb

#authenticate!Object



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/j1_app/j1_auth_manager/warden_omniauth.rb', line 83

def authenticate!
  session = env[SESSION_KEY]
  session[SCOPE_KEY] = scope

  # set the user if exists otherwise redirect for authentication
  if user = (env['omniauth.auth'] || env['rack.auth'] || request['auth'])
    success! self.class.on_callback[user]
  else
    path_prefix = OmniAuth::Configuration.instance.path_prefix
    redirect! File.join(path_prefix, self.class.omni_name)
  end
end