Package org.springframework.security.web.util.matcher

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher.matches()


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

    private HttpServletRequest createRequestWithNullMethod(String path) {
        when(request.getQueryString()).thenReturn("doesntMatter");
        when(request.getServletPath()).thenReturn(path);
View Full Code Here


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

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

        assertFalse(matcher.matches(request));
    }

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

        RegexRequestMatcher matcher = new RegexRequestMatcher(".*", "GET");

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

        assertTrue(matcher.matches(request));
    }

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

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

        assertTrue(matcher.matches(request));
    }

    @Test
    public void requestHasNullMethodMatches() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", "GET");
View Full Code Here

    @Test
    public void requestHasNullMethodMatches() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", "GET");
        HttpServletRequest request = createRequestWithNullMethod("/something/here");
        assertTrue(matcher.matches(request));
    }

    // SEC-2084
    @Test
    public void requestHasNullMethodNoMatch() {
View Full Code Here

    // SEC-2084
    @Test
    public void requestHasNullMethodNoMatch() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", "GET");
        HttpServletRequest request = createRequestWithNullMethod("/nomatch");
        assertFalse(matcher.matches(request));
    }

    @Test
    public void requestHasNullMethodAndNullMatcherMatches() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", null);
View Full Code Here

    @Test
    public void requestHasNullMethodAndNullMatcherMatches() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", null);
        HttpServletRequest request = createRequestWithNullMethod("/something/here");
        assertTrue(matcher.matches(request));
    }

    @Test
    public void requestHasNullMethodAndNullMatcherNoMatch() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", null);
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.