I had a problem when autologin with kerberos failed - and having chosen cookie timeout set to immediately.

I would like to be able to tell people to just log out and log in again (so windows will get new kerberos ticket) - but that would not clear the cookie, so ldap_sso would not try to log them in automaticly again, if the cookie lifetime was not set to immediately.

Problem with how setting it to immediately, is that the code translates that to time() + 0 - which litereally means NOW - which again means they'll be redirected to the login constantly, so users who may not need to login - could not use the website :(

I fixed this, by removing the time() part - when immediately is chosen - so it becomes a session cookie, that only lives as long as the browser is open.

Here's the patch - it works a charm here:
--- ldap-7.x-2.0-beta4/ldap_sso/ldap_sso.module 2013-03-28 13:10:52.000000000 +0100
+++ ldap-7.x-2.0-beta4-fixcookietimeout/ldap_sso/ldap_sso.module 2013-05-23 11:17:50.364742746 +0200
@@ -66,6 +66,9 @@
$ldap_authentication_conf = variable_get('ldap_authentication_conf', array());

if (isset($ldap_authentication_conf['seamlessLogin']) && $ldap_authentication_conf['seamlessLogin'] == 1 && ($login_attempted != 'true')) {
+ if ( $ldap_authentication_conf['cookieExpire'] == 0)
+ setcookie("seamless_login_attempted", 'true', 0, base_path(), "");
+ else
setcookie("seamless_login_attempted", 'true', time() + (int)$ldap_authentication_conf['cookieExpire'], base_path(), "");
$_SESSION['seamless_login_attempted'] = $login_attempted;
// removed with http://drupal.org/node/1485118 patch

Comments

johnbarclay’s picture

Version: 7.x-2.0-beta4 » 7.x-2.x-dev
johnbarclay’s picture

Status: Active » Needs review
geerlingguy’s picture

Title: session timeout is immediately instead of session cookie » Session timeout is immediate instead of session cookie, causing infinite redirect loop
StatusFileSize
new1.12 KB

The original changes, as an actual patch.

johnbarclay’s picture

Title: Session timeout is immediate instead of session cookie, causing infinite redirect loop » LDAP SSO: Session timeout is immediate instead of session cookie, causing infinite redirect loop

Thanks. This is committed. Please keep reviewing.

johnbarclay’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.