douzhu1188 2019-04-17 01:26
浏览 40
已采纳

Symfony 3.4.20和FOSUserBundle - '记住我'不工作

With the following relevant configuration in security.yml:

security:
    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern:
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager

            logout:       true
            anonymous:    true
            logout_on_user_change: true
            remember_me:
                secret: '%secret%'
                secure: true
                httponly: true
                lifetime: 31536000

The remember me session token is only lasting for the browser session rather than the year as specified in the configuration. Could this be due to the secure: true setting? My development machine doesn't have any TLS installed, so could that be the culprit? Or is there something else I should be looking for? From looking at the documentation, it looks like I'm setting things up correctly, so I'm at a bit of a loss.

  • 写回答

1条回答 默认 最新

  • douyi1982 2019-04-18 02:13
    关注

    Turns out my gut feeling about secure: true was correct. I set it to false during a test, and the cookie was correct. Since my development machine doesn't have SSL/TLS, it can't send a secure cookie if that's what's configured. It should work on my production server, given I do have working SSL/TLS in that environment.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据