title: Disable multiple logins for same user in spring security + spring boot
body: <p>I have the below spring configuration :-</p>
  
  <pre><code>static SessionRegistry SR;
  @Override
  protected void configure(HttpSecurity http) throws Exception {
      http
      .authorizeRequests()
      .antMatchers("/", "/forgotPwd", "/resetPwd").permitAll()
      .anyRequest().authenticated().and().formLogin().loginPage("/login")
      .defaultSuccessUrl("/home").failureUrl("/login?error").permitAll()
      .successHandler(authenticationSuccessHandler) // autowired or defined below
      .and().logout()
      .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
      .logoutSuccessHandler(myLogoutSuccessHandler)
      .permitAll()
      .and().sessionManagement()
      .maximumSessions(1)
      .maxSessionsPreventsLogin(true)
      .sessionRegistry(SR);
      }
      @Bean
      public ServletListenerRegistrationBean&lt;HttpSessionEventPublisher&gt; httpSessionEventPublisher() {
      return new ServletListenerRegistrationBean&lt;HttpSessionEventPublisher&gt;(new HttpSessionEventPublisher());
    }
  </code></pre>
  
  <p>I was expecting <code>sessionManagement().maximumSessions(1)</code> to disable multiple login for the same user. It is working, but first user <code>logout</code> the application, so i am trying login in another browser but it showing <code>This account is already using by someone</code>.</p>
  
  <p>Kindly request you to let me know where its going wrong.</p>