Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| web:framework:spring:security [2025/12/15 08:41] – jcheron | web:framework:spring:security [2025/12/15 09:18] (Version actuelle) – [Déclaration du service] jcheron | ||
|---|---|---|---|
| Ligne 37: | Ligne 37: | ||
| <sxh java; | <sxh java; | ||
| + | @Configuration | ||
| + | @EnableWebSecurity | ||
| + | public class SecurityConfig { | ||
| + | |||
| @Bean | @Bean | ||
| public SecurityFilterChain configure(HttpSecurity http) throws Exception { | public SecurityFilterChain configure(HttpSecurity http) throws Exception { | ||
| Ligne 194: | Ligne 198: | ||
| @Bean | @Bean | ||
| public DaoAuthenticationProvider authenticationProvider(UserDetailsService userService) { | public DaoAuthenticationProvider authenticationProvider(UserDetailsService userService) { | ||
| - | DaoAuthenticationProvider auth = new DaoAuthenticationProvider(); | + | DaoAuthenticationProvider auth = new DaoAuthenticationProvider(userService); |
| - | auth.setUserDetailsService(userService); | + | |
| auth.setPasswordEncoder(getPasswordEncoder()); | auth.setPasswordEncoder(getPasswordEncoder()); | ||
| return auth; | return auth; | ||