Update spring-boot-keycloak-2 module under spring-boot-modules to remove usage of deprecated WebSecurityConfigurerAdapter
package com.baeldung.disablingkeycloak;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+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
@ConditionalOnProperty(name = "keycloak.enabled", havingValue = "false")
-public class DisableSecurityConfiguration extends WebSecurityConfigurerAdapter {
+public class DisableSecurityConfiguration {
- @Override
- protected void configure(final HttpSecurity http) throws Exception {
+ @Bean
+ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf()
.disable()
.authorizeRequests()
.anyRequest()
.permitAll();
+ return http.build();
}
+
}
