Zend_Auth_Adapter_Digest.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.auth.adapter.digest">
  4. <title>Digest Authentication</title>
  5. <sect2 id="zend.auth.adapter.digest.introduction">
  6. <title>Introduction</title>
  7. <para>
  8. <ulink url="http://en.wikipedia.org/wiki/Digest_access_authentication">Digest authentication</ulink>
  9. is a method of HTTP authentication that improves upon
  10. <ulink url="http://en.wikipedia.org/wiki/Basic_authentication_scheme">Basic authentication</ulink>
  11. by providing a way to authenticate without having to transmit the password in clear text across
  12. the network.
  13. </para>
  14. <para>
  15. This adapter allows authentication against text files containing lines having the basic elements
  16. of Digest authentication:
  17. <itemizedlist>
  18. <listitem>
  19. <para>
  20. username, such as "<code>joe.user</code>"
  21. </para>
  22. </listitem>
  23. <listitem>
  24. <para>
  25. realm, such as "<code>Administrative Area</code>"
  26. </para>
  27. </listitem>
  28. <listitem>
  29. <para>
  30. MD5 hash of the username, realm, and password, separated by colons
  31. </para>
  32. </listitem>
  33. </itemizedlist>
  34. The above elements are separated by colons, as in the following example (in which the password is
  35. "<code>somePassword</code>"):
  36. </para>
  37. <programlisting><![CDATA[
  38. someUser:Some Realm:fde17b91c3a510ecbaf7dbd37f59d4f8
  39. ]]></programlisting>
  40. </sect2>
  41. <sect2 id="zend.auth.adapter.digest.specifics">
  42. <title>Specifics</title>
  43. <para>
  44. The digest authentication adapter, <classname>Zend_Auth_Adapter_Digest</classname>, requires several input parameters:
  45. <itemizedlist>
  46. <listitem>
  47. <para>
  48. filename - Filename against which authentication queries are performed
  49. </para>
  50. </listitem>
  51. <listitem>
  52. <para>
  53. realm - Digest authentication realm
  54. </para>
  55. </listitem>
  56. <listitem>
  57. <para>
  58. username - Digest authentication user
  59. </para>
  60. </listitem>
  61. <listitem>
  62. <para>
  63. password - Password for the user of the realm
  64. </para>
  65. </listitem>
  66. </itemizedlist>
  67. These parameters must be set prior to calling <code>authenticate()</code>.
  68. </para>
  69. </sect2>
  70. <sect2 id="zend.auth.adapter.digest.identity">
  71. <title>Identity</title>
  72. <para>
  73. The digest authentication adapter returns a <classname>Zend_Auth_Result</classname> object, which has been
  74. populated with the identity as an array having keys of <code>realm</code> and
  75. <code>username</code>. The respective array values associated with these keys correspond to the
  76. values set before <code>authenticate()</code> is called.
  77. </para>
  78. <programlisting role="php"><![CDATA[
  79. $adapter = new Zend_Auth_Adapter_Digest($filename,
  80. $realm,
  81. $username,
  82. $password);
  83. $result = $adapter->authenticate();
  84. $identity = $result->getIdentity();
  85. print_r($identity);
  86. /*
  87. Array
  88. (
  89. [realm] => Some Realm
  90. [username] => someUser
  91. )
  92. */
  93. ]]></programlisting>
  94. </sect2>
  95. </sect1>
  96. <!--
  97. vim:se ts=4 sw=4 et:
  98. -->