Posts

Showing posts with the label Thymeleaf

Spring Boot 3 + Spring Security 6 + Thymeleaf - Registration and Login Example

Image
In this section we will learn how to create user registration and login using Spring boot 3, Spring security 6, Thymeleaf, JPA, and PostgreSQL. The GitHub repository link is provided at the end of this tutorial. You can download the source code. What’s New in Spring Security 6? WebSecurityConfigurerAdapter Removed : The  WebSecurityConfigurerAdapter class was deprecated and then removed in Spring Security 6. Instead, you should now take a more component-based approach and create a bean of type  SecurityFilterChain . Here's an example: @Configuration @EnableWebSecurity public class SecurityConfiguration { @Bean public SecurityFilterChain securityFilterChain ( HttpSecurity http) throws Exception { http .authorizeHttpRequests((requests) -> requests .requestMatchers( "/registration**" ).permitAll() .anyRequest().authenticated() ) .formLogin((form) -> form