How do you log out all logged in users in spring-security?

前端 未结 2 538
失恋的感觉
失恋的感觉 2020-12-29 05:46

I want to be able to log out all logged in users programmatically. How do you force logout all users on some event?

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 06:22

    Ketan gives you the answer that you are looking for, if you change the second for block and use session.expireNow(); instead activeSessions.add(session); you will end up with all active sessions expired.

提交回复
热议问题