简体   繁体   中英

How to logout a user in Symfony2

I need to force logout a user after his account have been changed in a user management.

The only example I've found is how to logout a current user

$this->container->get('security.context')->setToken(null);

whereas I need to logout an arbitrary user.

You cannot do that if you're using a native php session handler. Otherwise, it is possible to do that if you store sessions in database, see PdoSessionHandler to Store Sessions in the Database

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM