how to secure whole pages except login page in symfony2?

后端 未结 2 2099
不思量自难忘°
不思量自难忘° 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:59

    for move to this URL localhost/QuickBacklog/web/app_dev.php/dashboard
    you must add like this in the security.yml

    firewalls:
            main:
                pattern:    ^/
                form_login:
                    provider:             fos_userbundle
                    default_target_path:  /dashboard/                
                logout:     
                    ........
                    invalidate_session: false
                anonymous: ~
    

    In the routing file

    applicationlogin_success:
      pattern: /dashboard/
      defaults: { _controller: SampleBundle:Default:FrontPage } 
    

    BY USING default_target_path : ROUTING_PATTERN
    u will redirect it...

提交回复
热议问题