Exemplo n.º 1
0
 /**
  * Validates a token based on $value, the user session, and the private key.
  *
  * @param string $token
  *   The token to be validated.
  * @param string $value
  *   (optional) An additional value to base the token on.
  *
  * @return bool
  *   TRUE for a valid token, FALSE for an invalid token.
  */
 public function validate($token, $value = '')
 {
     $seed = $this->sessionMetadata->getCsrfTokenSeed();
     if (empty($seed)) {
         return FALSE;
     }
     return $token === $this->computeToken($seed, $value);
 }