Examples of SAML11SubjectConfirmationType


Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

            SAML11NameIdentifierType nameid = choice.getNameID();
            if (nameid != null) {
                write(nameid);
            }

            SAML11SubjectConfirmationType confirmation = choice.getSubjectConfirmation();
            if (confirmation != null)
                write(confirmation);
        }

        SAML11SubjectConfirmationType confirmation = subject.getSubjectConfirmation();
        if (confirmation != null)
            write(confirmation);

        StaxUtil.writeEndElement(writer);
        StaxUtil.flush(writer);
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

                }

                SAML11SubjectTypeChoice subChoice = new SAML11SubjectTypeChoice(nameID);
                subject.setChoice(subChoice);
            } else if (JBossSAMLConstants.SUBJECT_CONFIRMATION.get().equalsIgnoreCase(tag)) {
                SAML11SubjectConfirmationType subjectConfirmationType = SAML11ParserUtil
                        .parseSAML11SubjectConfirmation(xmlEventReader);
                subject.setSubjectConfirmation(subjectConfirmationType);
            } else
                throw logger.parserUnknownTag(tag, peekedElement.getLocation());
        }
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

            confirmationMethod = SAMLUtil.SAML11_HOLDER_OF_KEY_URI;
            keyInfoType = wstContext.getProofTokenInfo();
        } else
            confirmationMethod = SAMLUtil.SAML11_BEARER_URI;

        SAML11SubjectConfirmationType subjectConfirmation = new SAML11SubjectConfirmationType();
        subjectConfirmation.addConfirmationMethod(URI.create(confirmationMethod));
        // TODO: set the key info.
        if (keyInfoType != null)
            throw logger.notImplementedYet("KeyInfoType");

        // create a subject using the caller principal or on-behalf-of principal.
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

     * @return
     * @throws ParsingException
     */
    public static SAML11SubjectConfirmationType parseSAML11SubjectConfirmation(XMLEventReader xmlEventReader)
            throws ParsingException {
        SAML11SubjectConfirmationType subjectConfirmationType = new SAML11SubjectConfirmationType();

        StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader);

        // There may be additional things under subject confirmation
        while (xmlEventReader.hasNext()) {
            XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
            if (xmlEvent instanceof EndElement) {
                EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                StaxParserUtil.validate(endElement, JBossSAMLConstants.SUBJECT_CONFIRMATION.get());
                break;
            }

            if (xmlEvent instanceof StartElement) {
                startElement = (StartElement) xmlEvent;

                String startTag = StaxParserUtil.getStartElementName(startElement);

                if (startTag.equals(SAML11Constants.CONFIRMATION_METHOD)) {
                    startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                    String method = StaxParserUtil.getElementText(xmlEventReader);
                    subjectConfirmationType.addConfirmationMethod(URI.create(method));
                }

                else if (startTag.equals(JBossSAMLConstants.SUBJECT_CONFIRMATION_DATA.get())) {
                    startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                    SubjectConfirmationDataType subjectConfirmationData = parseSubjectConfirmationData(xmlEventReader);
                    subjectConfirmationType.setSubjectConfirmationData(subjectConfirmationData);
                } else if (startTag.equals(JBossSAMLConstants.KEY_INFO.get())) {
                    Element keyInfo = StaxParserUtil.getDOMElement(xmlEventReader);
                    subjectConfirmationType.setKeyInfo(keyInfo);
                } else
                    throw logger.parserUnknownTag(startTag, startElement.getLocation());
            }
        }
        return subjectConfirmationType;
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

        SAML11NameIdentifierType nameID = subject.getChoice().getNameID();
        assertEquals("Unexpected NameIdentifier format", SAML11Constants.FORMAT_UNSPECIFIED, nameID.getFormat().toString());
        assertEquals("Unexpected NameIdentifier value", principal, nameID.getValue());

        SAML11SubjectConfirmationType subjType = subject.getSubjectConfirmation();
        assertEquals("Unexpected confirmation method", confirmationMethod, subjType.getConfirmationMethod().get(0).toString());

        // validate the assertion conditions.
        assertNotNull("Unexpected null conditions", assertion.getConditions());
        assertEquals(lifetime.getCreated(), assertion.getConditions().getNotBefore());
        assertEquals(lifetime.getExpires(), assertion.getConditions().getNotOnOrAfter());
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

        SAML11SubjectType subject = stat.getSubject();
        SAML11SubjectType.SAML11SubjectTypeChoice choice = subject.getChoice();
        assertEquals("user@idp.example.org", choice.getNameID().getValue());
        assertEquals("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", choice.getNameID().getFormat().toString());

        SAML11SubjectConfirmationType subjectConfirm = subject.getSubjectConfirmation();
        URI confirmationMethod = subjectConfirm.getConfirmationMethod().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:cm:bearer", confirmationMethod.toString());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // Lets do the writing
        SAML11AssertionWriter writer = new SAML11AssertionWriter(StaxUtil.getXMLStreamWriter(baos));
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

        SAML11SubjectType subject = stat.getSubject();
        SAML11SubjectType.SAML11SubjectTypeChoice choice = subject.getChoice();
        assertEquals("user@idp.example.org", choice.getNameID().getValue());
        assertEquals("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", choice.getNameID().getFormat().toString());

        SAML11SubjectConfirmationType subjectConfirm = subject.getSubjectConfirmation();
        URI confirmationMethod = subjectConfirm.getConfirmationMethod().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:cm:bearer", confirmationMethod.toString());

        SAML11AttributeStatementType attribStat = (SAML11AttributeStatementType) assertion.getStatements().get(1);
        assertNotNull(attribStat);
        subject = attribStat.getSubject();

        choice = subject.getChoice();
        assertEquals("user@idp.example.org", choice.getNameID().getValue());
        assertEquals("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", choice.getNameID().getFormat().toString());

        subjectConfirm = subject.getSubjectConfirmation();
        confirmationMethod = subjectConfirm.getConfirmationMethod().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:cm:bearer", confirmationMethod.toString());

        List<SAML11AttributeType> attribs = attribStat.get();
        assertEquals(1, attribs.size());
        SAML11AttributeType attrib = attribs.get(0);
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

        SAML11AttributeStatementType attrStat = (SAML11AttributeStatementType) statements.get(0);
        SAML11SubjectType subject = attrStat.getSubject();
        SAML11SubjectTypeChoice choice = subject.getChoice();
        SAML11NameIdentifierType nameID = choice.getNameID();
        assertEquals("johnq", nameID.getValue());
        SAML11SubjectConfirmationType subjConf = subject.getSubjectConfirmation();
        URI confirmationMethod = subjConf.getConfirmationMethod().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:cm:artifact", confirmationMethod.toString());

        List<SAML11AttributeType> attributes = attrStat.get();
        assertEquals(4, attributes.size());
        SAML11AttributeType attr = attributes.get(0);
        assertEquals("uid", attr.getAttributeName());
        assertEquals("http://jboss.org/test", attr.getAttributeNamespace().toString());
        assertEquals("12345", attr.get().get(0));

        attr = attributes.get(1);
        assertEquals("groupMembership", attr.getAttributeName());
        assertEquals("http://jboss.org/test", attr.getAttributeNamespace().toString());
        assertEquals("uugid=middleware.staff,ou=Groups,dc=vt,dc=edu", attr.get().get(0));

        attr = attributes.get(2);
        assertEquals("eduPersonAffiliation", attr.getAttributeName());
        assertEquals("http://jboss.org/test", attr.getAttributeNamespace().toString());
        assertEquals("staff", attr.get().get(0));

        attr = attributes.get(3);
        assertEquals("accountState", attr.getAttributeName());
        assertEquals("http://jboss.org/test", attr.getAttributeNamespace().toString());
        assertEquals("ACTIVE", attr.get().get(0));

        SAML11AuthenticationStatementType authStat = (SAML11AuthenticationStatementType) statements.get(1);
        assertEquals(XMLTimeUtil.parse("2008-12-10T14:12:14.741Z"), authStat.getAuthenticationInstant());
        assertEquals("urn:oasis:names:tc:SAML:1.0:am:password", authStat.getAuthenticationMethod().toString());
        subject = authStat.getSubject();
        choice = subject.getChoice();
        nameID = choice.getNameID();
        assertEquals("johnq", nameID.getValue());
        subjConf = subject.getSubjectConfirmation();
        confirmationMethod = subjConf.getConfirmationMethod().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:cm:artifact", confirmationMethod.toString());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // Lets do the writing
        SAML11AssertionWriter writer = new SAML11AssertionWriter(StaxUtil.getXMLStreamWriter(baos));
View Full Code Here

Examples of org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectConfirmationType

        assertEquals("urn:picketlink:auth", authStat.getAuthenticationMethod().toString());
        SAML11SubjectType subject = authStat.getSubject();
        SAML11SubjectTypeChoice choice = subject.getChoice();
        SAML11NameIdentifierType nameID = choice.getNameID();
        assertEquals("anil", nameID.getValue());
        SAML11SubjectConfirmationType subjConf = subject.getSubjectConfirmation();
        URI confirmationMethod = subjConf.getConfirmationMethod().get(0);
        assertEquals("urn:oasis:names:tc:SAML:1.0:cm:holder-of-key", confirmationMethod.toString());
        assertNotNull(subjConf.getKeyInfo());

        Element sig = assertion.getSignature();
        assertNotNull(sig);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
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.