[Security] Avoid unnecessary route lookup for empty logout path

This commit is contained in:
Roland Franssen 2017-04-29 20:05:30 +02:00
parent c84ee65b99
commit 2967807b14
2 changed files with 5 additions and 1 deletions

View File

@ -135,6 +135,6 @@ class LogoutListener implements ListenerInterface
*/
protected function requiresLogout(Request $request)
{
return $this->httpUtils->checkRequestPath($request, $this->options['logout_path']);
return isset($this->options['logout_path']) && $this->httpUtils->checkRequestPath($request, $this->options['logout_path']);
}
}

View File

@ -112,6 +112,10 @@ class LogoutUrlGenerator
list($logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager) = $this->listeners[$key];
if (null === $logoutPath) {
throw new \LogicException('Unable to generate the logout URL without a path.');
}
$parameters = null !== $csrfTokenManager ? array($csrfParameter => (string) $csrfTokenManager->getToken($csrfTokenId)) : array();
if ('/' === $logoutPath[0]) {