how to secure whole pages except login page in symfony2?

后端 未结 2 2100
不思量自难忘°
不思量自难忘° 2021-01-03 07:09

I want to have whole site secured through login with FOSUserBundle. I tried to set security.yml like this

security:
encoders:
    Symfony\\Component\\Securit         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 07:40

    Every time the same, nobody bats an eye on the documentation. Wayne. But for your spamming you shouldn't get a answer, but this would be unfair ^^

    security:
        firewalls:
            main:
                pattern: ^/
                # other settings
                anonymous:    true
    
        access_control:
            - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/, role: ROLE_USER }
    

提交回复
热议问题