diff --git a/booking-mvc/pom.xml b/booking-mvc/pom.xml index d1cd1b6..ecf9832 100644 --- a/booking-mvc/pom.xml +++ b/booking-mvc/pom.xml @@ -72,25 +72,18 @@ org.thymeleaf thymeleaf - 3.1.0.RC2 + 3.1.1.RELEASE org.thymeleaf thymeleaf-spring6 - 3.1.0.RC2 + 3.1.1.RELEASE org.thymeleaf.extras thymeleaf-extras-springsecurity6 - 3.1.0.RC2 + 3.1.0.RELEASE - org.hsqldb diff --git a/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java b/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java index 6d496b0..42d5a56 100644 --- a/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java +++ b/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java @@ -1,18 +1,20 @@ package org.springframework.webflow.samples.booking.config; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.provisioning.InMemoryUserDetailsManager; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @Configuration @EnableWebSecurity -public class SecurityConfig extends WebSecurityConfigurerAdapter { +public class SecurityConfig { - @Override - protected void configure(HttpSecurity http) throws Exception { + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http .formLogin() .loginPage("/login") @@ -23,15 +25,16 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET")) .logoutSuccessUrl("/logoutSuccess"); + return http.build(); } - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication() - .withUser("keith").password("{MD5}417c7382b16c395bc25b5da1398cf076").roles("USER", "SUPERVISOR").and() - .withUser("erwin").password("{MD5}12430911a8af075c6f41c6976af22b09").roles("USER", "SUPERVISOR").and() - .withUser("jeremy").password("{MD5}57c6cbff0d421449be820763f03139eb").roles("USER").and() - .withUser("scott").password("{MD5}942f2339bf50796de535a384f0d1af3e").roles("USER"); + @Bean + public InMemoryUserDetailsManager userDetailsService() { + return new InMemoryUserDetailsManager( + User.withUsername("keith").password("{MD5}417c7382b16c395bc25b5da1398cf076").roles("USER", "SUPERVISOR").build(), + User.withUsername("erwin").password("{MD5}12430911a8af075c6f41c6976af22b09").roles("USER", "SUPERVISOR").build(), + User.withUsername("jeremy").password("{MD5}57c6cbff0d421449be820763f03139eb").roles("USER").build(), + User.withUsername("scott").password("{MD5}942f2339bf50796de535a384f0d1af3e").roles("USER").build()); } } diff --git a/pom.xml b/pom.xml index 98d32f0..303e673 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,8 @@ 3.4 2.5.1 - 5.6.10.Final - 7.0.4.Final + 5.6.15.Final + 8.0.0.Final 2.2.3 11.0.11 3.0.0 @@ -31,8 +31,8 @@ 2.2.20 2.3.8 8.0 - 5.0.0 - 3.0.0-M1 + 6.0.0 + 3.0.0-SNAPSHOT 2.22.2 @@ -41,7 +41,7 @@ org.springframework spring-framework-bom - 6.0.0-M5 + 6.0.7 pom import @@ -50,12 +50,12 @@ spring-security-bom pom import - 6.0.0-M5 + 6.0.2 org.slf4j slf4j-api - 1.7.30 + 2.0.6