Forráskód Böngészése

[Security] fixed sub-requests creation (closes #1212)

Fabien Potencier 14 éve
szülő
commit
188e74273a

+ 3 - 1
src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php

@@ -50,7 +50,9 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface
     {
         $path = str_replace('{_locale}', $request->getSession()->getLocale(), $this->loginPath);
         if ($this->useForward) {
-            return $this->httpKernel->handle(Request::create($path), HttpKernelInterface::SUB_REQUEST);
+            $subRequest = Request::create($path, 'get', array(), $request->cookies->all(), array(), $request->server->all());
+
+            return $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
         }
 
         return new RedirectResponse(0 !== strpos($path, 'http') ? $request->getUriForPath($path) : $path, 302);

+ 1 - 1
src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php

@@ -203,7 +203,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
                 $this->logger->debug(sprintf('Forwarding to %s', $path));
             }
 
-            $subRequest = Request::create($path);
+            $subRequest = Request::create($path, 'get', array(), $request->cookies->all(), array(), $request->server->all());
             $subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed);
 
             return $event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST);

+ 1 - 1
src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

@@ -115,7 +115,7 @@ class ExceptionListener
                             return;
                         }
 
-                        $subRequest = Request::create($this->errorPage);
+                        $subRequest = Request::create($this->errorPage, 'get', array(), $request->cookies->all(), array(), $request->server->all());
                         $subRequest->attributes->set(SecurityContextInterface::ACCESS_DENIED_ERROR, $exception);
 
                         $response = $event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);