i18n-routing-bundle and FOSUserBundle

Ran into some problems when configuring the security.yml after a while this is what worked for me (did not realise that you cold use the routes without specifying the language first).

jms_security_extra:
    secure_all_services: false
    expressions: true

security:
    providers:
        fos_userbundle:
            id: fos_user.user_manager

    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    firewalls:
        main:
            pattern: /
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
                check_path:  fos_user_security_check
                login_path:  fos_user_security_login
            logout:       
                path:     fos_user_security_logout
            anonymous:    true

    access_control:
        - { path: ^/\w\w/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/\w\w/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/\w\w/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/\w\w/backend/admin/, role: ROLE_ADMIN }
        - { path: ^/\w\w/backend/, role: ROLE_USER }

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

Hopefully it helps someone 🙂

If I have done something wrong please leave a comment below.

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>