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

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


            } else if (statement instanceof AttributeStatementType) {
                AttributeStatementType attribStat = (AttributeStatementType) statement;
                List<ASTChoiceType> attributes = attribStat.getAttributes();
                assertEquals(2, attributes.size());
                for (ASTChoiceType astChoice : attributes) {
                    AttributeType attribute = astChoice.getAttribute();
                    String attributeName = attribute.getName();
                    if (!(JBossSAMLURIConstants.CLAIMS_EMAIL_ADDRESS.get().equals(attributeName) || JBossSAMLURIConstants.CLAIMS_PUID
                            .get().equals(attributeName)))
                        throw new RuntimeException("Unknown attr name:" + attributeName);
                }
            } else
View Full Code Here


        assertion.setSubject(subject);
        assertion.addStatement(authnStatement);

        AttributeStatementType attributes = new AttributeStatementType();

        AttributeType attribute = new AttributeType("Role");

        attribute.addAttributeValue("Manager");

        attributes.addAttribute(new ASTChoiceType(attribute));

        assertion.addStatement(attributes);
View Full Code Here

                    attrStatement = createAttributeStatement(new ArrayList(roles));
                }
            }

            else {
                AttributeType att;
                Object value = attributes.get(key);

                String uri = X500SAMLProfileConstants.getOID(key);
                if (StringUtil.isNotNull(uri)) {
                    att = getX500Attribute(uri);
                    att.setFriendlyName(key);
                } else {
                    att = new AttributeType(key);
                    att.setFriendlyName(key);
                    att.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_URI.get());
                }

                att.addAttributeValue(value);
                attrStatement.addAttribute(new ASTChoiceType(att));
            }
        }
        return attrStatement;
    }
View Full Code Here

        AttributeStatementType attrStatement = null;
        for (String role : roles) {
            if(attrStatement == null){
                attrStatement = new AttributeStatementType();
            }
            AttributeType attr = new AttributeType(AttributeConstants.ROLE_IDENTIFIER_ASSERTION);
            attr.addAttributeValue(role);
            attrStatement.addAttribute(new ASTChoiceType(attr));
        }
        return attrStatement;
    }
View Full Code Here

    public static AttributeStatementType createAttributeStatementForRoles(List<String> roles, boolean multivalued) {
        if (multivalued == false) {
            return createAttributeStatement(roles);
        }
        AttributeStatementType attrStatement = new AttributeStatementType();
        AttributeType attr = new AttributeType(AttributeConstants.ROLE_IDENTIFIER_ASSERTION);
        for (String role : roles) {
            attr.addAttributeValue(role);
        }
        attrStatement.addAttribute(new ASTChoiceType(attr));
        return attrStatement;
    }
View Full Code Here

     * @param value attribute value
     * @return
     */
    public static AttributeStatementType createAttributeStatement(String key, String value) {
        AttributeStatementType attrStatement = new AttributeStatementType();
        AttributeType attr = new AttributeType(key);
        attr.addAttributeValue(value);
        attrStatement.addAttribute(new ASTChoiceType(attr));

        return attrStatement;
    }
View Full Code Here

        return attrStatement;
    }

    private static AttributeType getX500Attribute(String name) {
        AttributeType att = new AttributeType(name);
        att.getOtherAttributes().put(X500_QNAME, "LDAP");

        att.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_URI.get());
        return att;
    }
View Full Code Here

                }
            }

            List<ASTChoiceType> attList = attributeStatement.getAttributes();
            for (ASTChoiceType obj : attList) {
                AttributeType attr = obj.getAttribute();
                if (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

        // Let us get the roles
        AttributeStatementType attributeStatement = (AttributeStatementType) assertion.getStatements().iterator().next();
        List<ASTChoiceType> attList = attributeStatement.getAttributes();
        for (ASTChoiceType obj : attList) {
            AttributeType attr = obj.getAttribute();
            String roleName = (String) attr.getAttributeValue().get(0);
            roles.add(roleName);
        }

        Principal principal = new Principal() {
            public String getName() {
View Full Code Here

        for (StatementAbstractType statement : statements) {
            if (statement instanceof AttributeStatementType) {
                AttributeStatementType attrStat = (AttributeStatementType) statement;
                List<ASTChoiceType> attrs = attrStat.getAttributes();
                for (ASTChoiceType attrChoice : attrs) {
                    AttributeType attr = attrChoice.getAttribute();
                    Map<String, List<Object>> attrMap = (Map<String, List<Object>>) session
                            .getAttribute(GeneralConstants.SESSION_ATTRIBUTE_MAP);
                    if (attrMap == null) {
                        attrMap = new HashMap<String, List<Object>>();
                        session.setAttribute(GeneralConstants.SESSION_ATTRIBUTE_MAP, attrMap);
                    }
                    if (chooseFriendlyName) {
                        attrMap.put(attr.getFriendlyName(), attr.getAttributeValue());
                    } else {
                        attrMap.put(attr.getName(), attr.getAttributeValue());
                    }
                }
            }
        }
    }
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.