Package org.picketlink.test.identity.federation.web.mock

Examples of org.picketlink.test.identity.federation.web.mock.MockFilterChain


        MockHttpServletResponse filterResponse = new MockHttpServletResponse();
        ByteArrayOutputStream filterbaos = new ByteArrayOutputStream();
        filterResponse.setOutputStream(filterbaos);

        spEmpl.doFilter(filterRequest, filterResponse, new MockFilterChain());

        String spResponse = new String(filterbaos.toByteArray());
        Document spHTMLResponse = DocumentUtil.getDocument(spResponse);
        NodeList nodes = spHTMLResponse.getElementsByTagName("INPUT");
        Element inputElement = (Element) nodes.item(0);
View Full Code Here


        MockHttpServletResponse filterResponse = new MockHttpServletResponse();
        ByteArrayOutputStream filterbaos = new ByteArrayOutputStream();
        filterResponse.setOutputStream(filterbaos);

        spEmpl.doFilter(filterRequest, filterResponse, new MockFilterChain());
        String spResponse = new String(filterbaos.toByteArray());
        Document spHTMLResponse = DocumentUtil.getDocument(spResponse);
        nodes = spHTMLResponse.getElementsByTagName("INPUT");
        inputElement = (Element) nodes.item(0);
        logoutOrigResponse = inputElement.getAttributeNode("VALUE").getValue();
        relayState = null;
        if (nodes.getLength() > 1)
            relayState = ((Element) nodes.item(1)).getAttributeNode("VALUE").getValue();

        // Now the SP (employee app) has logged out and sending a status response to IDP
        Thread.currentThread().setContextClassLoader(mclIDP);
        session.setAttribute("SAMLResponse", logoutOrigResponse);
        session.setAttribute("RelayState", relayState);

        idp.testPost(request, response);

        idpResponse = new String(filterbaos.toByteArray());
        assertNotNull(idpResponse);

        htmlResponse = DocumentUtil.getDocument(idpResponse);
        assertNotNull(htmlResponse);
        nodes = htmlResponse.getElementsByTagName("INPUT");
        inputElement = (Element) nodes.item(0);
        logoutOrigResponse = inputElement.getAttributeNode("VALUE").getValue();

        relayState = null;
        if (nodes.getLength() > 1)
            relayState = ((Element) nodes.item(1)).getAttributeNode("VALUE").getValue();

        // Now we should have got a full success report from IDP
        MockContextClassLoader mclSPSales = setupTCL(profile + "/sp/employee");
        Thread.currentThread().setContextClassLoader(mclSPSales);
        SPFilter spSales = new SPFilter();

        spSales.init(filterConfig);

        filterRequest.addParameter("SAMLResponse", logoutOrigResponse);
        filterRequest.addParameter("RelayState", relayState);

        spSales.doFilter(filterRequest, filterResponse, new MockFilterChain());

        spResponse = new String(filterbaos.toByteArray());

        assertEquals(0, server.stack().getParticipants(session.getId()));
        assertEquals(0, server.stack().getNumOfParticipantsInTransit(session.getId()));
View Full Code Here

        MockHttpServletResponse filterResponse = new MockHttpServletResponse();
        ByteArrayOutputStream filterbaos = new ByteArrayOutputStream();
        filterResponse.setOutputStream(filterbaos);

        spEmpl.doFilter(filterRequest, filterResponse, new MockFilterChain());
        String spResponse = new String(filterbaos.toByteArray());
        Document spHTMLResponse = DocumentUtil.getDocument(spResponse);
        NodeList nodes = spHTMLResponse.getElementsByTagName("INPUT");
        Element inputElement = (Element) nodes.item(0);
        String idpResponse = inputElement.getAttributeNode("VALUE").getValue();
View Full Code Here

TOP

Related Classes of org.picketlink.test.identity.federation.web.mock.MockFilterChain

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.