protected function matchRequest(HttpServletRequestInterface $servletRequest)
{
// load the session from the request
$session = $servletRequest->getSession();
// query wheter or not a session is available
if ($session == null) {
return false;
}
// query whether or not we can find the original request data
if ($session->hasKey(Constants::FORM_REQUEST) === false) {
return false;
}
// if yes, compare the request URI and check for a valid princial
if ($req = $session->getData(Constants::FORM_REQUEST)) {
// query whether or not we've a valid princial
if (isset($req->principal) === false) {
return false;
}
// compare the request URI
return $servletRequest->getRequestUri() === $req->requestUri;
}
// return FALSE if the request doesn't match
return false;
}