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

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


        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

        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

        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

    }

    @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

        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

Related Classes of org.springframework.security.web.util.matcher.ELRequestMatcher

Copyright © 2018 www.massapicom. 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.