CsrfTokenGenerator::validate

public CsrfTokenGenerator::validate($token, $value = '')

Validates a token based on $value, the user session, and the private key.

Parameters

string $token: The token to be validated.

string $value: (optional) An additional value to base the token on.

Return value

bool TRUE for a valid token, FALSE for an invalid token.

File

core/lib/Drupal/Core/Access/CsrfTokenGenerator.php, line 84

Class

CsrfTokenGenerator
Generates and validates CSRF tokens.

Namespace

Drupal\Core\Access

Code

public function validate($token, $value = '') {
  $seed = $this->sessionMetadata->getCsrfTokenSeed();
  if (empty($seed)) {
    return FALSE;
  }

  return $token === $this->computeToken($seed, $value);
}
doc_Drupal
2016-10-29 08:59:13
Comments
Leave a Comment

Please login to continue.