Skip to content

Commit f62b646

Browse files
committed
Removes deprecated 'security_factories' directive in the cookbook article in favor of adding the extension in the Bundle.
1 parent fdff03e commit f62b646

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

cookbook/security/custom_authentication_provider.rst

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -427,35 +427,27 @@ factory service, tagged as ``security.listener.factory``:
427427
</services>
428428
</container>
429429
430-
Now, import the factory configuration via the the ``factories`` key in your
431-
security configuration:
430+
As a final step, add the factory to the security extension in your bundle class.
432431

433-
.. configuration-block::
434-
435-
.. code-block:: yaml
436-
437-
# app/config/security.yml
438-
security:
439-
factories:
440-
- "%kernel.root_dir%/../src/Acme/DemoBundle/Resources/config/security_factories.yml"
432+
.. code-block:: php
441433
442-
.. code-block:: xml
434+
// src/Acme/DemoBundle/AcmeDemoBundle.php
435+
namespace Acme\DemoBundle;
443436
444-
<!-- app/config/security.xml -->
445-
<config>
446-
<factories>
447-
"%kernel.root_dir%/../src/Acme/DemoBundle/Resources/config/security_factories.xml
448-
</factories>
449-
</config>
437+
use Acme\DemoBundle\DependencyInjection\Security\Factory\WsseFactory;
438+
use Symfony\Component\HttpKernel\Bundle\Bundle;
439+
use Symfony\Component\DependencyInjection\ContainerBuilder;
450440
451-
.. code-block:: php
441+
class AcmeDemoBundle extends Bundle
442+
{
443+
public function build(ContainerBuilder $container)
444+
{
445+
parent::build($container);
452446
453-
// app/config/security.php
454-
$container->loadFromExtension('security', array(
455-
'factories' => array(
456-
"%kernel.root_dir%/../src/Acme/DemoBundle/Resources/config/security_factories.php"
457-
),
458-
));
447+
$extension = $container->getExtension('security');
448+
$extension->addSecurityListenerFactory(new WsseFactory());
449+
}
450+
}
459451
460452
You are finished! You can now define parts of your app as under WSSE protection.
461453

0 commit comments

Comments
 (0)