Search code examples
phpsymfonysecurityupgrademigrate

Security issues when migrating to symfony 3.4 from 3.3. I can`t do login


This is my file security.yml:

security:
    encoders:
        H360\generalBundle\Entity\UsrUsuarios:
            id: usuarios.password_encoder

    providers:
        usuarios:
            entity: { class: H360\generalBundle\Entity\UsrUsuarios}

    firewalls:
        angular_area:
            pattern:  ^/[a-zA-Z]{2}/.*/.*/rest/
            #provider: entity_admin
            anonymous: ~
            logout_on_user_change: true


        secured_area:
            pattern: ^/[a-zA-Z]{2}/
            user_checker: app.users.checker
            anonymous: ~
            logout_on_user_change: true

            guard:
                authenticators:
                    - app.login.authenticator
                    - app.card.authenticator
                    - app.google.authenticator
                entry_point: app.login.authenticator

            logout:
                path: usuarios_logout
                target: /

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

    access_control:
        - { path: ^/login,                              roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/([a-zA-Z]\d*.\d*)/extrest/,         roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/([a-zA-Z]\d*.\d*)/restablelink/,    roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/([a-zA-Z]\d*.\d*)/resturnocomedor/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/([a-zA-Z]\d*.\d*),                  roles: ROLE_USER}

So, when i upgrade to symfony 3.4, i can't do login.

I have been reading about this, but i don't know the solution ;(

When i try to log in, the page reloads itself and no error appears.

Help pls !


Solution

  • Solvented !!! Finally, it was a problem with the function "supports()" in my LoginAuthenticator.php. This function has to return false.