How can I have list of all users logged in (via spring security) my web application
For accessing the list of all logged in users you need to inject SessionRegistry instance to your bean. @Autowired @Qualifier(“sessionRegistry”) private SessionRegistry sessionRegistry; And then using injcted SessionRegistry you can access the list of all principals: List<Object> principals = sessionRegistry.getAllPrincipals(); List<String> usersNamesList = new ArrayList<String>(); for (Object principal: principals) { if (principal instanceof User) { … Read more