Hi,
i am new to zend, have been following the tutorial in the manual to initiate
Zend Auth with http
my problem is when i write the code, nothing happens, and no authentication
window pops from the browser or anything.
can anyone help me plz

here is my code inside the indexController :


<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action 
{
        /**
         * The default action - show the home page
         */
    public function indexAction() 
    {
        // TODO Auto-generated IndexController::indexAction() action
        $this->view->title = "Welcome";
        
       $config = array(
    'accept_schemes' => 'basic',
    'realm'          => 'My Web Site',
);
require_once 'Zend/Auth/Adapter/Http.php';
$adapter = new Zend_Auth_Adapter_Http($config);
require_once 'Zend/Auth/Adapter/Http/Resolver/File.php';

$basicResolver = new Zend_Auth_Adapter_Http_Resolver_File();
$basicResolver->setFile('passwords.txt');

//$digestResolver = new Zend_Auth_Adapter_Http_Resolver_File();
//$digestResolver->setFile('files/digestPasswd.txt');

$adapter->setBasicResolver($basicResolver);
//$adapter->setDigestResolver($digestResolver);

$request = new Zend_Controller_Request_Http();
$response = new Zend_Controller_Response_Http();

$adapter->setRequest($request);
$adapter->setResponse($response);

$result = $adapter->authenticate();
echo "<pre>";
print_r($result);
if (!$result->isValid()) {
    // Bad userame/password, or canceled password prompt
    echo "hi";
}else{
        echo "no";
}
        
    }
}



and here is the contents of my passwords.txt

ahmed:realm:medo



i also printed the $result as u see in my code
and that was the output :

Zend_Auth_Result Object
(
    [_code:protected] => -3
    [_identity:protected] => Array
        (
        )

    [_messages:protected] => Array
        (
            [0] => Invalid or absent credentials; challenging client
        )

)


-- 
View this message in context: 
http://www.nabble.com/Zend_Auth-Problem-tp16608811p16608811.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to