List of usage examples for org.springframework.security.core.session SessionRegistry getAllPrincipals
List<Object> getAllPrincipals();
SessionRegistry
. From source file:org.schedoscope.metascope.service.MetascopeUserService.java
public void logoutUser(SessionRegistry sessionRegistry, String username) { final List<Object> allPrincipals = sessionRegistry.getAllPrincipals(); for (final Object principal : allPrincipals) { if (principal instanceof User) { User springUserDetails = (User) principal; if (springUserDetails.getUsername().equals(username)) { for (SessionInformation sessionInformation : sessionRegistry.getAllSessions(principal, true)) { sessionInformation.expireNow(); }//from w w w . ja va2 s . c o m } } } }