Examples of ELRequestMatcher


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

*/
public class ELRequestMatcherTests {

    @Test
    public void testHasIpAddressTrue() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasIpAddress('1.1.1.1')");
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRemoteAddr("1.1.1.1");

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

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

        assertTrue(requestMatcher.matches(request));
    }

    @Test
    public void testHasIpAddressFalse() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasIpAddress('1.1.1.1')");
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRemoteAddr("1.1.1.2");

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

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

        assertFalse(requestMatcher.matches(request));
    }

    @Test
    public void testHasHeaderTrue() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasHeader('User-Agent','MSIE')");
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addHeader("User-Agent", "MSIE");

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

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

        assertTrue(requestMatcher.matches(request));
    }

    @Test
    public void testHasHeaderTwoEntries() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher(
                "hasHeader('User-Agent','MSIE') or hasHeader('User-Agent','Mozilla')");
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addHeader("User-Agent", "MSIE");

        assertTrue(requestMatcher.matches(request));

        request = new MockHttpServletRequest();
        request.addHeader("User-Agent", "Mozilla");

        assertTrue(requestMatcher.matches(request));

    }
View Full Code Here

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

    }

    @Test
    public void testHasHeaderFalse() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasHeader('User-Agent','MSIE')");
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addHeader("User-Agent", "wrong");

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

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

        assertFalse(requestMatcher.matches(request));
    }

    @Test
    public void testHasHeaderNull() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasHeader('User-Agent','MSIE')");
        MockHttpServletRequest request = new MockHttpServletRequest();

        assertFalse(requestMatcher.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.