Skip to content

Commit

Permalink
docs: Replace deprecated methods of Spring Security with new alternat…
Browse files Browse the repository at this point in the history
…ives

Fixes #100
  • Loading branch information
wimdeblauwe committed Sep 18, 2024
1 parent a8ec58e commit d5dab38
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,10 @@ import io.github.wimdeblauwe.errorhandlingspringbootstarter.mapper.ErrorMessageM
import io.github.wimdeblauwe.errorhandlingspringbootstarter.mapper.HttpStatusMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
public class WebSecurityConfiguration {
@Bean
Expand All @@ -1227,11 +1229,11 @@ public class WebSecurityConfiguration {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http,
UnauthorizedEntryPoint unauthorizedEntryPoint) throws Exception {
http.httpBasic().disable();
http.httpBasic(AbstractHttpConfigurer::disable);
http.authorizeHttpRequests().anyRequest().authenticated();
http.authorizeHttpRequests(customizer -> customizer.anyRequest().authenticated());
http.exceptionHandling().authenticationEntryPoint(unauthorizedEntryPoint);//<.>
http.exceptionHandling(customizer -> customizer.authenticationEntryPoint(unauthorizedEntryPoint));//<.>
return http.build();
}
Expand All @@ -1258,6 +1260,7 @@ import io.github.wimdeblauwe.errorhandlingspringbootstarter.mapper.HttpStatusMap
import org.springframework.context.annotation.Bean;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
public class WebSecurityConfiguration {
Expand All @@ -1272,11 +1275,11 @@ public class WebSecurityConfiguration {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http,
AccessDeniedHandler accessDeniedHandler) throws Exception {
http.httpBasic().disable();
http.httpBasic(AbstractHttpConfigurer::disable);
http.authorizeHttpRequests().anyRequest().authenticated();
http.authorizeHttpRequests(customizer -> customizer.anyRequest().authenticated());
http.exceptionHandling().accessDeniedHandler(accessDeniedHandler);//<.>
http.exceptionHandling(customizer -> customizer.accessDeniedHandler(accessDeniedHandler));//<.>
return http.build();
}
Expand Down

0 comments on commit d5dab38

Please sign in to comment.