Skip to content

Commit

Permalink
replace deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
nasirov committed Oct 16, 2024
1 parent 9b1ffe8 commit 15ae72d
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity.CsrfSpec;
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
Expand Down Expand Up @@ -38,15 +39,10 @@ public MapReactiveUserDetailsService userDetailsService(AppProps appProps, Passw

@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
return http.csrf()
.disable()
return http.csrf(CsrfSpec::disable)
.httpBasic(Customizer.withDefaults())
.authorizeExchange()
.pathMatchers("/actuator/**", "/api/v1/user/**")
.permitAll()
.pathMatchers("/api/v1/anime/**")
.hasRole("ADMIN")
.and()
.authorizeExchange(
exchanges -> exchanges.pathMatchers("/actuator/**", "/api/v1/user/**").permitAll().pathMatchers("/api/v1/anime/**").hasRole("ADMIN"))
.build();
}
}

0 comments on commit 15ae72d

Please sign in to comment.