refactor(security): 修复会话并发限制不生效问题
This commit is contained in:
parent
d1834b404b
commit
0d30f40f0e
@ -40,23 +40,10 @@ public class SpringSecurityConfig {
|
|||||||
private final CustomAuthenticationEntryPoint customAuthenticationEntryPoint;
|
private final CustomAuthenticationEntryPoint customAuthenticationEntryPoint;
|
||||||
private final CustomAccessDeniedHandler customAccessDeniedHandler;
|
private final CustomAccessDeniedHandler customAccessDeniedHandler;
|
||||||
// private final SessionRegistry sessionRegistry;
|
// private final SessionRegistry sessionRegistry;
|
||||||
private final CustomSessionInformationExpiredStrategy customSessionInformationExpiredStrategy;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
|
|
||||||
@Bean
|
|
||||||
public HttpSessionSecurityContextRepository httpSessionSecurityContextRepository() {
|
|
||||||
return new HttpSessionSecurityContextRepository();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ConcurrentSessionControlAuthenticationStrategy concurrentSessionControlAuthenticationStrategy() {
|
|
||||||
ConcurrentSessionControlAuthenticationStrategy concurrentSessionControlAuthenticationStrategy = new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry());
|
|
||||||
concurrentSessionControlAuthenticationStrategy.setMaximumSessions(1);
|
|
||||||
return concurrentSessionControlAuthenticationStrategy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PasswordEncoder passwordEncoder() {
|
public PasswordEncoder passwordEncoder() {
|
||||||
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
|
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
|
||||||
|
Loading…
Reference in New Issue
Block a user