Module: Pubcookie::ControllerHelper
- Defined in:
- lib/pubcookie/controller_helper.rb
Instance Method Summary collapse
-
#handle_pubcookie_ondemand(location = request.env["HTTP_REFERER"]) ⇒ Object
This sets the OnDemandKey cookie, which Apache uses to redirect to the login server.
Instance Method Details
#handle_pubcookie_ondemand(location = request.env["HTTP_REFERER"]) ⇒ Object
This sets the OnDemandKey cookie, which Apache uses to redirect to the login server. For the most part, you want “location” to be the referer (e.g. login redirect), but for pages protected by a :login_required filter, you want “location” to be request.url, thus it’s parameterized
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pubcookie/controller_helper.rb', line 9 def (location = request.env["HTTP_REFERER"]) response.headers["Cache-control"] = "no-store, no-cache, must-revalidate" response.headers["Expires"] = "Sat, 1 Jan 2000 01:01:01 GMT" response.headers["Set-Cookie"] = "OnDemandKey=ondemand; path=/" # make sure we redirect back to something sensible back = location || my_root_url || request.host # logger.debug "--- Handling login with pubcookie" # logger.debug "--- OnDemand redirect: " + back # logger.debug "--- location: " + location # logger.debug "--- referer: " + request.env["HTTP_REFERER"].to_s # logger.debug "--- my_root_url: " + my_root_url.to_s # logger.debug "--- host: " + request.host.to_s redirect_to ensure_ssl(back) end |