JAVA-27656 | removing WebSecurityConfigurerAdapter

This commit is contained in:
gaepi 2023-11-27 12:00:26 +01:00
parent 8dd4651db5
commit 4151b9ce70
1 changed files with 8 additions and 4 deletions

View File

@ -1,19 +1,23 @@
package com.baeldung.cloud.openfeign.oauthfeign; package com.baeldung.cloud.openfeign.oauthfeign;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.SecurityFilterChain;
@Configuration @Configuration
public class OAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { public class OAuth2WebSecurityConfigurerAdapter {
@Override @Bean
protected void configure(HttpSecurity http) throws Exception { public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http http
.csrf() .csrf()
.disable() .disable()
.oauth2Client(); .oauth2Client();
http http
.authorizeRequests().anyRequest().permitAll(); .authorizeRequests().anyRequest().permitAll();
return http.build();
} }
} }