0

I want to change the zendAuth GetIdentity function so that it updates the session before the result is returned. How would you go about doing this?

rockstardev
  • 13,479
  • 39
  • 164
  • 296

2 Answers2

0

You could create your own Authentication class based on Zend_Auth by putting it somewhere in your local library and overriding the getIdentity(), e.g.

class Local_Auth extends Zend_Auth{

    public function getIdentity()
    {
        $storage = $this->getStorage();

        if ($storage->isEmpty()) {
            return null;
        }

        return $storage->read();
    }
}

Then, instead of instantiation Zend_Auth in your Authentication Process, you'd just instantiate Local_Auth instead.

0
To Over Write getIdentity() in Authentication Class

Use  this Code,
Include this,

use Zend\Authentication,
Zend\Authentication\Result,
Zend\Authentication\AuthenticationService;

Create Instance for Authentication
$auth   = new AuthenticationService();

*****To Overwrite getStorage() in getIdentity()*****

$auth->getStorage()->write('Your Data');
Nandakumar
  • 1,071
  • 2
  • 11
  • 30