From 3dfc09cd8d7cea0a4b1f1162fc23915dfe22c624 Mon Sep 17 00:00:00 2001 From: "Johannes M. Schmitt" Date: Sat, 12 Feb 2011 23:23:09 +0100 Subject: [PATCH] [Security] fixes some regressions --- .../DependencyInjection/SecurityExtension.php | 8 ++------ .../Http/Firewall/AbstractAuthenticationListener.php | 8 ++++---- .../Security/Http/Firewall/ExceptionListener.php | 2 +- .../UsernamePasswordFormAuthenticationListener.php | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 0a6a0fa5cd..c633436e4c 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -66,12 +66,8 @@ class SecurityExtension extends Extension $loader->load('collectors.xml'); // set some global scalars - if (isset($config['access_denied_url'])) { - $container->setParameter('security.access.denied_url', $config['access_denied_url']); - } - if (isset($config['session_fixation_protection'])) { - $container->setParameter('security.authentication.session_strategy.strategy', $config['session_fixation_protection']); - } + $container->setParameter('security.access.denied_url', $config['access_denied_url']); + $container->setParameter('security.authentication.session_strategy.strategy', $config['session_fixation_strategy']); $this->createFirewalls($config, $container); $this->createAuthorization($config, $container); diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 33351102d1..2a07cfa1b3 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -195,7 +195,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface } $subRequest = Request::create($this->options['failure_path']); - $subRequest->attributes->set(SecurityContext::AUTHENTICATION_ERROR, $failed->getMessage()); + $subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed->getMessage()); return $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST); } else { @@ -203,7 +203,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path'])); } - $request->getSession()->set(SecurityContext::AUTHENTICATION_ERROR, $failed->getMessage()); + $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed->getMessage()); $response = new Response(); $response->setRedirect(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302); @@ -221,8 +221,8 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $this->securityContext->setToken($token); $session = $request->getSession(); - $session->remove(SecurityContext::AUTHENTICATION_ERROR); - $session->remove(SecurityContext::LAST_USERNAME); + $session->remove(SecurityContextInterface::AUTHENTICATION_ERROR); + $session->remove(SecurityContextInterface::LAST_USERNAME); if (null !== $this->eventDispatcher) { $this->eventDispatcher->notify(new Event($this, 'security.interactive_login', array('request' => $request, 'token' => $token))); diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index 7a47437e62..350b02905d 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -124,7 +124,7 @@ class ExceptionListener implements ListenerInterface } $subRequest = Request::create($this->errorPage); - $subRequest->attributes->set(SecurityContext::ACCESS_DENIED_ERROR, $exception->getMessage()); + $subRequest->attributes->set(SecurityContextInterface::ACCESS_DENIED_ERROR, $exception->getMessage()); $response = $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); $response->setStatusCode(403); diff --git a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php index e8ea6f9584..f16603680d 100644 --- a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php @@ -57,7 +57,7 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL $username = trim($request->get($this->options['username_parameter'])); $password = $request->get($this->options['password_parameter']); - $request->getSession()->set(SecurityContext::LAST_USERNAME, $username); + $request->getSession()->set(SecurityContextInterface::LAST_USERNAME, $username); return $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $password, $this->providerKey)); }