From d5f5ae3271e3915abe4c5f4d2c4d67bb4e22d2d4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 22 Jan 2011 15:46:21 -0500 Subject: [PATCH] Fixing typo where realm would be wrong if not specified. --- .../controller/components/auth/digest_authenticate.php | 2 +- .../components/auth/digest_authenticate.test.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cake/libs/controller/components/auth/digest_authenticate.php b/cake/libs/controller/components/auth/digest_authenticate.php index 10212f1a0a9..9e425f87ae6 100644 --- a/cake/libs/controller/components/auth/digest_authenticate.php +++ b/cake/libs/controller/components/auth/digest_authenticate.php @@ -51,7 +51,7 @@ public function __construct($settings) { $this->settings['realm'] = env('SERVER_NAME'); } if (empty($this->settings['nonce'])) { - $this->settings['realm'] = uniqid(''); + $this->settings['nonce'] = uniqid(''); } if (empty($this->settings['opaque'])) { $this->settings['opaque'] = md5($this->settings['realm']); diff --git a/cake/tests/cases/libs/controller/components/auth/digest_authenticate.test.php b/cake/tests/cases/libs/controller/components/auth/digest_authenticate.test.php index 4709890be3c..08cba463b69 100644 --- a/cake/tests/cases/libs/controller/components/auth/digest_authenticate.test.php +++ b/cake/tests/cases/libs/controller/components/auth/digest_authenticate.test.php @@ -292,4 +292,14 @@ function testParseAuthEmailAddress() { $this->assertIdentical($expected, $result); } +/** + * test password hashing + * + * @return void + */ + function testPassword() { + $result = DigestAuthenticate::password('mark', 'localhost', 'password'); + $expected = md5('mark:localhost:password'); + $this->assertEquals($expected, $result); + } } \ No newline at end of file