Skip to content

Commit 59f08e8

Browse files
committed
Use PathPatternRequestMatcher in Docs
Update documenation references from PathPatternRequestMatcher to AntPathRequestMatcher Issue gh-16632
1 parent ff52e05 commit 59f08e8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,8 +3706,8 @@ public HttpSecurity securityMatchers(Customizer<RequestMatcherConfigurer> reques
37063706
* {@link #securityMatcher(String...)}, {@link #securityMatchers(Customizer)} and
37073707
* {@link #securityMatchers()}
37083708
* </p>
3709-
* @param requestMatcher the {@link RequestMatcher} to use (i.e. new
3710-
* AntPathRequestMatcher("/admin/**","GET") )
3709+
* @param requestMatcher the {@link RequestMatcher} to use, for example,
3710+
* {@code PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GET, "/admin/**")}
37113711
* @return the {@link HttpSecurity} for further customizations
37123712
* @see #securityMatcher(String...)
37133713
*/

config/src/main/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -145,7 +145,7 @@ public LogoutConfigurer<H> invalidateHttpSession(boolean invalidateHttpSession)
145145
* (i.e. log out) to protect against
146146
* <a href="https://en.wikipedia.org/wiki/Cross-site_request_forgery">CSRF
147147
* attacks</a>. If you really want to use an HTTP GET, you can use
148-
* <code>logoutRequestMatcher(new AntPathRequestMatcher(logoutUrl, "GET"));</code>
148+
* <code>logoutRequestMatcher(PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GEt, logoutUrl));</code>
149149
* </p>
150150
* @param logoutUrl the URL that will invoke logout.
151151
* @return the {@link LogoutConfigurer} for further customization

config/src/main/kotlin/org/springframework/security/config/annotation/web/HttpSecurityDsl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -192,7 +192,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
192192
* @Bean
193193
* fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
194194
* http {
195-
* securityMatcher(AntPathRequestMatcher("/private/&ast;&ast;"))
195+
* securityMatcher(PathPatternRequestMatcher.withDefaults().matcher("/private/&ast;&ast;"))
196196
* formLogin {
197197
* loginPage = "/log-in"
198198
* }

0 commit comments

Comments
 (0)