Sha256: 9285dea17fefccab50d43a79c5c266be9095ffe4fd61b6298e4f972fbe1d5c83
Contents?: true
Size: 1.08 KB
Versions: 17
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 current_user_logout 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
17 entries across 17 versions & 1 rubygems