ZF-1114: Support for digest authentication in Zend_Http_Client
Description
Add support for digest authentication in Zend_Http_Client. Quote from a previous email of mine:
{quote}From what I can tell, the way the client currently works is that the end user specifies that they want to use basic or digest authentication, and then the client automatically sends an Authorization header, regardless of whether or not the server needs it. This isn't really the way it should work. The user should just specify their username and password, and upon the initial request, the server will respond with an authentication challenge (basic or digest) to authorize the user. This challenge dictates which authentication method is required by the server, and in the case of digest authentication, provides the variables needed to calculate the response.
Because there are server provided variables required to calculate the digest response, we can't just write out the Authorization header before any communication with the server has taken place, so the way the client currently works is unsuitable. Within the client, I think authentication should be handled in a similar way to redirects, where each server response is checked for an authentication challenge, and if provided, the client can automatically take care of it (so long as the user has provided a username and password).{quote}
Comments
Posted by Shahar Evron (shahar) on 2007-03-23T14:02:16.000+0000
note: look at the implementation of Zend_Auth_Http_Digest - I don't remember ever looking at it - might be useful ;)
Posted by Shahar Evron (shahar) on 2007-03-23T14:03:20.000+0000
Sorry - Zend_Auth_Adapter_Http that is
Posted by Jack Sleight (jacksleight) on 2007-03-24T14:55:42.000+0000
This is the sample script that contains all the functions needed for digest authentication, it currently runs externally from Zend_Http_Client, and is not intended to be Zend Framework ready code (comments are missing and the structure will change when integrated with Zend_Http_Client):
Posted by Jack Sleight (jacksleight) on 2007-03-24T14:58:05.000+0000
As is probably obvious, the __construct() and request() functions in the class above are only there for the purposes of the test script, and don't play any part in the actual calculation of the digest response.
Posted by Darby Felton (darby) on 2007-07-19T16:21:59.000+0000
Assigning to [~shahar] to clear unassigned issues.
Posted by Jack Sleight (jacksleight) on 2007-07-19T18:49:43.000+0000
Modified description to include a proposal for changing the authentication behaviour of Zend_Http_Client. Also, in the code above, the only functions actually relevant to receiving and responding to a digest authentication challenge are the calculateParams(), h() and kd() functions. The rest are merely there to allow the script to function, and some (splitHeader()) already exist in one form or another in the Zend_Http_Client (from what I remember).
Posted by Benjamin Eberlei (beberlei) on 2009-03-20T03:49:15.000+0000
Can this issue be closed in relation with ZF-3616? cURL supports Diggest authentication
Posted by Adam Lundrigan (adamlundrigan) on 2011-12-02T01:56:17.000+0000
As Benjamin asked nearly three years aog, is having HTTP Digest Authentication via {{Zend_Http_Client_Adapter_Curl}} sufficient? Or should we also implement it in the other adapters as applicable for the benefit of those amongst us not blessed with cURL?