I have got a symfony security.yml file
# app/config/security.yml
security:
firewalls:
secured_area:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Demo Area"
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
providers:
in_memory:
users:
ryan: { password: ryanpass, roles: 'ROLE_USER' }
admin: { password: kitten, roles: 'ROLE_ADMIN' }
encoders:
Symfony\Component\Security\Core\User\User: plaintext
I wanted some eleborations concerning this file..
- Can I have my own firewall settings like I replace secured_area by some othername?
- What is the difference between pattern and path ?
- If I access the url “myhost/Symfony/web/app_dev.php/admin” , what is supposed to happen ?
- Do I need a path /admin in my controller ?
Yes, you can have your own firewall(s).
Pattern is for firewall, path – for access control. Both are defined in the same way
You will be redirected to login form
All routes that match pattern will be enriched with security token. This is not necessary to be only
/admin, it can also be/admin/somepageI recommend you to read security chapter from Symfony2 documentation.