Package org.picketlink.identity.federation.saml.v1.assertion

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


        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);
        assertEquals("urn:mace:dir:attribute-def:eduPersonAffiliation", attrib.getAttributeName());
        assertEquals("urn:mace:shibboleth:1.0:attributeNamespace:uri", attrib.getAttributeNamespace().toString());
View Full Code Here


        assertEquals("https://some-service.example.com/app/", restrictCond.get().get(0).toString());

        List<SAML11StatementAbstractType> statements = assertion.getStatements();
        assertEquals(2, statements.size());

        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));
View Full Code Here

        }

        List<SAML11AttributeDesignatorType> attributes = attr.get();
        for (SAML11AttributeDesignatorType attribute : attributes) {
            if (attribute instanceof SAML11AttributeType) {
                SAML11AttributeType sat = (SAML11AttributeType) attribute;
                assertionWriter.write(sat);
            } else
                throw logger.writerUnknownTypeError(attribute.getClass().getName());
        }
View Full Code Here

            }
            // Get the next start element
            startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
            String tag = startElement.getName().getLocalPart();
            if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) {
                SAML11AttributeType attribute = parseSAML11Attribute(xmlEventReader);
                attributeStatementType.add(attribute);
            } else if (JBossSAMLConstants.SUBJECT.get().equals(tag)) {
                SAML11SubjectParser parser = new SAML11SubjectParser();
                SAML11SubjectType subject = (SAML11SubjectType) parser.parse(xmlEventReader);
                attributeStatementType.setSubject(subject);
View Full Code Here

     * @throws ParsingException
     */
    public static SAML11AttributeType parseSAML11Attribute(XMLEventReader xmlEventReader) throws ParsingException {
        StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
        StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE.get());
        SAML11AttributeType attributeType = null;

        Attribute name = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAME));
        if (name == null)
            throw logger.parserRequiredAttribute("Name");
        String attribName = StaxParserUtil.getAttributeValue(name);

        Attribute namesp = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAMESPACE));
        if (namesp == null)
            throw logger.parserRequiredAttribute("Namespace");
        String attribNamespace = StaxParserUtil.getAttributeValue(namesp);

        attributeType = new SAML11AttributeType(attribName, URI.create(attribNamespace));

        attributeType.add(parseAttributeValue(xmlEventReader));

        parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType);
        return attributeType;
    }
View Full Code Here

        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);
        assertEquals("urn:mace:dir:attribute-def:eduPersonAffiliation", attrib.getAttributeName());
        assertEquals("urn:mace:shibboleth:1.0:attributeNamespace:uri", attrib.getAttributeNamespace().toString());

        List<Object> attribValues = attrib.get();
        assertTrue(attribValues.contains("member"));
        assertTrue(attribValues.contains("student"));

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // Lets do the writing
View Full Code Here

        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();
View Full Code Here

            List<SAML11ConditionAbstractType> typeOfConditions = conditions.get();
            if (typeOfConditions != null) {
                for (SAML11ConditionAbstractType typeCondition : typeOfConditions) {
                    if (typeCondition instanceof SAML11AudienceRestrictionCondition) {
                        SAML11AudienceRestrictionCondition art = (SAML11AudienceRestrictionCondition) typeCondition;
                        StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUDIENCE_RESTRICTION_CONDITION, ns);
                        List<URI> audiences = art.get();
                        if (audiences != null) {
                            for (URI audience : audiences) {
                                StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUDIENCE.get(), ns);
                                StaxUtil.writeCharacters(writer, audience.toString());
                                StaxUtil.writeEndElement(writer);
View Full Code Here

        // generate an id for the new assertion.
        String assertionID = IDGenerator.create("ID_");

        // lifetime and audience restrictions.
        Lifetime lifetime = wstContext.getRequestSecurityToken().getLifetime();
        SAML11AudienceRestrictionCondition restriction = null;
        AppliesTo appliesTo = wstContext.getRequestSecurityToken().getAppliesTo();
        if (appliesTo != null) {
            restriction = new SAML11AudienceRestrictionCondition();
            restriction.add(URI.create(WSTrustUtil.parseAppliesTo(appliesTo)));
        }
        SAML11ConditionsType conditions = new SAML11ConditionsType();
        conditions.setNotBefore(lifetime.getCreated());
        conditions.setNotOnOrAfter(lifetime.getExpires());
        conditions.add(restriction);
View Full Code Here

                break;
            String tag = StaxParserUtil.getStartElementName(startElement);

            if (SAML11Constants.AUDIENCE_RESTRICTION_CONDITION.equals(tag)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                SAML11AudienceRestrictionCondition restrictCond = new SAML11AudienceRestrictionCondition();

                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                if (StaxParserUtil.getStartElementName(startElement).equals(JBossSAMLConstants.AUDIENCE.get())) {
                    restrictCond.add(URI.create(StaxParserUtil.getElementText(xmlEventReader)));
                }
                EndElement theEndElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                StaxParserUtil.validate(theEndElement, SAML11Constants.AUDIENCE_RESTRICTION_CONDITION);
                conditions.add(restrictCond);
            } else
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.saml.v1.assertion.SAML11AttributeType

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.