2

when use spring security web, we can use the antMathcers

http.authorizeRequests()
    .antMatchers("/admin/**")

when use webflux, we use

http.authorizeExchange(exchanges->
                        exchanges
                                .pathMatchers("/admin/**")
                                .permitAll()
                                .anyExchange()
                                .authenticated()
)

the problem is, the first way we can has the ant patterns like "/admin/**/test"

but the second way, the above method will get wrong.

How can I achieve th above uri pattherns in the webflux environment?

Jimmy Guo
  • 1,288
  • 1
  • 9
  • 24
  • Can you share what the expected behaviour is compared to what you're seeing? It's not clear which endpoints the WebFlux configuration is getting wrong. – Eleftheria Stein-Kousathana Nov 17 '21 at 13:24
  • @EleftheriaStein-Kousathana I hope the webflux to support /admin/**/test pattern, but it only support the ** at the end, like /admin/** – Jimmy Guo Nov 18 '21 at 03:29

1 Answers1

0

In contrast to AntPathMatcher, is supported only at the end of a pattern. For example is valid but is not. The same applies also to the capturing variant . The aim is to eliminate ambiguity when comparing patterns for specificity. **/pages/{**}/pages/{**}/details{*spring}

More Examples:

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/pattern/PathPattern.html

zy_sun
  • 175
  • 1
  • 11