Commit f837d210 authored by 杨伊博's avatar 杨伊博

add session Registy

parent ff7b3add
......@@ -26,6 +26,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomUserService customUserService;
@Autowired
SessionRegistry sessionRegistry;
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
......@@ -48,10 +50,16 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/**")
.permitAll()
.and()
.sessionManagement().maximumSessions(1).maxSessionsPreventsLogin(true);
.sessionManagement().maximumSessions(1).maxSessionsPreventsLogin(true).sessionRegistry(sessionRegistry);
http.httpBasic();
}
@Bean
public SessionRegistry getSessionRegistry(){
SessionRegistry sessionRegistry=new SessionRegistryImpl();
return sessionRegistry;
}
@Bean
public ServletListenerRegistrationBean httpSessionEventPublisher() {
return new ServletListenerRegistrationBean(new HttpSessionEventPublisher());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment