1
0
Fork 0
forked from OpenNeo/impress
impress/lib/openneo-auth/strategy.rb

28 lines
570 B
Ruby

require 'devise'
module Openneo
module Auth
module Strategies
class Token < Devise::Strategies::Authenticatable
def valid?
session && session[:session_id]
end
def authenticate!
begin
auth_session = Session.find session[:session_id]
rescue Session::NotFound => e
pass
else
auth_session.destroy!
success! auth_session.user
end
end
def remember_me?
true
end
end
end
end
end