Update permission accès

This commit is contained in:
jleroy
2024-04-23 11:15:06 +02:00
parent 7d0ea267e4
commit 0be1dc7244

View File

@@ -16,7 +16,8 @@ public class WebSecurityConfig {
http.authorizeHttpRequests((requests) -> requests.requestMatchers("/", "/accueil").permitAll()
.requestMatchers("/accueil", "/login", "/inscription").permitAll()
.requestMatchers("/css/**", "/images/**", "/assets/**", "/img/**", "/js/**").permitAll()
.requestMatchers("/admin").hasRole("ADMIN")
.requestMatchers("/profile").hasRole("MEMBRE")
.requestMatchers("/admin").hasAnyRole("MEMBRE", "ADMIN")
.anyRequest().authenticated())
.formLogin((form) -> form.loginPage("/login").defaultSuccessUrl("/", true))
.logout((logout) -> logout.clearAuthentication(true).invalidateHttpSession(true)