Update Documentation for PathPatternRequestMatcher
Issue gh-16765
This commit is contained in:
parent
0ab01eac14
commit
61d6fbc2a9
|
@ -401,7 +401,7 @@ Instead of taking this responsibility away from developers, now it is simpler to
|
|||
|
||||
[method,java]
|
||||
----
|
||||
PathPatternRequestParser.Builder servlet = PathPatternRequestParser.servletPath("/mvc");
|
||||
PathPatternRequestParser.Builder servlet = PathPatternRequestParser.withDefaults().basePath("/mvc");
|
||||
http
|
||||
.authorizeHttpRequests((authorize) -> authorize
|
||||
.requestMatchers(servlet.pattern("/orders/**").matcher()).authenticated()
|
||||
|
@ -409,11 +409,11 @@ http
|
|||
----
|
||||
|
||||
|
||||
For paths that belong to the default servlet, use `PathPatternRequestParser.path()` instead:
|
||||
For paths that belong to the default servlet, use `PathPatternRequestParser.withDefaults()` instead:
|
||||
|
||||
[method,java]
|
||||
----
|
||||
PathPatternRequestParser.Builder request = PathPatternRequestParser.path();
|
||||
PathPatternRequestParser.Builder request = PathPatternRequestParser.withDefaults();
|
||||
http
|
||||
.authorizeHttpRequests((authorize) -> authorize
|
||||
.requestMatchers(request.pattern("/js/**").matcher()).authenticated()
|
||||
|
|
|
@ -594,7 +594,7 @@ import static org.springframework.security.web.servlet.util.matcher.PathPatternR
|
|||
|
||||
@Bean
|
||||
SecurityFilterChain appEndpoints(HttpSecurity http) {
|
||||
PathPatternRequestMatcher.Builder mvc = withDefaults().servletPath("/spring-mvc");
|
||||
PathPatternRequestMatcher.Builder mvc = withDefaults().basePath("/spring-mvc");
|
||||
http
|
||||
.authorizeHttpRequests((authorize) -> authorize
|
||||
.requestMatchers(mvc.matcher("/admin/**")).hasAuthority("admin")
|
||||
|
|
Loading…
Reference in New Issue