canvas-lms/app/middleware
James Williams 568976fbc7 change encrypted cookie store to fix session timeout plugin
moves the load account and session timeout plugin middleware
 to set the expire_after before the session store is called,
and changes encrypted_cookie_store to use that option so it can
invalidate expired sessions when it unmarshals the data
for the first time.

The reason it seemed to work locally is because it sets
@options[:expire_after] after the first request.
Unfortunately this second time doesn't often happen
in the actual application when distributed amongst several
instances.

test plan:
* set the "Sessions" plugin settings to timeout after
1 minute using the following console commands;

ps = PluginSetting.
find_or_create_by_name_and_account_id("sessions",
Account.default)
ps.settings = {"session_timeout" => "1"}
ps.disabled = false
ps.save!

* (Note: normally this would be done
by going through the plugin settings ui, however, it enforces
a minimum of 20 minutes, which is difficult to test with)

* start the server and log-in
* shut down the server
* wait for 1 minute for the session to time out
* restart the server and try to click a link
* should be redirected to the log-in page

fixes #CNVS-7870

Change-Id: I843b73da7d3c001f7e632b1454c63f9d6c07f73d
Reviewed-on: https://gerrit.instructure.com/26911
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2013-12-05 21:08:50 +00:00
..
load_account.rb start adding rails 3.0 support 2013-03-22 19:08:40 +00:00
prevent_non_multipart_parse.rb sis import api 2011-04-08 15:45:57 -06:00
sessions_timeout.rb change encrypted cookie store to fix session timeout plugin 2013-12-05 21:08:50 +00:00
stats_timing.rb remove the account.* statsd logging 2012-10-10 11:10:22 -06:00