Class: Freddie::Handlers::OmniAuth

Inherits:
Base
  • Object
show all
Defined in:
lib/freddie/handlers.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #block, #env

Instance Method Summary collapse

Methods inherited from Base

#after_perform, #before_perform, #call, call, #context, #finish!, #finished?, #initialize, #layout, #method_missing, #params, #perform_freddie_block, #request, #response, #session

Constructor Details

This class inherits a constructor from Freddie::Handlers::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Freddie::Handlers::Base

Instance Method Details

#performObject



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/freddie/handlers.rb', line 231

def perform
  options = args.shift || {}

  options = {
    session_key: :omniauth_user,
    redirect_to: '/'
  }.merge(options)

  path('auth') do
    path(:provider) do
      path('callback') do
        auth = env['omniauth.auth']
        session[options[:session_key]] = [auth['provider'], auth['uid']]
        redirect_to options[:redirect_to]
      end
    end
  end
end