Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loop of redirections with isAuthenticated in access_control #217

Open
skhattane opened this issue Mar 4, 2017 · 0 comments
Open

Loop of redirections with isAuthenticated in access_control #217

skhattane opened this issue Mar 4, 2017 · 0 comments

Comments

@skhattane
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant