Probably the answer is simple: How can I manually logout the currently logged in user in spring security? Is it sufficient to call:
SecurityContextHolder.get
You can also use SessionRegistry as:
sessionRegistry.getSessionInformation(sessionId).expireNow();
If you want to force logout in all sessions of a user then use getAllSessions
method and call expireNow
of each session information.
Edit
This requires ConcurrentSessionFilter
(or any other filter in the chain), that checks SessionInformation and calls all logout handlers and then do redirect.