title: Spring security with jwt get all user logged
body: <p>i would like to display all users logged in my application i use spring security with jwt authentifcation,</p>
  
  <p>when i tried to get all users spring security give me empty array</p>
  
  <pre><code>@Autowired
  private SessionRegistry sessionRegistry;
  
  @GetMapping("/userConnecter")
  
  public List&lt;String&gt; userConnecter(){
  
  List&lt;Object&gt; principals = sessionRegistry.getAllPrincipals();
  
  List&lt;String&gt; usersNamesList = new ArrayList&lt;String&gt;();
  
  for (Object principal: principals) {
      if (principal instanceof User) {
          usersNamesList.add(((User) principal).getUsername());
      }
  }
  return usersNamesList;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>@Bean
  public SessionRegistry sessionRegistry() {
      return new SessionRegistryImpl();
  }
  </code></pre>
  
  <p>I think the problem is related with injection dependency.</p>
  
  <p>is there any solutions?</p>