Sha256: fbbe46529f640b6b0030d5581d032dd9af8132f8efa53c1478a6e44db4375e63
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
class SsoClyent::UserSessionsController < SsoClyent::ApplicationController before_filter :login_required, :only => [ :destroy ] respond_to :html # omniauth callback method def create omniauth = env['omniauth.auth'] logger.debug "+++ #{omniauth}" if user = user_klass.send("find_by_#{userid}", omniauth['uid']) user.respond_to?(:save) ? user.save : user.update else # New user registration user = user_klass.create({:"#{userid}" => omniauth['uid']}) end # Currently storing all the info session[:user_id] = omniauth flash[:notice] = "Successfully logged in" redirect_to SsoClyent.after_sign_in_path end # Omniauth failure callback def failure flash[:notice] = params[:message] end # logout - Clear our rack session BUT essentially redirect to the provider # to clean up the Devise session from there too ! def destroy session[:user_id] = nil flash[:notice] = 'You have successfully signed out!' redirect_to "#{OmniAuth::Strategies::Sso._provider[:url]}/logout?callback_url=#{root_url}" end private end
Version data entries
5 entries across 5 versions & 1 rubygems