Class MatcherUtil
java.lang.Object
com.broadleafcommerce.resource.security.utils.MatcherUtil
Utility for creating new
RequestMatcher instances based on Spring MVC path patterns.-
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.security.web.util.matcher.RequestMatchermvcRequestMatcher(String pattern, org.springframework.security.config.annotation.web.builders.HttpSecurity http) Create a newRequestMatcherinstance.static org.springframework.security.web.util.matcher.RequestMatchermvcRequestMatcher(String pattern, org.springframework.security.config.annotation.web.builders.HttpSecurity http, String servletPath) Create a newRequestMatcherinstance.static org.springframework.security.web.util.matcher.RequestMatchersmartPathPattern(String pattern) Create a newRequestMatcherinstance that provides backwards compatibility for patterns that contain double wildcards in the middle of the path.static org.springframework.security.web.util.matcher.RequestMatchersmartPathPattern(org.springframework.http.HttpMethod method, String pattern) Create a newRequestMatcherinstance that provides backwards compatibility for patterns that contain double wildcards in the middle of the path.
-
Method Details
-
smartPathPattern
public static org.springframework.security.web.util.matcher.RequestMatcher smartPathPattern(String pattern) Create a newRequestMatcherinstance that provides backwards compatibility for patterns that contain double wildcards in the middle of the path.- Parameters:
pattern- the pattern to match- Returns:
- a RequestMatcher
-
smartPathPattern
public static org.springframework.security.web.util.matcher.RequestMatcher smartPathPattern(org.springframework.http.HttpMethod method, String pattern) Create a newRequestMatcherinstance that provides backwards compatibility for patterns that contain double wildcards in the middle of the path.- Parameters:
method- the HTTP method to matchpattern- the pattern to match- Returns:
- a RequestMatcher
-
mvcRequestMatcher
public static org.springframework.security.web.util.matcher.RequestMatcher mvcRequestMatcher(String pattern, org.springframework.security.config.annotation.web.builders.HttpSecurity http) Create a newRequestMatcherinstance. Defaults to a null servlet path.- Parameters:
pattern- The mvc matching patternhttp- The security context being modified- Returns:
- A new RequestMatcher instance
-
mvcRequestMatcher
public static org.springframework.security.web.util.matcher.RequestMatcher mvcRequestMatcher(String pattern, org.springframework.security.config.annotation.web.builders.HttpSecurity http, String servletPath) Create a newRequestMatcherinstance. This method is most interesting if more than one mappable servlet is registered in the servlet context, and you need to explicitly associate the pattern with a particular servlet based on the servlet path. In general, targeting this method with a servletPath of""is desired in order to target the default servlet context.- Parameters:
pattern- The mvc matching patternhttp- The security context being modifiedservletPath- The servlet path for the servlet to which the matcher should be associated.- Returns:
- A new RequestMatcher instance
-