symfony - ERRO- You must configure the check path to be handled by the firewall using form_login in your security firewall configuration -
hello have problem in symfony project fosuserbundle
when login give error
you must configure check path handled firewall using form_login in security firewall configuration.
i try different codes , error
i use:
symfony 3 fosuserbundle 2.0
config.yml
fos_user: db_driver: orm # other valid values 'mongodb' , 'couchdb' firewall_name: main user_class: appbundle\entity\user from_email: address: "testeapp@testapp.com" sender_name: "test app"
routing
app: resource: '@appbundle/controller/' type: annotation admin_area: resource: "@sonataadminbundle/resources/config/routing/sonata_admin.xml" prefix: /admin fos_user: resource: "@fosuserbundle/resources/config/routing/all.xml"
security
# started security, check out documentation: # https://symfony.com/doc/current/security.html security: # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded providers: in_memory: memory: ~ firewalls: # disables authentication assets , profiler, adapt according needs dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: anonymous: ~ # activate different ways authenticate # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate #http_basic: ~ # https://symfony.com/doc/current/security/form_login_setup.html #form_login: ~ encoders: fos\userbundle\model\userinterface: bcrypt role_hierarchy: role_admin: role_user role_super_admin: role_admin providers: fos_userbundle: id: fos_user.user_provider.username firewalls: main: pattern: ^/admin form_login: login_path: /login check_path: /login_check provider: fos_userbundle csrf_provider: form.csrf_provider access_control: - { path: ^/login$, role: is_authenticated_anonymously } - { path: ^/register, role: is_authenticated_anonymously } - { path: ^/resetting, role: is_authenticated_anonymously } - { path: ^/admin/, role: role_admin }
in project use sonata admin bundle, can interference?
hope thx
security.yml has duplicate main firewall, delete first , keep second because contains form_login solve problem
# started security, check out documentation: # https://symfony.com/doc/current/security.html security: encoders: fos\userbundle\model\userinterface: bcrypt role_hierarchy: role_admin: role_user role_super_admin: role_admin providers: fos_userbundle: id: fos_user.user_provider.username firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/admin form_login: login_path: /login check_path: /login_check provider: fos_userbundle csrf_provider: form.csrf_provider access_control: - { path: ^/login$, role: is_authenticated_anonymously } - { path: ^/register, role: is_authenticated_anonymously } - { path: ^/resetting, role: is_authenticated_anonymously } - { path: ^/admin/, role: role_admin }
look @ doc more details.
Comments
Post a Comment