public function authenticate(Zend_Auth_Adapter_Interface $adapter)
    {
        // Authenticates against the supplied adapter.
        $result = $adapter->authenticate();

        /*
         * ZF-7546 - prevent multiple succesive calls from storing inconsistent
         * results.
         *
         * Ensure storage has clean state.
         */
        if ($this->hasIdentity()) {
            $this->clearIdentity();
        }

        if ($result->isValid()) {
            $this->getStorage()
                ->write($adapter->getResultRowObject());
        }

        return $result;
    }