title: How to get all application's online users in Spring Security 3.0.5?
body: <p>When I make an implementation for </p>
  
  <blockquote>
    <p>org.springframework.security.core.userdetails.UserDetailsService</p>
  </blockquote>
  
  <p>and use the statement </p>
  
  <blockquote>
    <p>sessionRegistry.registerNewSession(user.getUsername(), user);</p>
  </blockquote>
  
  <p>within it after successful authentication, then the </p>
  
  <blockquote>
    <p>sessionRegistry.getAllPrincipals();</p>
  </blockquote>
  
  <p>list is not empty (but when I log out from application the session still remain within list) otherwise this list will be empty. how can I make the session registration (and also unregistration during user log out or session expiration) within sessionRegistry automatically? my spring config is as below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;sec:http auto-config="true" use-expressions="true" access-denied-page="/accessDenied.jsf"&gt;
      &lt;sec:form-login login-page="/login.jsf" /&gt;
      &lt;sec:session-management session-authentication-strategy-ref="sas" /&gt;
  &lt;/sec:http&gt;
  
  &lt;bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl" /&gt;
  
  &lt;bean id="scr"
  class="org.springframework.security.web.context.HttpSessionSecurityContextRepository" /&gt;
  
  &lt;bean id="smf"
  class="org.springframework.security.web.session.SessionManagementFilter"&gt;
  &lt;constructor-arg name="securityContextRepository"
      ref="scr" /&gt;
  &lt;property name="sessionAuthenticationStrategy"
      ref="sas" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sas"
  class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy"&gt;
  &lt;constructor-arg name="sessionRegistry"
      ref="sessionRegistry" /&gt;
  &lt;property name="maximumSessions" value="10" /&gt;
  &lt;/bean&gt;
  </code></pre>