Package org.picketlink.identity.federation.core.saml.v2.writers

Examples of org.picketlink.identity.federation.core.saml.v2.writers.SAMLResponseWriter


                throw new RuntimeException("Unknown statement type:" + statement);
        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // Lets do the writing
        SAMLResponseWriter writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(response);
        String writtenString = new String(baos.toByteArray());
        Logger.getLogger(SAMLResponseParserTestCase.class).debug(writtenString);
        validateSchema(writtenString);
    }
View Full Code Here


        assertEquals("urn:oasis:names:tc:SAML:2.0:status:Responder", status.getStatusCode().getValue().toString());
        assertEquals("urn:oasis:names:tc:SAML:2.0:status:Success", status.getStatusCode().getStatusCode().getValue().toString());

        // Let us do some writing - currently only visual inspection. We will do proper validation later.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        SAMLResponseWriter writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(response, new QName(PROTOCOL_NSURI.get(), LOGOUT_RESPONSE.get(), "samlp"));

        ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
        DocumentUtil.getDocument(bis); // throws exceptions

        baos = new ByteArrayOutputStream();
        // Lets do the writing
        writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(response, new QName(PROTOCOL_NSURI.get(), LOGOUT_RESPONSE.get(), "samlp"));
        String writtenString = new String(baos.toByteArray());
        Logger.getLogger(SAMLSloResponseParserTestCase.class).debug(writtenString);
        validateSchema(writtenString);
    }
View Full Code Here

        refType = (AuthnContextDeclRefType) authnContext.getURIType().iterator().next();
        assertEquals("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", refType.getValue().toASCIIString());

        // Let us do some writing - currently only visual inspection. We will do proper validation later.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        SAMLResponseWriter writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(response);

        ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
        DocumentUtil.getDocument(bis); // throws exceptions

        baos = new ByteArrayOutputStream();
        // Lets do the writing
        writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(response);
        String writtenString = new String(baos.toByteArray());
        Logger.getLogger(SAMLResponseParserTestCase.class).debug(writtenString);
        validateSchema(writtenString);
    }
View Full Code Here

                throw new RuntimeException("attrib value not found");
        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // Lets do the writing
        SAMLResponseWriter writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(response);
        String writtenString = new String(baos.toByteArray());
        Logger.getLogger(SAMLResponseParserTestCase.class).debug(writtenString);
        validateSchema(writtenString);
    }
View Full Code Here

        AssertionType assertion = rt.getAssertions().get(0).getAssertion();
        assertion.addStatement(attrStat);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        SAMLResponseWriter writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        writer.write(rt);

        Document samlDom = DocumentUtil.getDocument(new String(baos.toByteArray()));

        NodeList nl = samlDom.getElementsByTagNameNS(JBossSAMLURIConstants.ASSERTION_NSURI.get(), "Attribute");
        assertEquals("nodes = 2", 2, nl.getLength());
View Full Code Here

        assertNotNull(convertedDoc);

        // Now for the writing part
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(baos));
        samlWriter.write(responseType);

        Document doc = DocumentUtil.getDocument(new ByteArrayInputStream(baos.toByteArray()));
        JAXPValidationUtil.validate(DocumentUtil.getNodeAsStream(doc));
    }
View Full Code Here

             * saml2Response.createResponseType(ID, issuerInfo, assertion);
             */
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            XMLStreamWriter xmlStreamWriter = StaxUtil.getXMLStreamWriter(baos);

            SAMLResponseWriter samlResponseWriter = new SAMLResponseWriter(xmlStreamWriter);
            samlResponseWriter.write(samlResponseType);
            Document responseDocument = DocumentUtil.getDocument(new ByteArrayInputStream(baos.toByteArray()));

            if (soapVersion.equals("1.2")) {
                returnSOAPMessage = SOAPUtil.createSOAP12();
            } else {
View Full Code Here

     */
    public Document convert(StatusResponseType responseType) throws ProcessingException, ConfigurationException,
            ParsingException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        SAMLResponseWriter writer = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(bos));

        if (responseType instanceof ResponseType) {
            ResponseType response = (ResponseType) responseType;
            writer.write(response);
        } else {
            writer.write(responseType, new QName(PROTOCOL_NSURI.get(), LOGOUT_RESPONSE.get(), "samlp"));
        }

        return DocumentUtil.getDocument(new ByteArrayInputStream(bos.toByteArray()));
    }
View Full Code Here

     * @param responseType
     * @param os
     * @throws ProcessingException
     */
    public void marshall(ResponseType responseType, OutputStream os) throws ProcessingException {
        SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(os));
        samlWriter.write(responseType);
    }
View Full Code Here

     * @param responseType
     * @param writer
     * @throws ProcessingException
     */
    public void marshall(ResponseType responseType, Writer writer) throws ProcessingException {
        SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(writer));
        samlWriter.write(responseType);
    }
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.saml.v2.writers.SAMLResponseWriter

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.