]> git.evergreen-ils.org Git - working/Evergreen.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:10:42 +0000 (11:10 -0400)
commitf16f7a84b73f83b6248560f212fddc1dd0c3b094
tree0be9862821a5641370be842f81e6a7548e32f37d
parent827c7f915a1175f663e4c9371e6883a3bb7784b1
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