This commit is contained in:
Parpaillax
2024-04-24 12:14:24 +02:00
parent 7df76ea3ed
commit 1d41a7beeb
3 changed files with 5 additions and 6 deletions

View File

@@ -34,9 +34,4 @@ public class LoginController {
return "redirect:/security/login?error";
}
}
@GetMapping("/logout")
public String logout(Model modele) {
return "security/login";
}
}

View File

@@ -24,7 +24,7 @@ public class WebSecurityConfig{
.anyRequest().authenticated())
.formLogin((form) -> form.loginPage("/login").defaultSuccessUrl("/", true))
.logout((logout) -> logout.clearAuthentication(true).invalidateHttpSession(true)
.deleteCookies("JSESSIONID").logoutSuccessUrl("/login")
.deleteCookies("JSESSIONID").logoutSuccessUrl("/login?logout")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll());
return http.build();