Skip to content

Commit 098afc3

Browse files
committed
WSSE Auth: Timing safe comparison
1 parent e9d317a commit 098afc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cookbook/security/custom_authentication_provider.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ the ``PasswordDigest`` header value matches with the user's password.
201201
use Symfony\Component\Security\Core\Exception\AuthenticationException;
202202
use Symfony\Component\Security\Core\Exception\NonceExpiredException;
203203
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
204+
use Symfony\Component\Security\Core\Util\StringUtils;
204205
use Acme\DemoBundle\Security\Authentication\Token\WsseUserToken;
205206
206207
class WsseProvider implements AuthenticationProviderInterface
@@ -260,7 +261,7 @@ the ``PasswordDigest`` header value matches with the user's password.
260261
// Validate Secret
261262
$expected = base64_encode(sha1(base64_decode($nonce).$created.$secret, true));
262263
263-
return $digest === $expected;
264+
return StringUtils::equals($expected, $digest);
264265
}
265266
266267
public function supports(TokenInterface $token)

0 commit comments

Comments
 (0)