How to configure a remember me aware listener in Symfony 2?

前端 未结 5 606
既然无缘
既然无缘 2021-02-14 23:25

I have implemented a custom authentication provider successfully, but now I also need to add \'remember me\' functionality, and I couldn\'t find docs on how to do that.

5条回答
  •  面向向阳花
    2021-02-14 23:51

    You can try this:

    firewalls:                   
        secured_area:
            pattern:    ^/
            anonymous: ~
            form_login:
                csrf_provider: form.csrf_provider
                login_path:  login
                check_path:  login_check
                always_use_default_target_path: true
                default_target_path: /the-cao
                remember_me: true
            logout:
                path: /logout
                target: /
            remember_me:
                key:      "%secret%"
                lifetime: 31536000 # 365 days in seconds
                path:     /
                domain:   ~ # Defaults to the current domain from $_SERVER
    

提交回复
热议问题