summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2014-02-22 08:00:45 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2014-02-22 08:00:45 +0100
commit7e51986698464365c2adaeb0fdff2e6ec9742db8 (patch)
treec0cfd9e3763ab3e47e86ee7c126e5222a9067e12
parent3711f7b58bdb10dcdf3bf9622a03fa9dee459270 (diff)
downloadsymfony-security-7e51986698464365c2adaeb0fdff2e6ec9742db8.zip
symfony-security-7e51986698464365c2adaeb0fdff2e6ec9742db8.tar.gz
symfony-security-7e51986698464365c2adaeb0fdff2e6ec9742db8.tar.bz2
[Security] simplified code
-rw-r--r--Http/RememberMe/TokenBasedRememberMeServices.php18
1 files changed, 1 insertions, 17 deletions
diff --git a/Http/RememberMe/TokenBasedRememberMeServices.php b/Http/RememberMe/TokenBasedRememberMeServices.php
index f3a39fe..6fd6bc4 100644
--- a/Http/RememberMe/TokenBasedRememberMeServices.php
+++ b/Http/RememberMe/TokenBasedRememberMeServices.php
@@ -54,7 +54,7 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user)));
}
- if (true !== $this->compareHashes($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) {
+ if (true !== StringUtils::equals($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) {
throw new AuthenticationException('The cookie\'s hash is invalid.');
}
@@ -66,22 +66,6 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
}
/**
- * Compares two hashes using a constant-time algorithm to avoid (remote)
- * timing attacks.
- *
- * This is the same implementation as used in the BasePasswordEncoder.
- *
- * @param string $hash1 The first hash
- * @param string $hash2 The second hash
- *
- * @return Boolean true if the two hashes are the same, false otherwise
- */
- private function compareHashes($hash1, $hash2)
- {
- return StringUtils::equals($hash1, $hash2);
- }
-
- /**
* {@inheritDoc}
*/
protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token)