Browse Source

Removing code that does not actually belong to the Authentication
provider

Jose Lorenzo Rodriguez 12 years ago
parent
commit
c7adbe609d
2 changed files with 5 additions and 26 deletions
  1. 5 25
      src/Auth/BaseAuthenticate.php
  2. 0 1
      tests/TestCase/Auth/FormAuthenticateTest.php

+ 5 - 25
src/Auth/BaseAuthenticate.php

@@ -73,16 +73,12 @@ abstract class BaseAuthenticate {
 	protected $_passwordHasher;
 
 /**
- * Contains a key indicated whether or not the user authenticated by this class
+ * Whether or not the user authenticated by this class
  * requires their password to be rehashed with another algorithm.
  *
- * @var array
+ * @var bool
  */
-	protected $passwordInfo = [
-		'password' => null,
-		'needsRehash' => false
-	];
-
+	protected $_needsPasswordRehash = false;
 /**
  * Constructor
  *
@@ -140,8 +136,7 @@ abstract class BaseAuthenticate {
 				return false;
 			}
 
-			$this->_passwordInfo['password'] = $password;
-			$this->_passwordInfo['needsRehash'] = $hasher->needsRehash($hashedPassword);
+			$this->_needsPasswordRehash = $hasher->needsRehash($hashedPassword);
 			unset($result[$fields['password']]);
 		}
 
@@ -171,22 +166,7 @@ abstract class BaseAuthenticate {
  * @return bool
  */
 	public function needsPasswordRehash() {
-		return $this->_passwordInfo['needsRehash'];
-	}
-
-/**
- * Returns a freshly hashed password using the hashing alogrithm from the configured
- * password hasher. This method uses the plain password provided when successfully
- * authenticating the user.
- *
- * @return string
- * @throws \RuntimeException if no user has been authenticated using this object
- */
-	public function rehashPassword() {
-		if ($this->_passwordInfo['password'] === null) {
-			throw new \RuntimeException('No user has been authenticated using this provider');
-		}
-		return $this->passwordHasher()->hash($this->_passwordInfo['password']);
+		return $this->_needsPasswordRehash;
 	}
 
 /**

+ 0 - 1
tests/TestCase/Auth/FormAuthenticateTest.php

@@ -347,7 +347,6 @@ class FormAuthenticateTest extends TestCase {
 		$result = $this->auth->authenticate($request, $this->response);
 		$this->assertNotEmpty($result);
 		$this->assertTrue($this->auth->needsPasswordRehash());
-		$this->assertSame($password, $this->auth->rehashPassword());
 	}
 
 }