Examples of RegexRequestMatcher


Examples of org.springframework.security.web.util.RegexRequestMatcher

    };
    protected final RegexRequestMatcher pattern;
    protected String patternString;

    public AbstractInterceptUrlUpdater(Element element) {
        this.pattern = new RegexRequestMatcher(element.getAttributeValue("pattern"), element.getAttributeValue("httpMethod"),
                Boolean.parseBoolean(element.getAttributeValue("caseInsensitive")));
        this.patternString = element.getAttributeValue("pattern");
    }
View Full Code Here

Examples of org.springframework.security.web.util.RegexRequestMatcher

    }

    private @Nullable RequestMatcher findMatchingRequestMatcher(String pattern) {
        for (RequestMatcher requestMatcher : _requestMap.keySet()) {
            if (requestMatcher instanceof RegexRequestMatcher) {
                RegexRequestMatcher regexMatcher = (RegexRequestMatcher) requestMatcher;
                Object otherPattern = getPattern(regexMatcher);
                if (pattern.equals(otherPattern.toString())) {
                    return regexMatcher;
                }
            }
View Full Code Here

Examples of org.springframework.security.web.util.RegexRequestMatcher

     * @param pattern the Regular Expression to match on (i.e. "/admin/.+")
     * @return the {@link HttpSecurity} for further customizations
     * @see RegexRequestMatcher
     */
    public HttpSecurity regexMatcher(String pattern) {
        return requestMatcher(new RegexRequestMatcher(pattern, null));
    }
View Full Code Here

Examples of org.springframework.security.web.util.RegexRequestMatcher

         */
        public static List<RequestMatcher> regexMatchers(HttpMethod httpMethod, String...regexPatterns) {
            String method = httpMethod == null ? null : httpMethod.toString();
            List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
            for(String pattern : regexPatterns) {
                matchers.add(new RegexRequestMatcher(pattern, method));
            }
            return matchers;
        }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher

     * @param pattern the Regular Expression to match on (i.e. "/admin/.+")
     * @return the {@link HttpSecurity} for further customizations
     * @see RegexRequestMatcher
     */
    public HttpSecurity regexMatcher(String pattern) {
        return requestMatcher(new RegexRequestMatcher(pattern, null));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher

         */
        public static List<RequestMatcher> regexMatchers(HttpMethod httpMethod, String...regexPatterns) {
            String method = httpMethod == null ? null : httpMethod.toString();
            List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
            for(String pattern : regexPatterns) {
                matchers.add(new RegexRequestMatcher(pattern, method));
            }
            return matchers;
        }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher

        assertTrue(matcher.matches(request));
    }

    @Test
    public void requestHasNullMethodAndNullMatcherNoMatch() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", null);
        HttpServletRequest request = createRequestWithNullMethod("/nomatch");
        assertFalse(matcher.matches(request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher

    @Mock
    private HttpServletRequest request;

    @Test
    public void doesntMatchIfHttpMethodIsDifferent() throws Exception {
        RegexRequestMatcher matcher = new RegexRequestMatcher(".*", "GET");

        MockHttpServletRequest request = new MockHttpServletRequest("POST", "/anything");

        assertFalse(matcher.matches(request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher

        assertFalse(matcher.matches(request));
    }

    @Test
    public void matchesIfHttpMethodAndPathMatch() throws Exception {
        RegexRequestMatcher matcher = new RegexRequestMatcher(".*", "GET");

        MockHttpServletRequest request = new MockHttpServletRequest("GET", "/anything");
        request.setServletPath("/anything");

        assertTrue(matcher.matches(request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher

        assertTrue(matcher.matches(request));
    }

    @Test
    public void queryStringIsMatcherCorrectly() throws Exception {
        RegexRequestMatcher matcher = new RegexRequestMatcher(".*\\?x=y", "GET");

        MockHttpServletRequest request = new MockHttpServletRequest("GET", "/any/path?x=y");
        request.setServletPath("/any");
        request.setPathInfo("/path");
        request.setQueryString("x=y");

        assertTrue(matcher.matches(request));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.