JAVA-14681 Update spring-boot-libraries module under spring-boot-modules to remove usage of deprecated WebSecurityConfigurerAdapter (#12725)
* JAVA-14681 Update spring-boot-libraries module under spring-boot-modules to remove usage of deprecated WebSecurityConfigurerAdapter * JAVA-14681 Correct Java Formatting
This commit is contained in:
parent
859e91538a
commit
3a3021fe53
|
@ -1,24 +1,26 @@
|
|||
package com.baeldung.boot.problem.configuration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
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.web.SecurityFilterChain;
|
||||
import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@Import(SecurityProblemSupport.class)
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Autowired
|
||||
private SecurityProblemSupport problemSupport;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable();
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.csrf()
|
||||
.disable();
|
||||
|
||||
http.authorizeRequests()
|
||||
.antMatchers("/")
|
||||
|
@ -27,5 +29,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
http.exceptionHandling()
|
||||
.authenticationEntryPoint(problemSupport)
|
||||
.accessDeniedHandler(problemSupport);
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue