Update spring-cloud-config module under spring-cloud-modules to remove usage of deprecated WebSecurityConfigurerAdapter
package com.baeldung.spring.cloud.config.server;
+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.WebSecurityConfigurerAdapter;
+import org.springframework.security.web.SecurityFilterChain;
@Configuration
-public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
+public class SecurityConfiguration {
- @Override
- public void configure(HttpSecurity http) throws Exception {
+ @Bean
+ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf()
.ignoringAntMatchers("/encrypt/**")
.ignoringAntMatchers("/decrypt/**");
-
- super.configure(http);
+ http.authorizeRequests((requests) -> requests.anyRequest()
+ .authenticated());
+ http.formLogin();
+ http.httpBasic();
+ return http.build();
}
}
