Ejemplo n.º 1
0
 /**
  * Verifies whether the provided token is valid.
  *
  * @param CsrfToken $token
  * @return bool
  */
 public function isTokenValid(CsrfToken $token)
 {
     if (!$this->sessionStorage->hasToken()) {
         return false;
     }
     return hash_equals($this->sessionStorage->getToken(), $token->getDecryptedValue());
 }
Ejemplo n.º 2
0
 public function testHasTokenWithoutExistingToken()
 {
     $this->session->expects($this->once())->method('exists')->with('requesttoken')->willReturn(false);
     $this->assertSame(false, $this->sessionStorage->hasToken());
 }