Announcement Announcement Module
No announcement yet.
Destroy a session of another user Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Destroy a session of another user

    Hello, in my application I have a admin that can delete users so when I delete a user I want that the user log out automatically.
    I know user's session id who I delete but I don't know how invalidate a session using the session id.

    I would like something like: invalidate(SessionId);

    Is it possible in any way?


  • #2
    You can do this when you have Spring Security and have enabled SessionManagement / SessionTracking else it isn't going to be possible.

    Another way would be to create a filter which checks if the user is still valid (when the user issues a request) if not, logout user and show page.


    • #3
      My idea is when I do delete(user) in the controller, the controller gets the session of the user and destroy it, but I think it isn't possible.

      The best way that exists, I think is to create a filter and check if the user is in DB if isn't destroy the session.