/** * Validate a CSRF token * * @param string $value Token * * @return boolean */ public function validate($value) { $tokens = $this->app->session()->get($this->sessionKey, array()); $key = array_search($value, $tokens); if ($key !== false) { unset($tokens[$key]); $this->app->session()->set($this->sessionKey, $tokens); return true; } return false; }