Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at:
Digest Authentication — Zend Framework 2 2.4.9 documentation
Digest authentication is a method of HTTP authentication that improves upon Basic authentication by providing a way to authenticate without having to transmit the password in clear text across the network.
This adapter allows authentication against text files containing lines having the basic elements of Digest authentication:
The above elements are separated by colons, as in the following example (in which the password is “somePassword”):
The digest authentication adapter, Zend\Authentication\Adapter\Digest, requires several input parameters:
These parameters must be set prior to calling authenticate().
The digest authentication adapter returns a Zend\Authentication\Result object, which has been populated with the identity as an array having keys of realm and username. The respective array values associated with these keys correspond to the values set before authenticate() is called.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use Zend\Authentication\Adapter\Digest as AuthAdapter; $adapter = new AuthAdapter($filename, $realm, $username, $password); $result = $adapter->authenticate(); $identity = $result->getIdentity(); print_r($identity); /* Array ( [realm] => Some Realm [username] => someUser ) */