mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 01:02:14 +00:00
Fix securityMatchers code sample
Closes gh-12296
This commit is contained in:
parent
08afa1782c
commit
50da5b6498
@ -409,7 +409,9 @@ import static org.springframework.security.web.util.matcher.AntPathRequestMatche
|
|||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||||
http
|
http
|
||||||
.securityMatcher(antMatcher("/api/**"), antMatcher("/app/**"))
|
.securityMatchers((matchers) -> matchers
|
||||||
|
.requestMatchers(antMatcher("/api/**"), antMatcher("/app/**"))
|
||||||
|
)
|
||||||
.authorizeHttpRequests((authz) -> authz
|
.authorizeHttpRequests((authz) -> authz
|
||||||
.requestMatchers(antMatcher("/api/admin/**")).hasRole("ADMIN")
|
.requestMatchers(antMatcher("/api/admin/**")).hasRole("ADMIN")
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user