public function authenticate()
    {
        $optionsRequired = array('filename', 'realm', 'username', 'password');
        foreach ($optionsRequired as $optionRequired) {
            if (null === $this->{"_$optionRequired"}) {
                /**
                 * @see Zend_Auth_Adapter_Exception
                 */
                require_once 'Zend/Auth/Adapter/Exception.php';
                throw new Zend_Auth_Adapter_Exception("Option '$optionRequired' must be set before authentication");
            }
        }

        if (false === ($fileHandle = @fopen($this->_filename, 'r'))) {
            /**
             * @see Zend_Auth_Adapter_Exception
             */
            require_once 'Zend/Auth/Adapter/Exception.php';
            throw new Zend_Auth_Adapter_Exception("Cannot open '$this->_filename' for reading");
        }

        $id       = "$this->_username:$this->_realm";
        $idLength = strlen($id);

        $result = array(
            'code'  => Zend_Auth_Result::FAILURE,
            'identity' => array(
                'realm'    => $this->_realm,
                'username' => $this->_username,
                ),
            'messages' => array()
            );

        while ($line = trim(fgets($fileHandle))) {
            if (substr($line, 0, $idLength) === $id) {
                if ($this->_secureStringCompare(substr($line, -32), md5("$this->_username:$this->_realm:$this->_password"))) {
                    $result['code'] = Zend_Auth_Result::SUCCESS;
                } else {
                    $result['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
                    $result['messages'][] = 'Password incorrect';
                }
                return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
            }
        }

        $result['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
        $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found";
        return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
    }
public function authenticate()
    {
        $optionsRequired = array('filename', 'realm', 'username', 'password');
        foreach ($optionsRequired as $optionRequired) {
            if (null === $this->{"_$optionRequired"}) {
                /**
                 * @see Zend_Auth_Adapter_Exception
                 */
                require_once 'Zend/Auth/Adapter/Exception.php';
                throw new Zend_Auth_Adapter_Exception("Option '$optionRequired' must be set before authentication");
            }
        }

        if (false === ($fileHandle = @fopen($this->_filename, 'r'))) {
            /**
             * @see Zend_Auth_Adapter_Exception
             */
            require_once 'Zend/Auth/Adapter/Exception.php';
            throw new Zend_Auth_Adapter_Exception("Cannot open '$this->_filename' for reading");
        }

        $id       = "$this->_username:$this->_realm";
        $idLength = strlen($id);

        $result = array(
            'code'  => Zend_Auth_Result::FAILURE,
            'identity' => array(
                'realm'    => $this->_realm,
                'username' => $this->_username,
                ),
            'messages' => array()
            );

        while ($line = trim(fgets($fileHandle))) {
            if (substr($line, 0, $idLength) === $id) {
                if ($this->_secureStringCompare(substr($line, -32), md5("$this->_username:$this->_realm:$this->_password"))) {
                    $result['code'] = Zend_Auth_Result::SUCCESS;
                } else {
                    $result['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
                    $result['messages'][] = 'Password incorrect';
                }
                return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
            }
        }

        $result['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
        $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found";
        return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
    }
public function authenticate ( ) { $ optionsRequired = array ( 'filename' , 'realm' , 'username' , 'password' ) ; foreach ( $ optionsRequired as $ optionRequired ) { if ( null === $ this -> { "_$optionRequired" } ) { /**
                 * @see Zend_Auth_Adapter_Exception
                 */ require_once 'Zend/Auth/Adapter/Exception.php' ; throw new Zend_Auth_Adapter_Exception ( "Option '$optionRequired' must be set before authentication" ) ; } } if ( false === ( $ fileHandle = @ fopen ( $ this -> _filename , 'r' ) ) ) { /**
             * @see Zend_Auth_Adapter_Exception
             */ require_once 'Zend/Auth/Adapter/Exception.php' ; throw new Zend_Auth_Adapter_Exception ( "Cannot open '$this->_filename' for reading" ) ; } $ id = "$this->_username:$this->_realm" ; $ idLength = strlen ( $ id ) ; $ result = array ( 'code' => Zend_Auth_Result :: FAILURE , 'identity' => array ( 'realm' => $ this -> _realm , 'username' => $ this -> _username , ) , 'messages' => array ( ) ) ; while ( $ line = trim ( fgets ( $ fileHandle ) ) ) { if ( substr ( $ line , 0 , $ idLength ) === $ id ) { if ( $ this -> _secureStringCompare ( substr ( $ line , - 32 ) , md5 ( "$this->_username:$this->_realm:$this->_password" ) ) ) { $ result [ 'code' ] = Zend_Auth_Result :: SUCCESS ; } else { $ result [ 'code' ] = Zend_Auth_Result :: FAILURE_CREDENTIAL_INVALID ; $ result [ 'messages' ] [ ] = 'Password incorrect' ; } return new Zend_Auth_Result ( $ result [ 'code' ] , $ result [ 'identity' ] , $ result [ 'messages' ] ) ; } } $ result [ 'code' ] = Zend_Auth_Result :: FAILURE_IDENTITY_NOT_FOUND ; $ result [ 'messages' ] [ ] = "Username '$this->_username' and realm '$this->_realm' combination not found" ; return new Zend_Auth_Result ( $ result [ 'code' ] , $ result [ 'identity' ] , $ result [ 'messages' ] ) ; }
Defined by Zend_Auth_Adapter_Interface

@throws Zend_Auth_Adapter_Exception
@return Zend_Auth_Result
Defined by Zend_Auth_Adapter_Interface