Commit c2077877 authored by Fabien Potencier's avatar Fabien Potencier

fixed compatbility with Symfony 2.6

parent ba3bbef9
......@@ -80,8 +80,10 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
$app['security.access_rules'] = array();
$app['security.hide_user_not_found'] = true;
// the else part of this condition can be removed as soon as the Symfony 2.6 compat is removed
$r = new \ReflectionMethod('Symfony\Component\Security\Http\Firewall\ContextListener', '__construct');
$params = $r->getParameters();
if ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface' === $params[0]->getClass()->getName()) {
$app['security.authorization_checker'] = function ($app) {
return new AuthorizationChecker($app['security.token_storage'], $app['security.authentication_manager'], $app['security.access_manager']);
};
......@@ -90,6 +92,19 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
return new TokenStorage();
};
$app['security'] = function ($app) {
return new SecurityContext($app['security.token_storage'], $app['security.authorization_checker']);
};
} else {
$app['security.token_storage'] = $app['security.authorization_checker'] = function ($app) {
return $app['security'];
};
$app['security'] = function ($app) {
return new SecurityContext($app['security.authentication_manager'], $app['security.access_manager']);
};
}
$app['security.authentication_manager'] = function ($app) {
$manager = new AuthenticationProviderManager($app['security.authentication_providers']);
$manager->setEventDispatcher($app['dispatcher']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment