Search in sources :

Example 1 with DispatcherTypeRequestMatcher

use of org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher in project spring-security by spring-projects.

the class AbstractRequestMatcherRegistry method dispatcherTypeMatchers.

/**
 * Maps a {@link List} of
 * {@link org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher}
 * instances.
 * @param method the {@link HttpMethod} to use or {@code null} for any
 * {@link HttpMethod}.
 * @param dispatcherTypes the dispatcher types to match against
 * @return the object that is chained after creating the {@link RequestMatcher}
 */
public C dispatcherTypeMatchers(@Nullable HttpMethod method, DispatcherType... dispatcherTypes) {
    Assert.state(!this.anyRequestConfigured, "Can't configure dispatcherTypeMatchers after anyRequest");
    List<RequestMatcher> matchers = new ArrayList<>();
    for (DispatcherType dispatcherType : dispatcherTypes) {
        matchers.add(new DispatcherTypeRequestMatcher(dispatcherType, method));
    }
    return chainRequestMatchers(matchers);
}
Also used : DispatcherTypeRequestMatcher(org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher) RegexRequestMatcher(org.springframework.security.web.util.matcher.RegexRequestMatcher) RequestMatcher(org.springframework.security.web.util.matcher.RequestMatcher) AnyRequestMatcher(org.springframework.security.web.util.matcher.AnyRequestMatcher) MvcRequestMatcher(org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher) AntPathRequestMatcher(org.springframework.security.web.util.matcher.AntPathRequestMatcher) ArrayList(java.util.ArrayList) DispatcherType(jakarta.servlet.DispatcherType) DispatcherTypeRequestMatcher(org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher)

Aggregations

DispatcherType (jakarta.servlet.DispatcherType)1 ArrayList (java.util.ArrayList)1 MvcRequestMatcher (org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher)1 AntPathRequestMatcher (org.springframework.security.web.util.matcher.AntPathRequestMatcher)1 AnyRequestMatcher (org.springframework.security.web.util.matcher.AnyRequestMatcher)1 DispatcherTypeRequestMatcher (org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher)1 RegexRequestMatcher (org.springframework.security.web.util.matcher.RegexRequestMatcher)1 RequestMatcher (org.springframework.security.web.util.matcher.RequestMatcher)1