Examples of wasRedirectSent()


Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        MockHttpServletResponse response = new MockHttpServletResponse();
        MockFilterChain chain = new MockFilterChain();
        getProxy().doFilter(request, response, chain);

        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        String redirectURL = response.getHeader("Location");
        assertTrue(redirectURL.contains(GeoServerCasConstants.LOGIN_URI));
        assertTrue(redirectURL.endsWith("bar"));

        // test success
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        request = createRequest("/foo/bar");
        response = new MockHttpServletResponse();
        chain = new MockFilterChain();
        String ticket =loginUsingTicket(helper, request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertFalse(response.wasRedirectSent());


        SecurityContext ctx = (SecurityContext) request.getSession(false).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertNotNull(ctx);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        request = createRequest("/foo/bar");
        response = new MockHttpServletResponse();
        chain = new MockFilterChain();
        ticket =loginUsingTicket(helper, request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertFalse(response.wasRedirectSent());

       
        ctx = (SecurityContext) request.getSession(true).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertNotNull(ctx);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        chain = new MockFilterChain();
        ticket =loginUsingTicket(helper, request, response, chain);
        ctx = (SecurityContext) request.getSession(true).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertFalse(response.wasRedirectSent());
        auth = ctx.getAuthentication();
        assertNotNull(auth);
        assertNull(SecurityContextHolder.getContext().getAuthentication());
        // checkForAuthenticatedRole(auth);
        assertEquals(GeoServerUser.ROOT_USERNAME, auth.getPrincipal());
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        request = createRequest("/foo/bar");
        response = new MockHttpServletResponse();
        chain = new MockFilterChain();
        ticket =loginUsingTicket(helper, request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        redirectURL = response.getHeader("Location");
        assertTrue(redirectURL.contains("login"));
        ctx = (SecurityContext) request.getSession(true).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertNull(ctx);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        request.setupAddParameter("ticket", ticket);
        request.setQueryString("ticket=" + ticket);

        getProxy().doFilter(request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        redirectURL = response.getHeader("Location");
        assertTrue(redirectURL.contains(GeoServerCasConstants.LOGIN_URI));       
        ctx = (SecurityContext) request.getSession(true).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertNull(ctx);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        MockHttpServletRequest request = createRequest(pattern);
        MockHttpServletResponse response = new MockHttpServletResponse();
        MockFilterChain  chain = new MockFilterChain();
        loginUsingTicket(helper, request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertFalse(response.wasRedirectSent());


        SecurityContext ctx = (SecurityContext) request.getSession(false).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertNotNull(ctx);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        //getProxy().doFilter(request, response, chain);
        GeoServerLogoutFilter logoutFilter=
                (GeoServerLogoutFilter) getSecurityManager().loadFilter(GeoServerSecurityFilterChain.FORM_LOGOUT_FILTER);
        logoutFilter.doFilter(request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        String redirectUrl = response.getHeader("Location");
        assertNotNull(redirectUrl);
        assertTrue(redirectUrl.contains(GeoServerCasConstants.LOGOUT_URI));
        session = (MockHttpSession) request.getSession(false);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        request = createRequest(pattern);
        response = new MockHttpServletResponse();
        chain = new MockFilterChain();
        String ticket = loginUsingTicket(helper, request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertFalse(response.wasRedirectSent());


        ctx = (SecurityContext) request.getSession(false).getAttribute(
                HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
        assertNotNull(ctx);
View Full Code Here

Examples of com.mockrunner.mock.web.MockHttpServletResponse.wasRedirectSent()

        GeoServerCasAuthenticationFilter casFilter = (GeoServerCasAuthenticationFilter)
                getSecurityManager().loadFilter(casFilterName);
        //getProxy().doFilter(request, response, chain);
        casFilter.doFilter(request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        redirectUrl = response.getHeader("Location");
        assertNotNull(redirectUrl);
        assertFalse(redirectUrl.contains(GeoServerCasConstants.LOGOUT_URI));

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.