public AttributeStatement newAttributeStatement(final Subject subject,
                                                    final Map<String, Object> attributes,
                                                    final String attributeNamespace) {

        val attrStatement = SamlUtils.newSamlObject(AttributeStatement.class);
        attrStatement.setSubject(subject);
        for (val e : attributes.entrySet()) {
            if (e.getValue() instanceof Collection<?> && ((Collection<?>) e.getValue()).isEmpty()) {
                LOGGER.info("Skipping attribute [{}] because it does not have any values.", e.getKey());
                continue;
            }
            val attribute = SamlUtils.newSamlObject(Attribute.class);
            attribute.setAttributeName(e.getKey());

            if (StringUtils.isNotBlank(attributeNamespace)) {
                attribute.setAttributeNamespace(attributeNamespace);
            }

            addAttributeValuesToSaml1Attribute(e.getKey(), e.getValue(), attribute.getAttributeValues());
            attrStatement.getAttributes().add(attribute);
        }

        return attrStatement;
    }
New attribute statement.

@param subject            the subject
@param attributes         the attributes
@param attributeNamespace the attribute namespace
@return the attribute statement
support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/Saml10ObjectBuilder.java