Skip to content

Commit 9d6057c

Browse files
committed
removed usage of the deprecated StringUtils::equals() method
1 parent 8702559 commit 9d6057c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Firewall/DigestAuthenticationListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Security\Http\Firewall;
1313

1414
use Symfony\Component\Security\Core\User\UserProviderInterface;
15-
use Symfony\Component\Security\Core\Util\StringUtils;
1615
use Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint;
1716
use Psr\Log\LoggerInterface;
1817
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -100,7 +99,7 @@ public function handle(GetResponseEvent $event)
10099
return;
101100
}
102101

103-
if (!StringUtils::equals($serverDigestMd5, $digestAuth->getResponse())) {
102+
if (!hash_equals($serverDigestMd5, $digestAuth->getResponse())) {
104103
if (null !== $this->logger) {
105104
$this->logger->debug('Unexpected response from the DigestAuth received; is the header returning a clear text passwords?', array('expected' => $serverDigestMd5, 'received' => $digestAuth->getResponse()));
106105
}

RememberMe/PersistentTokenBasedRememberMeServices.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2222
use Symfony\Component\Security\Core\Util\SecureRandomInterface;
2323
use Psr\Log\LoggerInterface;
24-
use Symfony\Component\Security\Core\Util\StringUtils;
2524

2625
/**
2726
* Concrete implementation of the RememberMeServicesInterface which needs
@@ -94,7 +93,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
9493
list($series, $tokenValue) = $cookieParts;
9594
$persistentToken = $this->tokenProvider->loadTokenBySeries($series);
9695

97-
if (!StringUtils::equals($persistentToken->getTokenValue(), $tokenValue)) {
96+
if (!hash_equals($persistentToken->getTokenValue(), $tokenValue)) {
9897
throw new CookieTheftException('This token was already used. The account is possibly compromised.');
9998
}
10099

0 commit comments

Comments
 (0)