try use Symfony\Component\Security\Core\SecurityContextInterface; On 17 янв, 14:43, kuboslav <kubos...@gmail.com> wrote: > According to Symfony2 > Cookbook<http://symfony.com/doc/2.0/cookbook/security/securing_services.html> > I'm > trying to secure controller via dependecy injection, but I'm getting error > Catchable > Fatal Error: Argument 1 passed to > Acme\ExampleBundle\Controller\DefaultController::__construct() must > implement interface > Symfony\Component\Security\Core\SecurityContextInterface, none given, > called in /var/www/example/app/cache/dev/classes.php on line 4706 and > defined in > /var/www/example/src/Acme/ExampleBundle/Controller/DefaultController.php > line 13 > > Here is my services.yml > > parameters: > acme_example.default.class: > Acme\ExampleBundle\Controller\DefaultController > > services: > acme_example.default: > class: %acme_example.default.class% > arguments: [@security.context] > > and controller: > > namespace Acme\ExampleBundle\Controller; > > use Symfony\Bundle\FrameworkBundle\Controller\Controller; > use Symfony\Component\HttpFoundation\Response; > use Symfony\Component\Security\Core\Exception\AccessDeniedException; > > class DefaultController extends Controller { > > public function __construct(SecurityContextInterface $securityContext) > { > if(false === $securityContext->isGranted('IS_AUTHENTICATED_FULLY')) > { > throw new AccessDeniedException(); > } > } > > public function indexAction() > { > return new Response('OK'); > } > > > > > > > > }
-- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en