Examples of FilterInvocation


Examples of org.springframework.security.web.FilterInvocation

     */
    @Test
    public void extraQuestionMarkStillMatches() {
        createFids("/someAdminPage.html*", null);

        FilterInvocation fi = createFilterInvocation("/someAdminPage.html", null, null, null);

        Collection<ConfigAttribute> response = fids.getAttributes(fi);
        assertEquals(def, response);

        fi = createFilterInvocation("/someAdminPage.html", null, "?", null);
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

        request.setMethod(method);
        request.setServletPath(servletPath);
        request.setPathInfo(pathInfo);
        request.setQueryString(queryString);

        return new FilterInvocation(request, new MockHttpServletResponse(), mock(FilterChain.class));
    }
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

    public void testSuccessfulInvocation() throws Throwable {
        // Setup a Context
        Authentication token = new TestingAuthenticationToken("Test", "Password", "NOT_USED");
        SecurityContextHolder.getContext().setAuthentication(token);

        FilterInvocation fi = createinvocation();

        when(ods.getAttributes(fi)).thenReturn(SecurityConfig.createList("MOCK_OK"));

        interceptor.invoke(fi);
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

    @Test
    public void afterInvocationIsNotInvokedIfExceptionThrown() throws Exception {
        Authentication token = new TestingAuthenticationToken("Test", "Password", "NOT_USED");
        SecurityContextHolder.getContext().setAuthentication(token);

        FilterInvocation fi = createinvocation();
        FilterChain chain = fi.getChain();

        doThrow(new RuntimeException()).when(chain).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class));
        when(ods.getAttributes(fi)).thenReturn(SecurityConfig.createList("MOCK_OK"));

        AfterInvocationManager aim = mock(AfterInvocationManager.class);
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

        RunAsManager runAsManager = mock(RunAsManager.class);
        when(runAsManager.buildRunAs(eq(token), any(), anyCollection())).thenReturn(new RunAsUserToken("key", "someone", "creds", token.getAuthorities(), token.getClass()));
        interceptor.setRunAsManager(runAsManager);

        FilterInvocation fi = createinvocation();
        FilterChain chain = fi.getChain();

        doThrow(new RuntimeException()).when(chain).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class));
        when(ods.getAttributes(fi)).thenReturn(SecurityConfig.createList("MOCK_OK"));

        AfterInvocationManager aim = mock(AfterInvocationManager.class);
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

        MockHttpServletResponse response = new MockHttpServletResponse();
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setServletPath("/secure/page.html");

        FilterChain chain = mock(FilterChain.class);
        FilterInvocation fi = new FilterInvocation(request, response, chain);

        return fi;
    }
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRequestURI("/test");
        // IPv4
        request.setRemoteAddr("192.168.1.1");
        WebSecurityExpressionRoot root = new WebSecurityExpressionRoot(mock(Authentication.class),
                new FilterInvocation(request, mock(HttpServletResponse.class), mock(FilterChain.class)));

        assertTrue(root.hasIpAddress("192.168.1.1"));

        // IPv6 Address
        request.setRemoteAddr("fa:db8:85a3::8a2e:370:7334");
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

    @Test
    public void addressesInIpRangeMatch() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRequestURI("/test");
        WebSecurityExpressionRoot root = new WebSecurityExpressionRoot(mock(Authentication.class),
                new FilterInvocation(request, mock(HttpServletResponse.class), mock(FilterChain.class)));
        for (int i=0; i < 255; i++) {
            request.setRemoteAddr("192.168.1." + i);
            assertTrue(root.hasIpAddress("192.168.1.0/24"));
        }
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

        cdm.setChannelProcessors(list);
        cdm.afterPropertiesSet();

        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));

        List<ConfigAttribute> cad = SecurityConfig.createList("xyz");

        cdm.decide(fi, cad);
        assertTrue(fi.getResponse().isCommitted());
    }
View Full Code Here

Examples of org.springframework.security.web.FilterInvocation

        cdm.setChannelProcessors(list);
        cdm.afterPropertiesSet();

        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));

        cdm.decide(fi, SecurityConfig.createList(new String[]{"abc", "ANY_CHANNEL"}));
        assertFalse(fi.getResponse().isCommitted());
    }
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.