Reputation: 6269
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..
Upvotes: 0
Views: 192
Reputation: 17976
Can I have my own firewall settings like I replace secured_area by some othername?
Yes, you can have your own firewall(s).
What is the difference between pattern and path ?
Pattern is for firewall, path - for access control. Both are defined in the same way
If I access the url "myhost/Symfony/web/app_dev.php/admin" , what is supposed to happen ?
You will be redirected to login form
Do I need a path /admin in my controller ?
All routes that match pattern will be enriched with security token. This is not necessary to be only /admin
, it can also be /admin/somepage
I recommend you to read security chapter from Symfony2 documentation.
Upvotes: 2