Zend_Auth_Adapter_Digest.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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
  9. authentication</ulink> is a method of HTTP authentication that improves upon
  10. <ulink url="http://en.wikipedia.org/wiki/Basic_authentication_scheme">Basic
  11. authentication</ulink> by providing a way to authenticate without having to
  12. transmit the password in clear text across the network.
  13. </para>
  14. <para>
  15. This adapter allows authentication against text files containing lines having the basic
  16. elements of Digest authentication:
  17. <itemizedlist>
  18. <listitem>
  19. <para>
  20. username, such as "<emphasis>joe.user</emphasis>"
  21. </para>
  22. </listitem>
  23. <listitem>
  24. <para>
  25. realm, such as "<emphasis>Administrative Area</emphasis>"
  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
  35. password is "<emphasis>somePassword</emphasis>"):
  36. </para>
  37. <programlisting language="txt"><![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>,
  45. requires several input parameters:
  46. <itemizedlist>
  47. <listitem>
  48. <para>
  49. filename - Filename against which authentication queries are performed
  50. </para>
  51. </listitem>
  52. <listitem>
  53. <para>
  54. realm - Digest authentication realm
  55. </para>
  56. </listitem>
  57. <listitem>
  58. <para>
  59. username - Digest authentication user
  60. </para>
  61. </listitem>
  62. <listitem>
  63. <para>
  64. password - Password for the user of the realm
  65. </para>
  66. </listitem>
  67. </itemizedlist>
  68. These parameters must be set prior to calling <methodname>authenticate()</methodname>.
  69. </para>
  70. </sect2>
  71. <sect2 id="zend.auth.adapter.digest.identity">
  72. <title>Identity</title>
  73. <para>
  74. The digest authentication adapter returns a <classname>Zend_Auth_Result</classname>
  75. object, which has been populated with the identity as an array having keys of
  76. <emphasis>realm</emphasis> and <emphasis>username</emphasis>. The respective array
  77. values associated with these keys correspond to the values set before
  78. <methodname>authenticate()</methodname> is called.
  79. </para>
  80. <programlisting language="php"><![CDATA[
  81. $adapter = new Zend_Auth_Adapter_Digest($filename,
  82. $realm,
  83. $username,
  84. $password);
  85. $result = $adapter->authenticate();
  86. $identity = $result->getIdentity();
  87. print_r($identity);
  88. /*
  89. Array
  90. (
  91. [realm] => Some Realm
  92. [username] => someUser
  93. )
  94. */
  95. ]]></programlisting>
  96. </sect2>
  97. </sect1>
  98. <!--
  99. vim:se ts=4 sw=4 et:
  100. -->