module Katello::UrlConstrainedCookieStoreV30X
Public Instance Methods
call(env)
click to toggle source
This is almost entirely based on ActionDispatch::Session::AbstractStore#call. Unfortunately, there isn't a good way not to duplicate all this logic.
# File lib/katello/url_constrained_cookie_store.rb, line 4 def call(env) prepare!(env) response = @app.call(env) session_data = env[ActionDispatch::Session::AbstractStore::ENV_SESSION_KEY] options = env[ActionDispatch::Session::AbstractStore::ENV_SESSION_OPTIONS_KEY] if !session_data.is_a?(ActionDispatch::Session::AbstractStore::SessionHash) || session_data.loaded? || options[:expire_after] session_data.send(:load!) if session_data.is_a?(ActionDispatch::Session::AbstractStore::SessionHash) && !session_data.loaded? sid = options[:id] || generate_sid session_data = session_data.to_hash value = set_session(env, sid, session_data) return response unless value request = ActionDispatch::Request.new(env) cookie = create_cookie(request, value, options) set_cookie(request, cookie.merge!(options)) end response end