Hello. This is my first time creating a Spring Boot application in Java. I have been following along a YouTube video tutorial on how to create a registration system with user verification email. I'm now at the point of implementing Spring Security Filter Chain. However, according to the IDE, many of the methods (like cors) are now deprecated. Can someone help me update the implementation?
The user account has no types (ADMIN, USER).
package com.myname.wetalk.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
@EnableWebSecurity
public class UserRegistrationSecurityConfig {
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
public SecurityFilterChain securityFilterChain(HttpSecurity http) {
return http.cors().and().csrf().disable()
.authorizeHttpRequests().requestMatchers()
.permitAll().and().authorizeHttpRequests()
.requestMatchers("")
.and().formLogin().and().build();
}
}