Coding Samples, Tutorials, Code Snippets, Articles, How-To`s - From Beginners to Expert. Stay tuned.
Share your knowledge. Regardless what experience you have made with the Zend Framework - Let all benefit.

Search Manual:

Please Sign in or Register

Available Languages

 


Manual for Zend Framework 1.0.3

3.3. Digest Authentication

3.3.1. Introduction

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:

  • username, such as "joe.user"

  • realm, such as "Administrative Area"

  • MD5 hash of the username, realm, and password, separated by colons

The above elements are separated by colons, as in the following example (in which the password is "somePassword"):

someUser:Some Realm:fde17b91c3a510ecbaf7dbd37f59d4f8

3.3.2. Specifics

The digest authentication adapter, Zend_Auth_Adapter_Digest, requires several input parameters:

  • filename - Filename against which authentication queries are performed

  • realm - Digest authentication realm

  • username - Digest authentication user

  • password - Password for the user of the realm

These parameters must be set prior to calling authenticate().

3.3.3. Identity

The digest authentication adapter returns a Zend_Auth_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.

<?php
require_once 'Zend/Auth/Adapter/Digest.php';

$adapter = new Zend_Auth_Adapter_Digest($filename, $realm, $username, $password);

$result = $adapter->authenticate();

$identity = $result->getIdentity();

print_r($identity);

/*
Array
(
    [realm] => Some Realm
    [username] => someUser
)
*/
        

Welcome!

Welcome to ZFResource - The Resource for the Zend Framework.
As you see, the website is in still in progress. Many features ( like Code Directory, Code Samples, User written Tutorials, Examples and News,...) will be online in near future.
At the moment, you can search and browse the manual in your language of choice. Don't forget to come back later to benefit from the new features.


Help Wanted:

We are still searching for people want to help building this site. If you want to see this website in your language or you have any suggestions for this site please send us an email