Examples of GeoServerLogoutFilter


Examples of org.geoserver.security.filter.GeoServerLogoutFilter

        //request.getSession().setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, ctx);
        SecurityContextHolder.setContext(ctx);
        response = new MockHttpServletResponse();
        chain = new MockFilterChain();
        //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));
View Full Code Here

Examples of org.geoserver.security.filter.GeoServerLogoutFilter

        assertTrue(auth.getAuthorities().contains(new GeoServerRole(rootRole)));
        assertTrue(auth.getAuthorities().contains(new GeoServerRole(derivedRole)));

        // Test logout               
       
        GeoServerLogoutFilter logoutFilter= (GeoServerLogoutFilter) getSecurityManager().loadFilter(GeoServerSecurityFilterChain.FORM_LOGOUT_FILTER);
        request= createRequest("/j_spring_security_logout_foo");
        HttpSession session = request.getSession(true);
        session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, ctx);
        SecurityContextHolder.getContext().setAuthentication(auth);

        response= new MockHttpServletResponse();
        chain = new MockFilterChain();            
        //getProxy().doFilter(request, response, chain);
        logoutFilter.doFilter(request, response,chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        tmp = response.getHeader("Location");
        assertNotNull(tmp);
        assertTrue(tmp.endsWith(GeoServerLogoutFilter.URL_AFTER_LOGOUT));
View Full Code Here

Examples of org.geoserver.security.filter.GeoServerLogoutFilter

        Cookie cookie = (Cookie) response.getCookies().get(0);
        assertNotNull(cookie.getValue());
       
         
        // check logout
        GeoServerLogoutFilter logoutFilter= (GeoServerLogoutFilter) getSecurityManager().loadFilter(GeoServerSecurityFilterChain.FORM_LOGOUT_FILTER);
        request= createRequest("/j_spring_security_logout_foo");
        session = request.getSession(true);
        session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, ctx);
        SecurityContextHolder.getContext().setAuthentication(auth);       
        response= new MockHttpServletResponse();       
        chain = new MockFilterChain();       
       
        //getProxy().doFilter(request, response, chain);
        logoutFilter.doFilter(request, response, chain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());
        assertTrue(response.wasRedirectSent());
        tmp = response.getHeader("Location");
        assertNotNull(tmp);
        assertTrue(tmp.endsWith(GeoServerLogoutFilter.URL_AFTER_LOGOUT));
View Full Code Here

Examples of org.geoserver.security.filter.GeoServerLogoutFilter

     * @param skipHandlerName
     * @throws IOException
     * @throws ServletException
     */
    public void doLogout(GeoServerSecurityManager manager,HttpServletRequest request,HttpServletResponse response,String... skipHandlerName) throws IOException, ServletException{
        GeoServerLogoutFilter filter = (GeoServerLogoutFilter)manager.loadFilter(GeoServerSecurityFilterChain.FORM_LOGOUT_FILTER);
        if (filter==null) {
            LOGGER.warning("Cannot find filter: "+GeoServerSecurityFilterChain.FORM_LOGOUT_FILTER);
            return;
        }
        filter.doLogout(request, response, skipHandlerName);
    }
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.