问题
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.
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?
回答1:
Upon authentication, session should be migrated, unless configured otherwise. Indeed, the session ID is not retained but the data should be there.
Have you checked the 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...
来源:https://stackoverflow.com/questions/40624358/symfony-3-how-to-keep-session-id-after-logging-in