Robert Basic's blog

Importing Symfony2 security settings from a bundle

by Robert Basic on August 25th, 2011

I started to work on/figuring out the security part in Symfony2 and one part where the docs fail so far is to explain how to import security settings from a bundle.

Once I put some thinking into it, it's pretty easy actually. Simply import the needed security file in your main config file. Something like this will work:

# app/config/config.yml
imports:
    - { resource: parameters.ini }
    - { resource: '@AcmeDemoBundle/Resources/config/security.xml' }

where the security.xml file is the same as already described in the documentation.

Happy hackin'!

P.S.: Bonus tip: When googling for symfony2 stuff, start your query with +symfony2 to include only symfony2 results. Makes life a bit easier.

Tags: bundle, security, symfony2.
Categories: Development, Programming.