Update spring-boot-keycloak module under spring-boot-modules to remove usage of deprecated WebSecurityConfigurerAdapter
@@ -4,14 +4,14 @@ 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.session.SessionRegistryImpl;
+import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy;
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
@Configuration
@EnableWebSecurity
-class SecurityConfig extends WebSecurityConfigurerAdapter {
+class SecurityConfig {
private final KeycloakLogoutHandler keycloakLogoutHandler;
@@ -24,8 +24,8 @@ class SecurityConfig extends WebSecurityConfigurerAdapter {
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
}
- @Override
- protected void configure(HttpSecurity http) throws Exception {
+ @Bean
+ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/customers*", "/users*")
.hasRole("USER")
@@ -36,6 +36,6 @@ class SecurityConfig extends WebSecurityConfigurerAdapter {
.logout()
.addLogoutHandler(keycloakLogoutHandler)
.logoutSuccessUrl("/");
+ return http.build();
}
-
}
