diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2011-02-21 18:08:40 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2011-02-21 18:10:53 +0100 |
commit | b8c2dcece996ff89572ad8a9ece4f7faf481bb40 (patch) | |
tree | c9ce30e7b2c2a5f985c19193f4527456a50883fd | |
parent | f9bd8d8dfb915e667a1c7315727d985748d695c6 (diff) | |
download | symfony-security-b8c2dcece996ff89572ad8a9ece4f7faf481bb40.zip symfony-security-b8c2dcece996ff89572ad8a9ece4f7faf481bb40.tar.gz symfony-security-b8c2dcece996ff89572ad8a9ece4f7faf481bb40.tar.bz2 |
replaced Response::createRedirect by a new RedirectResponse class
-rw-r--r-- | Http/EntryPoint/FormAuthenticationEntryPoint.php | 3 | ||||
-rw-r--r-- | Http/EntryPoint/RetryAuthenticationEntryPoint.php | 3 | ||||
-rw-r--r-- | Http/Firewall/AbstractAuthenticationListener.php | 5 | ||||
-rw-r--r-- | Http/Firewall/LogoutListener.php | 3 | ||||
-rw-r--r-- | Http/Firewall/SwitchUserListener.php | 3 |
5 files changed, 11 insertions, 6 deletions
diff --git a/Http/EntryPoint/FormAuthenticationEntryPoint.php b/Http/EntryPoint/FormAuthenticationEntryPoint.php index 5809fe8..1f1cda7 100644 --- a/Http/EntryPoint/FormAuthenticationEntryPoint.php +++ b/Http/EntryPoint/FormAuthenticationEntryPoint.php @@ -14,6 +14,7 @@ namespace Symfony\Component\Security\Http\EntryPoint; use Symfony\Component\EventDispatcher\EventInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -49,6 +50,6 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface return $event->getSubject()->handle(Request::create($this->loginPath), HttpKernelInterface::SUB_REQUEST); } - return Response::createRedirect(0 !== strpos($this->loginPath, 'http') ? $request->getUriForPath($this->loginPath) : $this->loginPath, 302); + return new RedirectResponse(0 !== strpos($this->loginPath, 'http') ? $request->getUriForPath($this->loginPath) : $this->loginPath, 302); } } diff --git a/Http/EntryPoint/RetryAuthenticationEntryPoint.php b/Http/EntryPoint/RetryAuthenticationEntryPoint.php index 444535a..cde65aa 100644 --- a/Http/EntryPoint/RetryAuthenticationEntryPoint.php +++ b/Http/EntryPoint/RetryAuthenticationEntryPoint.php @@ -15,6 +15,7 @@ use Symfony\Component\EventDispatcher\EventInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; /** @@ -53,6 +54,6 @@ class RetryAuthenticationEntryPoint implements AuthenticationEntryPointInterface $url = $scheme.'://'.$request->getHost().$port.$request->getScriptName().$request->getPathInfo().$qs; - return Response::createRedirect($url, 301); + return new RedirectResponse($url, 301); } } diff --git a/Http/Firewall/AbstractAuthenticationListener.php b/Http/Firewall/AbstractAuthenticationListener.php index 2e6d363..353185e 100644 --- a/Http/Firewall/AbstractAuthenticationListener.php +++ b/Http/Firewall/AbstractAuthenticationListener.php @@ -25,6 +25,7 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; /** @@ -204,7 +205,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed); - return Response::createRedirect(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302); + return new RedirectResponse(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302); } } @@ -228,7 +229,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $response = $this->successHandler->onAuthenticationSuccess($event, $request, $token); } else { $path = $this->determineTargetUrl($request); - $response = Response::createRedirect(0 !== strpos($path, 'http') ? $request->getUriForPath($path) : $path, 302); + $response = new RedirectResponse(0 !== strpos($path, 'http') ? $request->getUriForPath($path) : $path, 302); } if (null !== $this->rememberMeServices) { diff --git a/Http/Firewall/LogoutListener.php b/Http/Firewall/LogoutListener.php index b2d1229..1f5bc45 100644 --- a/Http/Firewall/LogoutListener.php +++ b/Http/Firewall/LogoutListener.php @@ -18,6 +18,7 @@ use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; /** * LogoutListener logout users. @@ -97,7 +98,7 @@ class LogoutListener implements ListenerInterface throw new \RuntimeException('Logout Success Handler did not return a Response.'); } } else { - $response = Response::createRedirect(0 !== strpos($this->targetUrl, 'http') ? $request->getUriForPath($this->targetUrl) : $this->targetUrl, 302); + $response = new RedirectResponse(0 !== strpos($this->targetUrl, 'http') ? $request->getUriForPath($this->targetUrl) : $this->targetUrl, 302); } // handle multiple logout attempts gracefully diff --git a/Http/Firewall/SwitchUserListener.php b/Http/Firewall/SwitchUserListener.php index 0988973..4df51f0 100644 --- a/Http/Firewall/SwitchUserListener.php +++ b/Http/Firewall/SwitchUserListener.php @@ -21,6 +21,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Role\SwitchUserRole; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; @@ -110,7 +111,7 @@ class SwitchUserListener implements ListenerInterface } $request->server->set('QUERY_STRING', ''); - $response = Response::createRedirect($request->getUri(), 302); + $response = new RedirectResponse($request->getUri(), 302); $event->setProcessed(); |