Answer the question
In order to leave comments, you need to log in
Why does Symfony 2.3 logout a user with ROLE_IDDQD?
Good morning.
Today is Friday, and as always, unusual things are happening.
There is a project on Symfony 2.3. The onKernelRequest event implements dynamic routing. In fact, we define the control by URL and slip it into the system.
It would seem that everything is fine. But, if the user has the ROLE_IDDQD role, then he is automatically logged out by the system. If you log in with REMEMBERME, then the authorization is still saved thanks to the cookie, but ... logout stops working.
Tried disabling the option for iddqd:
jms_security_extra:
enable_iddqd_attribute: false
return new Response('any content');
public function onKernelRequest(GetResponseEvent $event)
{
if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
return;
}
$request = $event->getRequest();
if ($request->attributes->has('_controller')) {
return;
}
if (!$this->currentNode->hasCurrentPath()) {
$this->currentNode->setCurrentPath(mb_strtolower($request->getPathInfo()));
}
if (!$this->currentNode->hasNode()) {
return;
}
try{
list($bundle, $controller) = explode(':', $this->currentNode->getNode()->getController()->getController());
$controllerFilePath = $this->kernel->locateResource($bundle).'Controller/'.basename($controller).'.php';
$routeCollection = $this->annotationFileReader->load($controllerFilePath);
$routeCollection->addPrefix($this->currentNode->getNode()->getUrl(true));
} catch (\Exception $e) {
return;
}
$matcher = new UrlMatcher($routeCollection, $this->router->getMatcher()->getContext());
try {
$params = $matcher->match($this->currentNode->getCurrentPath().'/');
} catch (ResourceNotFoundException $e) {
try {
$params = $matcher->match($this->currentNode->getCurrentPath());
} catch (ResourceNotFoundException $e) {
return;
}
}
$params['node'] = $this->currentNode->getNode();
$request->attributes->add($params);
unset($params['_route']);
unset($params['_controller']);
$request->attributes->set('_route_params', $params);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question