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

Examples of org.picketlink.identity.federation.saml.v2.assertion.AttributeStatementType


                assertion.setConditions(conditions);
            } else if (JBossSAMLConstants.AUTHN_STATEMENT.get().equalsIgnoreCase(tag)) {
                AuthnStatementType authnStatementType = SAMLParserUtil.parseAuthnStatement(xmlEventReader);
                assertion.addStatement(authnStatementType);
            } else if (JBossSAMLConstants.ATTRIBUTE_STATEMENT.get().equalsIgnoreCase(tag)) {
                AttributeStatementType attributeStatementType = SAMLParserUtil.parseAttributeStatement(xmlEventReader);
                assertion.addStatement(attributeStatementType);
            } else if (JBossSAMLConstants.STATEMENT.get().equalsIgnoreCase(tag)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);

                String xsiTypeValue = StaxParserUtil.getXSITypeValue(startElement);
View Full Code Here


    public static List<String> getRoles(AssertionType assertion, List<String> roleKeys) {
        List<String> roles = new ArrayList<String>();
        Set<StatementAbstractType> statements = assertion.getStatements();
        for (StatementAbstractType statement : statements) {
            if (statement instanceof AttributeStatementType) {
                AttributeStatementType attributeStatement = (AttributeStatementType) statement;
                List<ASTChoiceType> attList = attributeStatement.getAttributes();
                for (ASTChoiceType obj : attList) {
                    AttributeType attr = obj.getAttribute();
                    if (roleKeys != null && roleKeys.size() > 0) {
                        if (!roleKeys.contains(attr.getName()))
                            continue;
View Full Code Here

     * @param xmlEventReader
     * @return
     * @throws ParsingException
     */
    public static AttributeStatementType parseAttributeStatement(XMLEventReader xmlEventReader) throws ParsingException {
        AttributeStatementType attributeStatementType = new AttributeStatementType();

        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)) {
                AttributeType attribute = parseAttribute(xmlEventReader);
                attributeStatementType.addAttribute(new ASTChoiceType(attribute));
            } else
                throw logger.parserUnknownTag(tag, startElement.getLocation());
        }
        return attributeStatementType;
    }
View Full Code Here

        NameIDType issuerID = SAMLAssertionFactory.createNameID(null, null, context.getTokenIssuer());
        AssertionType assertion = SAMLAssertionFactory.createAssertion(assertionID, issuerID, lifetime.getCreated(),
                conditions, subject, statements);

        if (this.attributeProvider != null) {
            AttributeStatementType attributeStatement = this.attributeProvider.getAttributeStatement();
            if (attributeStatement != null) {
                assertion.addStatement(attributeStatement);
            }
        }
View Full Code Here

        assertTrue("Unexpected type instead of AuthnStatement: " + authnStatementType.getClass().getSimpleName(),
                authnStatementType instanceof AuthnStatementType);
        assertNotNull("Unexpected null StatementAbstractType", statementAbstractType);
        assertTrue("Unexpected type instead of AttributeStatement: " + statementAbstractType.getClass().getSimpleName(),
                statementAbstractType instanceof AttributeStatementType);
        AttributeStatementType attributeStatement = (AttributeStatementType) statementAbstractType;
        List<ASTChoiceType> attributes = attributeStatement.getAttributes();
        assertFalse("Unexpected empty list of attributes", attributes.isEmpty());
        assertEquals("Unexpected number of attributes", 1, attributes.size());
        Object attributeObject = attributes.iterator().next();
        ASTChoiceType astChoice = (ASTChoiceType) attributeObject;
        AttributeType attribute = astChoice.getAttribute();
View Full Code Here

        sp.setResponseDestinationURI("http://service");
        sp.setIssuer("http://service.issuer");
        responseType = saml2Response.createResponseType(id, sp, idp, issuerHolder);
        AssertionType assertion = responseType.getAssertions().get(0).getAssertion();

        AttributeStatementType attrStatement = StatementUtil.createAttributeStatement(roles);
        assertion.addStatement(attrStatement);

        // Add timed conditions
        saml2Response.createTimedConditions(assertion, 5000L);
View Full Code Here

       
        Set<StatementAbstractType> statements = assertion.getStatements();
       
        for (StatementAbstractType statementType : statements) {
            if (statementType instanceof AttributeStatementType) {
                AttributeStatementType attributeType = (AttributeStatementType) statementType;
                List<ASTChoiceType> attributes = attributeType.getAttributes();
               
                for (ASTChoiceType astChoiceType : attributes) {
                    if (astChoiceType.getAttribute().getName().equals("Role")) {
                        expectedRoles.remove(astChoiceType.getAttribute().getAttributeValue().get(0));
                    }
View Full Code Here

        Iterator<StatementAbstractType> iter = statements.iterator();
        AuthnStatementType authnStatement = (AuthnStatementType) iter.next();
        assertEquals(XMLTimeUtil.parse("2004-12-05T09:22:00Z"), authnStatement.getAuthnInstant());
        assertEquals("b07b804c-7c29-ea16-7300-4f3d6f7928ac", authnStatement.getSessionIndex());

        AttributeStatementType attributeStatement = (AttributeStatementType) iter.next();
        List<ASTChoiceType> attributes = attributeStatement.getAttributes();
        assertEquals(1, attributes.size());
        AttributeType attribute = attributes.get(0).getAttribute();
        assertEquals("eduPersonAffiliation", attribute.getFriendlyName());
        assertEquals("urn:oid:1.3.6.1.4.1.5923.1.1.1.1", attribute.getName());
        assertEquals("urn:oasis:names:tc:SAML:2.0:attrname-format:uri", attribute.getNameFormat());
View Full Code Here

        String roleAttributeName = "roleAttributeName";
        String role1 = "userRole1";
        String role2 = "userRole2";

        AssertionType assertion = new AssertionType("ID_SOME", XMLTimeUtil.getIssueInstant());
        AttributeStatementType attributeStatementType = new AttributeStatementType();
        assertion.addStatement(attributeStatementType);
        AttributeType attributeType = new AttributeType(roleAttributeName);
        attributeStatementType.addAttribute(new ASTChoiceType(attributeType));
        attributeType.addAttributeValue(role1);
        attributeType.addAttributeValue(role2);

        MappingResult<RoleGroup> mappingResult = new MappingResult<RoleGroup>();
        Map<String, Object> contextMap = new HashMap<String, Object>();
View Full Code Here

        assertEquals("ID_04ded476-d73c-48af-b3a9-232a52905ffb", subjectConfirmationData.getInResponseTo());
        assertEquals(XMLTimeUtil.parse("2010-11-04T00:19:16.842-05:00"), subjectConfirmationData.getNotBefore());
        assertEquals(XMLTimeUtil.parse("2010-11-04T00:19:16.842-05:00"), subjectConfirmationData.getNotOnOrAfter());
        assertEquals("http://localhost:8080/employee/", subjectConfirmationData.getRecipient());

        AttributeStatementType attributeStatement = (AttributeStatementType) assertion.getStatements().iterator().next();

        List<AttributeStatementType.ASTChoiceType> attributes = attributeStatement.getAttributes();
        assertEquals(2, attributes.size());

        for (AttributeStatementType.ASTChoiceType attr : attributes) {
            AttributeType attribute = attr.getAttribute();
            assertEquals("role", attribute.getFriendlyName());
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.saml.v2.assertion.AttributeStatementType

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.