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

Examples of org.jboss.identity.federation.saml.v2.assertion.AttributeType


        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;
                    }
                    List<Object> attributeValues = attr.getAttributeValue();
                    if (attributeValues != null) {
                        for (Object attrValue : attributeValues) {
                            if (attrValue instanceof String) {
                                roles.add((String) attrValue);
                            } else if (attrValue instanceof Node) {
View Full Code Here


            }
            // 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

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

        Attribute name = startElement.getAttributeByName(new QName(JBossSAMLConstants.NAME.get()));
        if (name == null)
            throw logger.parserRequiredAttribute("Name");
        attributeType = new AttributeType(StaxParserUtil.getAttributeValue(name));

        parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType);

        return attributeType;
    }
View Full Code Here

                ASSERTION_NSURI.get());

        List<ASTChoiceType> attributes = statement.getAttributes();
        if (attributes != null) {
            for (ASTChoiceType attr : attributes) {
                AttributeType attributeType = attr.getAttribute();
                if (attributeType != null) {
                    write(attributeType);
                }
                EncryptedElementType encType = attr.getEncryptedAssertion();
                if (encType != null)
View Full Code Here

                idpSSODescriptor.addNameIDMappingService(endpoint);
            } else if (JBossSAMLConstants.NAMEID_FORMAT.get().equalsIgnoreCase(localPart)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                idpSSODescriptor.addNameIDFormat(StaxParserUtil.getElementText(xmlEventReader));
            } else if (JBossSAMLConstants.ATTRIBUTE.get().equalsIgnoreCase(localPart)) {
                AttributeType attribute = SAMLParserUtil.parseAttribute(xmlEventReader);
                idpSSODescriptor.addAttribute(attribute);
            } else if (JBossSAMLConstants.KEY_DESCRIPTOR.get().equalsIgnoreCase(localPart)) {
                KeyDescriptorType keyDescriptor = new KeyDescriptorType();
                String use = StaxParserUtil.getAttributeValue(startElement, "use");
                if (use != null && !use.isEmpty()) {
View Full Code Here

        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();
        /*
         * assertTrue("Unexpected type instead of AttributeStatement: " + attributeObject.getClass().getSimpleName(),
         * attributeObject instanceof AttributeType); AttributeType attribute = (AttributeType)attributeObject;
         */
        assertEquals("Unexpected name for the role attribute", "roleAttributeName", attribute.getName());
        assertEquals("Unexpected number of roles", 1, attribute.getAttributeValue().size());
        assertEquals("Unexpected user role", "myTestRole", attribute.getAttributeValue().get(0));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testDynamicMetadataCreation() throws Exception {
        OrganizationType org = new OrganizationType();
        AttributeType attributeType = new AttributeType("hello");
        List<AttributeType> attributes = new ArrayList<AttributeType>();
        attributes.add(attributeType);

        URI test = URI.create("http://test");
        EndpointType sloEndPoint = new EndpointType(test, test);
View Full Code Here

        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());

        // Ensure that we have x500:encoding
        QName x500EncodingName = new QName(JBossSAMLURIConstants.X500_NSURI.get(), JBossSAMLConstants.ENCODING.get());
        String encodingValue = attribute.getOtherAttributes().get(x500EncodingName);
        assertEquals("LDAP", encodingValue);

        List<Object> attributeValues = attribute.getAttributeValue();
        assertEquals(2, attributeValues.size());

        String str = (String) attributeValues.get(0);
        if (!(str.equals("member") || str.equals("staff")))
            throw new RuntimeException("attrib value not found");
View Full Code Here

        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>();
        contextMap.put("token-role-attribute-name", roleAttributeName);
        contextMap.put(AbstractSTSLoginModule.SHARED_TOKEN, SAMLUtil.toElement(assertion));
View Full Code Here

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

        for (AttributeStatementType.ASTChoiceType attr : attributes) {
            AttributeType attribute = attr.getAttribute();
            assertEquals("role", attribute.getFriendlyName());
            assertEquals("role", attribute.getName());
            assertEquals("role", attribute.getNameFormat());
            List<Object> attributeValues = attribute.getAttributeValue();
            assertEquals(1, attributeValues.size());

            String str = (String) attributeValues.get(0);
            if (!(str.equals("employee") || str.equals("manager")))
                throw new RuntimeException("attrib value not found");
View Full Code Here

TOP

Related Classes of org.jboss.identity.federation.saml.v2.assertion.AttributeType

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.