module Rack::Cas::SessionStore::FileSystem
Public Instance Methods
delete_service_session_lookup(st)
click to toggle source
Removes a stored relationship between a ServiceTicket and a local Rails session id. This should be called when the session is being closed.
See store_service_session_lookup
.
# File lib/rack/cas_client.rb, line 44 def delete_service_session_lookup(st) st = st.ticket if st.kind_of? CASClient::ServiceTicket ssl_filename = filename_of_service_session_lookup(st) ::File.delete(ssl_filename) if ::File.exists?(ssl_filename) end
filename_of_service_session_lookup(st)
click to toggle source
Returns the path and filename of the service session lookup file.
# File lib/rack/cas_client.rb, line 51 def filename_of_service_session_lookup(st) st = st.ticket if st.kind_of? CASClient::ServiceTicket return "#{config[:session_dir]}/cas_sess.#{st}" end
read_service_session_lookup(st)
click to toggle source
Returns the local Rails session ID corresponding to the given ServiceTicket. This is done by reading the contents of the cas_sess.<session ticket> file created in a prior call to store_service_session_lookup
.
# File lib/rack/cas_client.rb, line 33 def read_service_session_lookup(st) st = st.ticket if st.kind_of? CASClient::ServiceTicket ssl_filename = filename_of_service_session_lookup(st) return ::File.exists?(ssl_filename) && IO.read(ssl_filename) end
store_service_session_lookup(st, sid)
click to toggle source
Creates a file in tmp/sessions linking a SessionTicket with the local Rails session id. The file is named cas_sess.<session ticket> and its text contents is the corresponding Rails session id. Returns the filename of the lookup file created.
# File lib/rack/cas_client.rb, line 21 def store_service_session_lookup(st, sid) st = st.ticket if st.kind_of? CASClient::ServiceTicket f = ::File.new(filename_of_service_session_lookup(st), 'w') f.write(sid) f.close return f.path end