Skip to content

Commit

Permalink
sessionManagement add reference
Browse files Browse the repository at this point in the history
  • Loading branch information
bhtibrewal committed Feb 18, 2024
1 parent 2d43113 commit cc6158c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit cc6158c

Please sign in to comment.