Package org.picketlink.identity.federation.saml.v2.protocol

Examples of org.picketlink.identity.federation.saml.v2.protocol.ResponseType


        return responseType;
    }

    private ResponseType getResponseTypeAndCheckSignature(MockCatalinaResponse response, ByteArrayOutputStream bos) {
        ResponseType responseType = getResponseType(response, bos);

        try {
            if (bos == null) {
                assertTrue(RedirectBindingSignatureUtil.validateSignature(response.redirectString, getAuthenticator()
                        .getKeyManager().getPublicKey(CERTIFICATE_ALIAS), RedirectBindingSignatureUtil
                        .getSignatureValueFromSignedURL(response.redirectString)));
            } else {
                assertTrue("No Signature element found.", responseType.getSignature() != null);
            }
        } catch (Exception e) {
            e.printStackTrace();
            fail("Error checking response signature.");
        }
View Full Code Here


    public void testSAMLResponseParse() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/saml2/saml2-response.xml");

        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(configStream);
        assertNotNull("ResponseType is not null", response);

        assertEquals(XMLTimeUtil.parse("2009-05-26T14:06:26.362-05:00"), response.getIssueInstant());
        assertEquals("2.0", response.getVersion());
        assertEquals("ID_1164e0fc-576d-4797-b11c-3d049520f566", response.getID());

        // Issuer
        assertEquals("testIssuer", response.getIssuer().getValue());

        // Status
        StatusType status = response.getStatus();
        assertEquals("urn:oasis:names:tc:SAML:2.0:status:Success", status.getStatusCode().getValue().toString());

        List<RTChoiceType> assertionList = response.getAssertions();
        assertEquals(2, assertionList.size());

        AssertionType assertion1 = assertionList.get(0).getAssertion();
        assertEquals("ID_0be488d8-7089-4892-8aeb-83594c800706", assertion1.getID());
        assertEquals(XMLTimeUtil.parse("2009-05-26T14:06:26.362-05:00"), assertion1.getIssueInstant());
View Full Code Here

    public void testAssertionWithSubjectAndAttributes() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/saml2/saml2-response-assertion-subject.xml");

        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(configStream);
        assertNotNull(response);

        assertEquals("ID_45df1ea5-81e4-4147-a39a-43a4ef613f4e", response.getID());
        assertEquals(XMLTimeUtil.parse("2010-11-04T00:19:16.847-05:00"), response.getIssueInstant());
        assertEquals("2.0", response.getVersion());
        assertEquals("http://localhost:8080/employee/", response.getDestination());
        assertEquals("ID_04ded476-d73c-48af-b3a9-232a52905ffb", response.getInResponseTo());

        // Issuer
        assertEquals("http://localhost:8080/idp/", response.getIssuer().getValue());

        // Status
        StatusType status = response.getStatus();
        assertEquals("urn:oasis:names:tc:SAML:2.0:status:Success", status.getStatusCode().getValue().toString());

        // Get the assertion
        AssertionType assertion = response.getAssertions().get(0).getAssertion();
        assertEquals("ID_8be1534d-9155-4837-9f26-70ea2c15e327", assertion.getID());
        assertEquals(XMLTimeUtil.parse("2010-11-04T00:19:16.842-05:00"), assertion.getIssueInstant());
        assertEquals("2.0", assertion.getVersion());

        assertEquals("http://localhost:8080/idp/", assertion.getIssuer().getValue());
View Full Code Here

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("saml-xacml/saml-xacml-response-1.xml");
        validateSchema(configStream);
        configStream = tcl.getResourceAsStream("saml-xacml/saml-xacml-response-1.xml");
        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(configStream);
        assertNotNull("ResponseType is not null", response);

        // Get the assertion
        AssertionType assertion = response.getAssertions().get(0).getAssertion();
        assertEquals("ID_response-id_1", assertion.getID());
        assertEquals(XMLTimeUtil.parse("2008-03-19T22:17:13Z"), assertion.getIssueInstant());
        assertEquals("2.0", assertion.getVersion());

        XACMLAuthzDecisionStatementType xacmlStat = (XACMLAuthzDecisionStatementType) assertion.getStatements().iterator()
View Full Code Here

    public void testSAMLResponseADFSClaims() throws Exception {
        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/saml2/saml2-response-adfs-claims.xml");

        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(configStream);
        assertNotNull("ResponseType is not null", response);

        List<RTChoiceType> choices = response.getAssertions();
        assertEquals(1, choices.size());
        RTChoiceType rtc = choices.get(0);
        AssertionType assertion = rtc.getAssertion();
        Set<StatementAbstractType> statements = assertion.getStatements();
        for (StatementAbstractType statement : statements) {
View Full Code Here

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        InputStream configStream = tcl.getResourceAsStream("parser/saml2/saml2-response-salesforce.xml");
        validateSchema(configStream);
        configStream = tcl.getResourceAsStream("parser/saml2/saml2-response-salesforce.xml");
        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(configStream);
        assertNotNull("ResponseType is not null", response);
    }
View Full Code Here

        InputStream configStream = tcl.getResourceAsStream(fileName);
        /*
         * validateSchema(configStream); configStream = tcl.getResourceAsStream(fileName);
         */
        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(configStream);
        assertNotNull("ResponseType is not null", response);
    }
View Full Code Here

    public void testRoleExtraction() throws Exception {
        String file = "parser/saml2/saml2-response-assertion-subject.xml";
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
        assertNotNull(is);
        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(is);
        List<RTChoiceType> assertionList = response.getAssertions();
        assertEquals(1, assertionList.size());
        RTChoiceType rtc = assertionList.get(0);
        AssertionType assertion = rtc.getAssertion();
        List<String> roles = AssertionUtil.getRoles(assertion, null);
        assertEquals(2, roles.size());
View Full Code Here

    public void testRoleExtractionForMultiValuedAttribute() throws Exception {
        String file = "parser/saml2/saml2-response-assertion-rolemultivalue.xml";
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
        assertNotNull(is);
        SAMLParser parser = new SAMLParser();
        ResponseType response = (ResponseType) parser.parse(is);
        List<RTChoiceType> assertionList = response.getAssertions();
        assertEquals(1, assertionList.size());
        RTChoiceType rtc = assertionList.get(0);
        AssertionType assertion = rtc.getAssertion();
        List<String> roles = AssertionUtil.getRoles(assertion, null);
        assertEquals(2, roles.size());
View Full Code Here

        SAML2Response saml2Response = new SAML2Response();

        SPInfoHolder sp = new SPInfoHolder();
        sp.setResponseDestinationURI("http://fakesp");
        sp.setIssuer("http://fakesp");
        ResponseType rt = saml2Response.createResponseType("response111", sp, idp, issuerHolder);
        Assert.assertNotNull(rt);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        saml2Response.marshall(rt, baos);
    }
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.saml.v2.protocol.ResponseType

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.