public function testCreateTokenCreatesNewTokenInSession()
 {
     $newToken = $this->csrfHandler->createNewToken()->getCurrentToken();
     $this->assertNotEmpty($newToken);
     $this->assertEquals($newToken, $this->csrfHandler->getCurrentToken());
     $this->assertEquals($newToken, $this->session->get('_csrf'));
     $anotherToken = $this->csrfHandler->createNewToken()->getCurrentToken();
     $this->assertNotEmpty($anotherToken);
     $this->assertNotEquals($newToken, $anotherToken);
 }
Beispiel #2
0
 /**
  * @param CsrfHandler $csrfHandler
  * @return $this
  */
 public function addCsrfToken(CsrfHandler $csrfHandler)
 {
     $this->addPlaceHolder('csrf_token', $csrfHandler->getCurrentToken());
     $this->addPlaceHolder('csrf_field_name', $csrfHandler->getTokenFieldName());
     return $this;
 }