mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-08 11:32:47 +00:00
SEC-1636: Add optimizations for universal match cases in AntUrlPathMatcher (using "/**" and "**" equality checks on the path).
This commit is contained in:
parent
522e8db5da
commit
bb3a973fcb
@ -5,6 +5,12 @@ import org.springframework.util.AntPathMatcher;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ant path strategy for URL matching.
|
* Ant path strategy for URL matching.
|
||||||
|
* <p>
|
||||||
|
* If the path consists of the pattern {@code /**} or {@code **}, it is treated as a universal
|
||||||
|
* match, which wil match any URL.
|
||||||
|
* <p>
|
||||||
|
* For all other cases, Spring's {@code AntPathMatcher} is used to perform the check for a match. See the Spring
|
||||||
|
* documentation for this class for more information on the syntax details.
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
*/
|
*/
|
||||||
@ -33,6 +39,9 @@ public class AntUrlPathMatcher implements UrlMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean pathMatchesUrl(Object path, String url) {
|
public boolean pathMatchesUrl(Object path, String url) {
|
||||||
|
if ("/**".equals(path) || "**".equals(path)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return pathMatcher.match((String)path, url);
|
return pathMatcher.match((String)path, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user