diff --git a/skill-tree/src/main/java/com/RDS/skilltree/Config/SecurityConfig.java b/skill-tree/src/main/java/com/RDS/skilltree/Config/SecurityConfig.java index 46f15a73..7f63eda0 100644 --- a/skill-tree/src/main/java/com/RDS/skilltree/Config/SecurityConfig.java +++ b/skill-tree/src/main/java/com/RDS/skilltree/Config/SecurityConfig.java @@ -32,7 +32,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .authorizeHttpRequests(auth->auth .requestMatchers("/**").authenticated()) .exceptionHandling(ex->ex.authenticationEntryPoint(authEntryPoint)) - .sessionManagement(session -> session.maximumSessions(1)); + .sessionManagement(session -> session.maximumSessions(1).maxSessionsPreventsLogin(true) + ); +// https://docs.spring.io/spring-security/reference/servlet/authentication/session-management.html#ns-concurrent-sessions http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); return http.build();