Skip to content

Commit 7a96fdd

Browse files
committed
[Security] simplified code
1 parent fc23280 commit 7a96fdd

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

RememberMe/TokenBasedRememberMeServices.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
5454
throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user)));
5555
}
5656

57-
if (true !== $this->compareHashes($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) {
57+
if (true !== StringUtils::equals($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) {
5858
throw new AuthenticationException('The cookie\'s hash is invalid.');
5959
}
6060

@@ -65,22 +65,6 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
6565
return $user;
6666
}
6767

68-
/**
69-
* Compares two hashes using a constant-time algorithm to avoid (remote)
70-
* timing attacks.
71-
*
72-
* This is the same implementation as used in the BasePasswordEncoder.
73-
*
74-
* @param string $hash1 The first hash
75-
* @param string $hash2 The second hash
76-
*
77-
* @return Boolean true if the two hashes are the same, false otherwise
78-
*/
79-
private function compareHashes($hash1, $hash2)
80-
{
81-
return StringUtils::equals($hash1, $hash2);
82-
}
83-
8468
/**
8569
* {@inheritDoc}
8670
*/

0 commit comments

Comments
 (0)