Examples of SAML11AttributeStatementType


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

    public static List<String> getRoles(SAML11AssertionType assertion, List<String> roleKeys) {
        List<String> roles = new ArrayList<String>();
        List<SAML11StatementAbstractType> statements = assertion.getStatements();
        for (SAML11StatementAbstractType statement : statements) {
            if (statement instanceof SAML11AttributeStatementType) {
                SAML11AttributeStatementType attributeStatement = (SAML11AttributeStatementType) statement;
                List<SAML11AttributeType> attributes = attributeStatement.get();
                for (SAML11AttributeType attr : attributes) {
                    if (roleKeys != null && roleKeys.size() > 0) {
                        if (!roleKeys.contains(attr.getAttributeName()))
                            continue;
                    }
View Full Code Here

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

            } else if (SAML11Constants.AUTHENTICATION_STATEMENT.equals(tag)) {
                startElement = (StartElement) xmlEvent;
                SAML11AuthenticationStatementType authStat = SAML11ParserUtil.parseAuthenticationStatement(xmlEventReader);
                assertion.add(authStat);
            } else if (SAML11Constants.ATTRIBUTE_STATEMENT.equalsIgnoreCase(tag)) {
                SAML11AttributeStatementType attributeStatementType = SAML11ParserUtil
                        .parseSAML11AttributeStatement(xmlEventReader);
                assertion.add(attributeStatementType);
            } else if (SAML11Constants.AUTHORIZATION_DECISION_STATEMENT.equalsIgnoreCase(tag)) {
                SAML11AuthorizationDecisionStatementType authzStat = SAML11ParserUtil
                        .parseSAML11AuthorizationDecisionStatement(xmlEventReader);
View Full Code Here

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

     * @return
     * @throws ParsingException
     */
    public static SAML11AttributeStatementType parseSAML11AttributeStatement(XMLEventReader xmlEventReader)
            throws ParsingException {
        SAML11AttributeStatementType attributeStatementType = new SAML11AttributeStatementType();

        StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
        String ATTRIBSTATEMT = JBossSAMLConstants.ATTRIBUTE_STATEMENT.get();
        StaxParserUtil.validate(startElement, ATTRIBSTATEMT);

        while (xmlEventReader.hasNext()) {
            XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
            if (xmlEvent instanceof EndElement) {
                EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                StaxParserUtil.validate(endElement, JBossSAMLConstants.ATTRIBUTE_STATEMENT.get());
                break;
            }
            // 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);
            } else
                throw logger.parserUnknownTag(tag, startElement.getLocation());
        }
        return attributeStatementType;
    }
View Full Code Here

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

        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

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

        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
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.