Nick Lo wrote:
Hi Ralph,

$adapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'username', 'password');
$adapter->setIdentity('rschindler')
        ->setCredential('my password', 'PASSWORD(?)');
$result = $adapter->authenticate();

I got the above working quickly and easily, nice work.

I had been starting to work with Zend_Auth and Zend_Acl and was partly following some of the pointers put together by Simon Mundy.

On that note, In his implementation...

http://www.nabble.com/Zend_Auth_Adapter_Db-Table--tf3269367s16154.html

These adapters are intended to be used with Zend_Auth, so effectively, the above would really look like this:

// where _auth is an instance of Zend_Auth
$this->_auth->authenticate($adapter);

In the above, imagine that the instnace of Zend_Auth came from the bootstrap file, or the registry (if that is your method of transfering objects around).

...the identity is returned as a Zend_Db_Table_Row object rather than a string. I've mentioned before that I find the former much more useful and a few others echoed the same sentiment and I wonder if it could be possible here. It is especially relevant if you also do a strict check

This is possible:

if (Zend_Auth::getInstance()->authenticate($adapter)) {
    $result = $adapter->getResultRow();
    // $result; is now an assoc array
}

Does this suffice?  Does it need to be a Db_Table_Row object?

-Ralph

Reply via email to