Force reauthentication after user permissions have been changed

后端 未结 2 2003
醉话见心
醉话见心 2021-02-14 17:14

In my application I can change user permissions and roles in backend.

When a user is logged in and I remove a role of the user, the user can still access content which h

2条回答
  •  借酒劲吻你
    2021-02-14 17:55

    Make your user class implement Symfony\Component\Security\Core\User\EquatableInterface.

    If you return false from the isEqualTo() method, the user will be reauthenticated. Use that method to compare only those properties that when changed should force reauthentication — roles in your case.

提交回复
热议问题