15
15
App::import ('Component ' , 'auth/base_authenticate ' );
16
16
App::import ('Core ' , 'String ' );
17
17
18
-
18
+ /**
19
+ * Digest Authentication adapter for AuthComponent.
20
+ *
21
+ * Provides Digest HTTP authentication support for AuthComponent. Unlike most AuthComponent adapters,
22
+ * DigestAuthenticate requires a special password hash that conforms to RFC2617. You can create this
23
+ * password using `DigestAuthenticate::password()`. If you wish to use digest authentication alongside other
24
+ * authentication methods, its recommended that you store the digest authentication separately.
25
+ *
26
+ * Clients using Digest Authentication must support cookies. Since AuthComponent identifies users based
27
+ * on Session contents, clients without support for cookies will not function properly.
28
+ *
29
+ * ### Using Digest auth
30
+ *
31
+ * In your controller's components array, add auth + the required settings.
32
+ * {{{
33
+ * var $components = array(
34
+ * 'Auth' => array(
35
+ * 'authenticate' => array('Digest')
36
+ * )
37
+ * );
38
+ * }}}
39
+ *
40
+ * In your login function just call `$this->Auth->login()` without any checks for POST data. This
41
+ * will send the authentication headers, and trigger the login dialog in the browser/client.
42
+ *
43
+ * ### Generating passwords compatible with Digest authentication.
44
+ *
45
+ * Due to the Digest authentication specification, digest auth requires a special password value. You
46
+ * can generate this password using `DigestAuthenticate::password()`
47
+ *
48
+ * `$digestPass = DigestAuthenticate::password($username, env('SERVER_NAME'), $password);`
49
+ *
50
+ * Its recommended that you store this digest auth only password separate from password hashes used for other
51
+ * login methods. For example `User.digest_pass` could be used for a digest password, while `User.password` would
52
+ * store the password hash for use with other methods like Basic or Form.
53
+ *
54
+ * @package cake.libs.controller.components.auth
55
+ * @since 2.0
56
+ */
19
57
class DigestAuthenticate extends BaseAuthenticate {
20
58
/**
21
59
* Settings for this object.
@@ -24,6 +62,10 @@ class DigestAuthenticate extends BaseAuthenticate {
24
62
* - `userModel` The model name of the User, defaults to User.
25
63
* - `scope` Additional conditions to use when looking up and authenticating users,
26
64
* i.e. `array('User.is_active' => 1).`
65
+ * - `realm` The realm authentication is for, Defaults to the servername.
66
+ * - `nonce` A nonce used for authentication. Defaults to `uniqid()`.
67
+ * - `qop` Defaults to auth, no other values are supported at this time.
68
+ * - `opaque` A string that must be returned unchanged by clients. Defaults to `md5($settings['realm'])`
27
69
*
28
70
* @var array
29
71
*/
@@ -43,6 +85,7 @@ class DigestAuthenticate extends BaseAuthenticate {
43
85
/**
44
86
* Constructor, completes configuration for digest authentication.
45
87
*
88
+ * @param array $settings An array of settings.
46
89
* @return void
47
90
*/
48
91
public function __construct ($ settings ) {
0 commit comments