Un peu de tout

This commit is contained in:
mepiphana2023
2024-04-30 13:14:37 +02:00
parent 474dec272c
commit 882d9bede0
20 changed files with 187 additions and 80 deletions

View File

@@ -19,17 +19,17 @@ public class WebSecurityConfig{
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((requests) -> requests
.requestMatchers("/","/accueil", "/login", "/forgotPassword/**", "/inscription/**", "/searchArticle", "/article/show", "/change-language").permitAll()
.requestMatchers("/","/enchere", "/login", "/forgotPassword/**", "/inscription/**", "/searchArticle", "/article/show", "/change-language").permitAll()
.requestMatchers("/css/**", "/images/**", "/assets/**", "/img/**", "/js/**", "/assets/**", "/i18n/**").permitAll()
.requestMatchers("/profil/**", "/article/new/**", "/article/update", "/article/delete").authenticated()
.requestMatchers("/admin").hasRole("ADMIN")
.anyRequest().authenticated())
.formLogin((form) -> form
.loginPage("/login")
.defaultSuccessUrl("/", true))
.defaultSuccessUrl("/enchere", true))
.logout((logout) -> logout
.clearAuthentication(true).invalidateHttpSession(true)
.deleteCookies("JSESSIONID").logoutSuccessUrl("/login?logout")
.deleteCookies("JSESSIONID").logoutSuccessUrl("/enchere")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll());
return http.build();