Skip to content

Commit 872647a

Browse files
committed
[Security] simplified code
1 parent 6d926c8 commit 872647a

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

src/Symfony/Component/Security/Http/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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy