Package org.picketlink.identity.federation.core.parsers.saml

Examples of org.picketlink.identity.federation.core.parsers.saml.SAMLParser


    @Test
    public void testSAML11RequestWithAssertionArtifact() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/saml1/saml1-request-assertionartifact.xml");

        SAMLParser parser = new SAMLParser();
        SAML11RequestType request = (SAML11RequestType) parser.parse(configStream);
        assertNotNull(request);

        assertEquals(1, request.getMajorVersion());
        assertEquals(1, request.getMinorVersion());
        assertEquals("rid", request.getID());
View Full Code Here


    @Test
    public void testSAML11RequestWithAssertionIDReference() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/saml1/saml1-request-assertionIDref.xml");

        SAMLParser parser = new SAMLParser();
        SAML11RequestType request = (SAML11RequestType) parser.parse(configStream);
        assertNotNull(request);

        assertEquals(1, request.getMajorVersion());
        assertEquals(1, request.getMinorVersion());
        assertEquals("rid", request.getID());
View Full Code Here

        }
    }

    @Test
    public void testStore() throws Exception {
        SAMLParser parser = new SAMLParser();

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream is = tcl.getResourceAsStream("saml2/metadata/idp-entitydescriptor.xml");
        assertNotNull("Inputstream not null", is);

        EntityDescriptorType edt = (EntityDescriptorType) parser.parse(is);
        assertNotNull(edt);
        FileBasedMetadataConfigurationStore fbd = new FileBasedMetadataConfigurationStore();
        fbd.persist(edt, id);

        EntityDescriptorType loaded = fbd.load(id);
View Full Code Here

        String resourceName = "saml-xacml/saml-xacml-request.xml";

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream is = tcl.getResourceAsStream(resourceName);

        SAMLParser parser = new SAMLParser();
        RequestAbstractType req = (RequestAbstractType) parser.parse(is);
        assertNotNull(req);
        assertTrue(req instanceof XACMLAuthzDecisionQueryType);

        XACMLAuthzDecisionQueryType xadqt = (XACMLAuthzDecisionQueryType) req;
        RequestType requestType = xadqt.getRequest();
View Full Code Here

        String resourceName = "saml-xacml/saml-xacml-request-2.xml";

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream is = tcl.getResourceAsStream(resourceName);

        SAMLParser parser = new SAMLParser();
        RequestAbstractType req = (RequestAbstractType) parser.parse(is);
        assertNotNull(req);
        assertTrue(req instanceof XACMLAuthzDecisionQueryType);

        XACMLAuthzDecisionQueryType xadqt = (XACMLAuthzDecisionQueryType) req;
        RequestType requestType = xadqt.getRequest();
View Full Code Here

    public void testWriteSPSSODescriptor() throws Exception {
        String fileName = "saml2/metadata/sp-entitydescriptor.xml";
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
        assertNotNull(is);

        SAMLParser parser = new SAMLParser();
        EntityDescriptorType entityDesc = (EntityDescriptorType) parser.parse(is);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        XMLStreamWriter writer = StaxUtil.getXMLStreamWriter(baos);
View Full Code Here

    public void testWriteEntityDescWithContactPerson() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream is = tcl.getResourceAsStream("saml2/metadata/sp-entitydescOrgContact.xml");
        assertNotNull("Inputstream not null", is);

        SAMLParser parser = new SAMLParser();
        EntityDescriptorType entity = (EntityDescriptorType) parser.parse(is);
        assertNotNull(entity);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        XMLStreamWriter writer = StaxUtil.getXMLStreamWriter(baos);
View Full Code Here

            if (!isValid)
                throw new IOException(ErrorCodes.VALIDATION_CHECK_FAILED);

            try {
                InputStream base64DecodedResponse = RedirectBindingUtil.base64DeflateDecode(samlResponse);
                SAMLParser parser = new SAMLParser();
                SAML11ResponseType saml11Response = (SAML11ResponseType) parser.parse(base64DecodedResponse);

                List<SAML11AssertionType> assertions = saml11Response.get();
                if (assertions.size() > 1) {
                    logger.trace("More than one assertion from IDP. Considering the first one.");
                }
View Full Code Here

            return;

        Object metadata = null;
        try {
            Document samlDocument = DocumentUtil.getDocument(is);
            SAMLParser parser = new SAMLParser();
            metadata = parser.parse(DocumentUtil.getNodeAsStream(samlDocument));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        IDPSSODescriptorType idpSSO = null;
        if (metadata instanceof EntitiesDescriptorType) {
View Full Code Here

        authenticationHandler.generateSAMLRequest(request, response);
        verificationHandler.generateSAMLRequest(request, response);

        // Parse document and verify that ID is saved in Http session
        Document samlReqDoc = response.getResultingDocument();
        SAMLParser parser = new SAMLParser();
        AuthnRequestType authnRequest = (AuthnRequestType) parser.parse(DocumentUtil.getNodeAsStream(samlReqDoc));
        assertEquals(authnRequest.getID(), servletRequest.getSession().getAttribute(GeneralConstants.AUTH_REQUEST_ID));

        // 3) SEND SAML AUTHENTICATION REQUEST TO IDP

        // Generate request and response for IDP
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.parsers.saml.SAMLParser

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.