]> git.evergreen-ils.org Git - evergreen/tadl.git/commit
Fix TPAC recognition of logged-in users via http
authorJeff Godin <jgodin@tadl.org>
Tue, 24 Jul 2012 06:23:17 +0000 (02:23 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 24 Jul 2012 15:13:28 +0000 (11:13 -0400)
commitaefe7cab325fe7d5803b542be3923dd36b17af06
treedab23bc7354f5f03251490cc6fa4110dd623ed5e
parent50bb90bf0d66dc86c1d7d56c967a05e688df5c55
Fix TPAC recognition of logged-in users via http

Fixes bug: LP 957375
tpac: catalog does not immediately recognize "stay logged in" users
https://bugs.launchpad.net/evergreen/+bug/957375

The issue: during the login process, the user is redirected to an
https connection and receives a cookie with the "secure" flag set.

Since this cookie is not sent over normal http connections,
following an external link or manually entering an http catalog url
will result in an unexpected "not logged in" experience.

Selecting the login link or any other action requiring login is
enough to return to the "logged in" experience, without a need to
re-enter credentials. Still, we can do better.

This affects users who have checked the persistent login checkbox
and those who have left it unchecked. Users selecting the persistent
login option are more likely to encounter the issue, especially if
the link they typically follow/enter is to a non-https catalog url.

The solution:

Add a new cookie (constant COOKIE_LOGGEDIN)
 - contains a "hint" that the user may be logged in already
 - set/cleared at login/logout time
 - contains no sensitive auth/session data
 - "secure" flag not set (sent for both http and https requests)

When a user's browser presents the COOKIE_LOGGEDIN cookie in a
request for a non-https URL, the user is automatically redirected to
the https version of that url.

At that time, if the user has a valid COOKIE_SES cookie set, they
will be recognized as a logged in user. If their COOKIE_SES value is
no longer valid, a logout is performed, clearing both cookies.

If for some reason the COOKIE_SES cookie is not present but the
COOKIE_LOGGEDIN is present, there is a harmless redirection to https
and the user is not logged in, but can log in via the usual means.

To test, after applying:
- log in to the TPAC
- navigate to http://example/eg/opac/home
- You should be redirected to https://example/eg/opac/home and you
  should see your name, count of checked out / on hold / etc items

Prior to this, the above steps would result in you remaining on the
http URL and seeing only a "Your Account Log In" button.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm