2
0

Zend_Auth_Adapter_Digest.xml 3.9 KB

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