title: Log out user by admin Spring Security
body: <p>I'd like your help to get how implement this function: 
  admin gets all logged in users using sessionRegistry.getAllPrincipals() and then can log off someone. 
  I know how to log off current user (session.invalidate()), but have no idea how to force log out other users. </p>
  
  <p>This code gets me all logged in users</p>
  
  <pre><code>public List&lt;User&gt; getAllLoggedInUsers() {
      List&lt;Object&gt; principals = sessionRegistry.getAllPrincipals();
      List&lt;User&gt; usersNamesList = new ArrayList&lt;&gt;();
      for (Object principal : principals) {
          if (principal instanceof org.springframework.security.core.userdetails.User) {
              usersNamesList.add(dao.findByLogin(((org.springframework.security.core.userdetails.User) principal).getUsername()));
          }
      }
      return usersNamesList;
  }
  </code></pre>
  
  <p>Thanks a lot. </p>
  
  <p>EDIT 1: I want next: admin chooses a user, bans it (change info in DB) and then if this user is active - log him off. </p>