Example #1
0
 public function set(TokenInterface $token) : StorageInterface
 {
     $this->tokens[$token->getId()] = $token;
     return $this;
 }
Example #2
0
 /**
  *
  * {@inheritDoc}
  *
  * @see \Nia\Security\Csrf\Manager\ManagerInterface::isTokenValid($token)
  */
 public function isTokenValid(TokenInterface $token) : bool
 {
     $tokenId = $token->getId();
     if (!$this->hasToken($tokenId)) {
         return false;
     }
     return hash_equals($this->getToken($tokenId)->getValue(), $token->getValue());
 }