JMSSecurityExtraBundle icon indicating copy to clipboard operation
JMSSecurityExtraBundle copied to clipboard

Loop of redirections with isAuthenticated in access_control

Open skhattane opened this issue 8 years ago • 0 comments

hi,

I use this (amazing) bundle (1.6.1) with

  • Symfony 3.1
  • FOSUserBundle
  • JMSI18nRoutingBundle
  • JMSTranslationBundle

Everything works when I'm logged and try to access to login page. (403 denied exception) But if i'm not authenticated and try to acces to login page, I have a loop of redirections.

misconfiguration ? or bug with JMSI18nRoutingBundle ? any idea ?

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: ^/

            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager
                login_path: fos_user_security_login
                check_path: fos_user_security_check

            oauth:
                resource_owners:
                    facebook:           "/connect/check-facebook"
                    google:             "/connect/check-google"
                    twitter:            "/connect/check-twitter"
                login_path:        fos_user_security_login
                failure_path:      /connect
                oauth_user_provider:
                    service: customUserProvider

            logout:
                path: fos_user_security_logout
            anonymous: true

    access_control:
        - { path: "^/[a-z]{2}_[A-Z]{2}/login$", role: "!is_Authenticated()" }
        - { path: "^/[a-z]{2}_[A-Z]{2}/register", role: "!is_Authenticated()" }
        - { path: "^/[a-z]{2}_[A-Z]{2}/resetting", role: "!is_Authenticated()" }
        - { path: "^/[a-z]{2}_[A-Z]{2}/(account|compte){1}", role: IS_AUTHENTICATED_REMEMBERED }
        - { path: "^/[a-z]{2}_[A-Z]{2}/(recipe/add|recette/ajouter){1}", role: IS_AUTHENTICATED_REMEMBERED }
        - { path: "^/[a-z]{2}_[A-Z]{2}/(recipe/.*/edit|recette/.*/editer){1}", role: IS_AUTHENTICATED_REMEMBERED }

Thanks for all

skhattane avatar Mar 04 '17 15:03 skhattane