14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/devise_cas_authenticatable/single_sign_out.rb', line 14
def destroy_session_by_id(sid)
logger.debug "Single Sign Out from session store: #{current_session_store.class}"
if session_store_class.name =~ /ActiveRecord::SessionStore/
session = session_store_class::Session.find_by_session_id(sid)
session.destroy if session
true
elsif session_store_class.name =~ /ActionDispatch::Session::ActiveRecordStore/
session = current_session_store.session_class.find_by_session_id(sid)
session.destroy if session
true
elsif session_store_class.name =~ /ActionDispatch::Session::DalliStore/
current_session_store.send(:destroy_session, env, sid, drop: true)
true
elsif session_store_class.name =~ /RedisSessionStore/
current_session_store.send(:destroy_session, env, sid, drop: true)
true
elsif session_store_class.name =~ /Redis/
with_conn { |conn| conn.del(sid) }
true
elsif session_store_class.name =~ /CacheStore/
if current_session_store.respond_to?(:delete_session) current_session_store.delete_session({}, sid, {})
else
current_session_store.destroy_session({}, sid, {})
end
true
else
logger.error "Cannot process logout request because this Rails application's session store is "+
" #{session_store_class.name} and is not a support session store type for Single Sign-Out."
false
end
end
|