Commit c2077877 authored by Fabien Potencier's avatar Fabien Potencier

fixed compatbility with Symfony 2.6

parent ba3bbef9
......@@ -80,15 +80,30 @@ 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();
$app['security.authorization_checker'] = function ($app) {
return new AuthorizationChecker($app['security.token_storage'], $app['security.authentication_manager'], $app['security.access_manager']);
};
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']);
};
$app['security.token_storage'] = function ($app) {
return new TokenStorage();
};
$app['security.token_storage'] = function ($app) {
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']);
......
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