From 307d99c8f6265726f8289f3d4466fe19129fe04a Mon Sep 17 00:00:00 2001 From: Albert Casademont Date: Tue, 24 Jul 2012 17:37:00 +0200 Subject: [PATCH] [Security] Fixed use_referer option not working properly when login_path is a route name When use_referer is set to true and the request comes from the login page, the user should not be redirected to the login form again (the referer) but to the default_target_path. The problem arises when our login_path option is not a path but a route name, as the ```getUriForPath()``` method is not made to create routes from route names. --- .../Http/Authentication/DefaultAuthenticationSuccessHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php index 66d6bdacb2..dc7cbe549b 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -102,7 +102,7 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle return $targetUrl; } - if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $request->getUriForPath($this->options['login_path'])) { + if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) { return $targetUrl; }