JAVA-14883 Update spring-security-web-thymeleaf under spring-security-modules to remove usage of deprecated WebSecurityConfigurerAdapter (#12901)
This commit is contained in:
parent
1c24d18f62
commit
7a17abc2aa
|
@ -1,15 +1,16 @@
|
|||
package com.baeldung.customuserdetails;
|
||||
|
||||
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.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
public class SecurityConfiguration {
|
||||
|
||||
private final UserDetailsService userDetailsService;
|
||||
|
||||
|
@ -17,8 +18,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
this.userDetailsService = userDetailsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.userDetailsService(userDetailsService)
|
||||
.authorizeRequests()
|
||||
.anyRequest()
|
||||
|
@ -33,6 +34,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
.permitAll()
|
||||
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
|
||||
.logoutSuccessUrl("/login");
|
||||
return http.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,17 +6,16 @@ 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.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests()
|
||||
.anyRequest()
|
||||
.authenticated()
|
||||
|
@ -30,6 +29,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
.permitAll()
|
||||
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
|
||||
.logoutSuccessUrl("/login");
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
|
Loading…
Reference in New Issue