I have this security.yml file. I want to know do i need two firewalls or one is ok.
I have read in docs that one firewall is ok and use ACL for further things.
firewalls:
admin:
pattern: /admin(.*)
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: /admin/login
use_referer: true
default_target_path: /admin/dashboard
logout:
path: /admin/logout
target: /admin/login
anonymous: true
main:
pattern: .*
form-login:
provider: fos_userbundle
login_path: /login
use_forward: false
check_path: /login_check
failure_path: null
default_target_path: /main
logout: true
anonymous: true
Yes, you will need two. One firewall protects secure pages, the second firewall allows anonymous access to open pages, which you need to open up at least for your login page (see the common pitfalls section of the security documentation).
You will probably want to add paths to the second firewall for home, password recovery, and any other pages you want anyone to be able to access.