This is my security.yml
security:
providers:
in_memory:
memory: ~
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
admin_login:
pattern: ^/admin/login$
http_basic: ~
admin:
pattern: ^/admin
form_login:
login_path: /admin/login
check_path: /admin/loginCheck
account:
pattern: ^/account
http_basic: ~
# form_login:
# login_path: /login
# check_path: /loginCheck
main:
anonymous: ~
Everything is okay but when I change ^/account firewall to use form_login instead of http_basic, It throw some exceptions:
1/2 LogicException in MainConfiguration.php line 333: The check_path "/loginCheck" for login method "form_login" is not matched by the firewall pattern "^/account".
2/2 InvalidConfigurationException in BaseNode.php line 313: Invalid configuration for path "security.firewalls.account": The check_path "/loginCheck" for login method "form_login" is not matched by the firewall pattern "^/account".
I do know Symfony2 documentation recommended just use one and only one main firewall but this configuration is just for research multiple firewalls.
I think the scenario:
- Enter ^/admin, because ^/admin firewall requires form_login so it redirects to ^/admin/login firewall.
- ^/admin/login firewall requires http_basic so users need to enter their username & password to see ^/admin/login form.
- Enter ^/account, because ^/account firewall requires form_login so it redirects to ^/login (main firewall)
I don't know the above scenario is correct? How to fix this error? Please help me, thank you!