/** * {@inheritdoc} */ public function isTokenValid(CsrfToken $token) { if (!$this->storage->hasToken($token->getId())) { return false; } return hash_equals($this->storage->getToken($token->getId()), $token->getValue()); }
public function let(AngularCsrfTokenManager $tokenManager, RouteMatcherInterface $routeMatcher, Request $secureRequest, Request $unsecureRequest, CsrfToken $token) { $token->getValue()->willReturn(self::TOKEN_VALUE); $tokenManager->getToken()->willReturn($token); $this->secureRequest = $secureRequest; $this->unsecureRequest = $unsecureRequest; $routeMatcher->match($this->secureRequest, $this->routes)->willReturn(true); $routeMatcher->match($this->unsecureRequest, $this->routes)->willReturn(false); $this->beConstructedWith($tokenManager, $routeMatcher, $this->routes, self::COOKIE_NAME, self::COOKIE_EXPIRE, self::COOKIE_PATH, self::COOKIE_DOMAIN, self::COOKIE_SECURE); }
/** * {@inheritdoc} */ public function isTokenValid(CsrfToken $token) { return $this->csrfProvider->isCsrfTokenValid($token->getId(), $token->getValue()); }