title: How to check that user has already logged in using Apache Shiro?
body: <p>The question is very simple. I'd like to restrict user access with same login from different machines/browsers: only one live user session is possible.</p>
  
  <p><code>Apache shiro</code> library is used for user authentification and managment.</p>
  
  <p>Of course this could be done using simple synchornized maps and etc. But the question is: Has <code>Apache Shiro</code> special mechanisms for that or not? </p>
  
  <p>Another variant of this question: how to reveice the list of all subjects who are logged in the system using <code>apache shiro</code>?</p>
  
  <p><strong>UPD:</strong> </p>
  
  <p>To clarify my question. My desire is to have some code like this (I known, that there isn't such class exception, but the idea must be more clean):</p>
  
  <pre><code>Subject currentUser = SecurityUtils.getSubject();
  UsernamePasswordToken token = new UsernamePasswordToken(login, password);
  try {
      currentUser.login(token);
  } catch (AlreadyAuthenticatedException aae) {
      errorMsg = "You should logoff on another machine!";
  }
  </code></pre>