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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2001466-3-session-timeout-immediate-fix.patch | 1.12 KB | geerlingguy |
Comments
Comment #1
johnbarclay commentedComment #2
johnbarclay commentedComment #3
geerlingguy commentedThe original changes, as an actual patch.
Comment #4
johnbarclay commentedThanks. This is committed. Please keep reviewing.
Comment #5
johnbarclay commented