Hey! I can't authenticate using digest method with
Zend_Auth_Adapter_Http, I'm using zf 1.11.3 and this is my code:

// passwd.txt
jfalvarez:API:7cd98f0fc36d3504d6598cdcd3e7d76b // jfalvarez:API:test123456

// Http.php
http://pastie.org/1595020

// PartnersController.php
<?php

/**
 *
 * @author jfalvarez
 */
class Api_PartnersController extends Zend_Rest_Controller {
    /**
     *
     * @var App_Auth_Http
     */
    protected $_auth = null;

    public function init() {
        $this->_helper->viewRenderer->setNoRender( true );
        $this->_auth = new App_Auth_Http();
        var_dump( $this->_auth->authenticate() );
        exit();
    }
}

Authenticate always return:

object(Zend_Auth_Result)#213 (3) {
  ["_code":protected]=>
  int(-3)
  ["_identity":protected]=>
  array(0) {
  }
  ["_messages":protected]=>
  array(1) {
    [0]=>
    string(49) "Invalid or absent credentials; challenging client"
  }
}

Looking at Zend_Auth_Adapter_Http class, seems like 'Authorization'
was never sent, so always Zend_Auth_Adapter_Http#_challengeClient
method is returned, line # 384, I'm using curl to test, my curl
command:

curl --digest -u jfalvarez:test123456
http://192.168.1.190:10603/co/api/partners/index -v

This is the curl output:

jfalvarez@vbox-01:~$ curl --digest -u jfalvarez:test123456
http://192.168.1.190:10603/co/api/partners/index -v
* About to connect() to 192.168.1.190 port 10603 (#0)
*   Trying 192.168.1.190... connected
* Connected to 192.168.1.190 (192.168.1.190) port 10603 (#0)
* Server auth using Digest with user 'jfalvarez'
> GET /co/api/partners/index HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o 
> zlib/1.2.3.4 libidn/1.18
> Host: 192.168.1.190:10603
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 22 Feb 2011 19:15:36 GMT
< Server: Apache/2.2.16 (Ubuntu)
< X-Powered-By: PHP/5.3.3 ZendServer/5.0
< Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
< Set-Cookie: PHPSESSID=kjbbvcu215hm7g0tgndmq3bp84; path=/
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Set-Cookie: 192168119010603_locale=es_CO; expires=Thu, 24-Mar-2011
19:15:37 GMT; path=/
< Vary: Accept-Encoding
< Content-Length: 1234
< Content-Type: text/html
<
object(Zend_Auth_Result)#213 (3) {
  ["_code":protected]=>
  int(-3)
  ["_identity":protected]=>
  array(0) {
  }
  ["_messages":protected]=>
  array(1) {
    [0]=>
    string(49) "Invalid or absent credentials; challenging client"
  }
}
* Connection #0 to host 192.168.1.190 left intact
* Closing connection #0

Any help?

Thanks.

-- 
Juan Felipe Alvarez Saldarriaga
http://www.jfalvarez.com

Reply via email to