symfony - ServiceCircularReferenceException in CheckCircularReferencesPass.php -
i working on wsse authentication in symfony2. t followed steps perfectly, trying on helloworld function:
public function helloworldaction() { return new response("hello world"); }
it's route: http://localhost/symfony/web/app_dev.php/api/helloworld
but getting error:
servicecircularreferenceexception in checkcircularreferencespass.php line 69: circular reference detected service "security.authentication.manager", path: "security.authentication.manager -> security.authentication.provider.wsse.wsse_secured -> security.authentication.manager".
i have double checked services.yml file mistakes , have been searching web 4h answer still stuck.
this services.yml of bundle:
services: wsse.security.authentication.provider: class: obcarstest2bundle\security\authentication\provider\wsseprovider arguments: ["", "%kernel.cache_dir%/security/nonces"] parent: security.authentication.listener.abstract #this key defined in security_listeners.xml abstract: true wsse.security.authentication.listener: class: obcarstest2bundle\security\firewall\wsselistener arguments: ["@security.token_storage", "@security.authentication.manager"] security.authentication.factory.wsse: class: obcarstest2bundle\dependencyinjection\security\factory\wssefactory tags: - { name: security.listener.factory }
and wsse factory:
<?php namespace obcarstest2bundle\dependencyinjection\security\factory; use symfony\component\dependencyinjection\containerbuilder; use symfony\component\dependencyinjection\containerinterface; use symfony\component\dependencyinjection\reference; use symfony\component\dependencyinjection\definitiondecorator; use symfony\component\config\definition\builder\nodedefinition; use symfony\bundle\securitybundle\dependencyinjection\security\factory\securityfactoryinterface; class wssefactory implements securityfactoryinterface { public function create(containerbuilder $container, $id, $config, $userprovider, $defaultentrypoint) { $providerid = 'security.authentication.provider.wsse.'.$id; $container ->setdefinition($providerid, new definitiondecorator('wsse.security.authentication.provider')) ->replaceargument(0, new reference($userprovider)) ->replaceargument(2, $config['lifetime']); $listenerid = 'security.authentication.listener.wsse.'.$id; $listener = $container->setdefinition($listenerid, new definitiondecorator('wsse.security.authentication.listener')); return array($providerid, $listenerid, $defaultentrypoint); } public function getposition() { return 'pre_auth'; } public function getkey() { return 'wsse'; } public function addconfiguration(nodedefinition $node) { $node ->children() ->scalarnode('lifetime')->defaultvalue(300) ->end(); } }
try inject wsse.security.authentication.provider setter.
in wsseprovider write setuserprovider , remove injection constructor.
in wssefactory :
$container ->setdefinition($providerid, new definitiondecorator('wsse.security.authentication.provider')) ->replaceargument(0, $config['lifetime']) ->addmethodcall('setuserprovider', array(new reference($userprovider)));
Comments
Post a Comment