PEAR::AUTH many problems; idle timeout, multiple logins required; does anyone really use it?

From: Date: Wed, 07 Sep 2005 14:05:42 +0000
Subject: PEAR::AUTH many problems; idle timeout, multiple logins required; does anyone really use it?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20862@lists.php.net to get a copy of this message
I have been trying to use the PEAR::Auth package, but have been have a number of problems. I was wondering if these problems are well known or not and if so how anyone uses the package. I've searched the mail list archive, but I haven't found any recent relevant problems. I've made sure that both PEAR and Auth are up to date. First off, the biggest problem is, after logging in to one restricted page, the user is required to login a second time if they go to another restricted page. This doesn't seem right - am I missing something? Here is the code: Page one: require_once 'myAuth.php'; // defines loginFunction, params,
			      // & dumpAgent
$agent = new Auth("DB", $params, "loginFunction"); echo "<br />Quick check: "; dumpAgent($agent); $agent->start(); if($agent->checkAuth()){ blah blah blah... // form calls page two.php to handle form data } Page two: require_once 'myAuth.php'; // First make sure logged in... $agent = new Auth("DB", $params, "loginFunction"); $agent->start(); echo "<br />Quick check: "; dumpAgent($agent); echo "<br />End quick check "; if($agent->checkAuth()){ // Handle form data from page one blah blah blah... } So the user is required to login before seeing the form on page one, then the user is required to login again after submitting the form and calling page two. Once both pages have been logged in to, the user can go back and forth without having to login again. What am I missing? Second issue is the idle timeout doesn't seem to work. I've set the idle timeout limit for 5 minutes, walked away for an hour. After returning the account has not been idled out, or at least I'm not required to log back in. Finally while trying to debug this problem, I've found what I presume is a bug. The dumpAgent function I refer to above does a formated dump of the agent object. It appears that there is a recursive reference to the agent object in Auth.php on line 198. The line is: $this->storage->_auth_obj =& $this; If I comment out the line, the recursive self reference disappears, but it doesn't appear to fix any of my other problems. There is a cryptic comment above line 198, it is: // Pass a reference to auth to the container, ugly but works // this is used by the DB container to use method setAuthData not statically. Does anyone know what this does? I question the comment about it working, but it isn't clear to me what it is supposed to be doing. At the very least it increases the size of the auth object by many, many factors. Is the Auth package really used? I've seen PHP security references recommending using Auth instead of writing ones own because it will be more secure. I question that seeing as how buggy it appears to be. Even if I'm misusing it, at the very least the documentation should be improved so users do not misuse it. Any help? Cheers, Matt

« previous php.pear.general (#20862) next »