Symfony – Error trying to call user checking action: “You must configure the check path to be handled…”

symfony

requesting "app_dev.php/login_check" I'm getting this error:

"You must configure the check path to be handled by the firewall using
form_login in your security firewall configuration."

These are my files:

security.yml

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN,
ROLE_ALLOWED_TO_SWITCH]

    providers:
        chain_provider:
            providers: [in_memory, fos_userbundle]

        in_memory:
            users:
                user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                admin: { password: adminpass, roles:
[ 'ROLE_ADMIN' ] }
        fos_userbundle:
            id: fos_user.user_manager

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: chain_provider
                check_path: /login_check
                default_target_path: /chat

            logout:
                path:   /logout
                target: /
            anonymous:    true
            switch_user:  true
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

    access_control:

        - { path: ^/_wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/chat, role: ROLE_USER }
        - { path: ^/admin/, role: ROLE_ADMIN }

routing.yml

AibFrontendBundle:
    resource: "@AibFrontendBundle/Controller/"
    type:     annotation
    prefix:   /

fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"

fos_user_profile:
    resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
    prefix: /profile

fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/
registration.xml"
    prefix: /register

fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /resetting

fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/
change_password.xml"
    prefix: /change-password

Any help?

symfony2.0.5

Best Answer

I had this error when I was attempting to override a symfony2 security component login listener (UsernamePasswordFormAuthenticationListener) by changing "security.authentication.listener.form.class" to another class in parameters.yml. Changing the parameter was the correct thing to do, however, you have to do it earlier in the execution order... I moved it to the top of app/config/config.yml and now it works fine.

#app/config/config.yml
imports:
    - { resource: parameters.yml }
    - { resource: security.yml }

parameters:
    security.authentication.listener.form.class: MDPATRICK\MdpatrickBundle\LoginListenerClass
Related Topic