Symfony 3-登录后如何保留会话ID? [英] Symfony 3 - How to keep session id after logging in?

查看:47
本文介绍了Symfony 3-登录后如何保留会话ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用会话ID为匿名用户标识数据库中的记录.当用户登录时,我想将数据绑定/关联到用户ID.但是,登录后,会话ID会根据我与用户的数据绑定丢失而自动更改.

I want to use the session ID to identify the records in the database for anonymous user. When the user logs in, I would like to bind/relate the data to the user id. However, after logging in the session id is automatically changed by what I lose data binding with the user.

登录后如何保留会话ID以便将用户ID绑定到数据,然后更改会话ID?

How can I keep the session id after logging in order to bind the user id to the data, and then change the session id?

推荐答案

身份验证后,除非另有配置,否则应迁移会话.实际上,会话ID不会保留,但数据应该在其中.

Upon authentication, session should be migrated, unless configured otherwise. Indeed, the session ID is not retained but the data should be there.

您是否已检查 security.xml :

session_fixation_strategy:  migrate

以上应为默认设置(参考).您的配置是什么情况?

This above should be the default (reference). What is the case with your config?

希望这会有所帮助...

Hope this helps a bit...

这篇关于Symfony 3-登录后如何保留会话ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆