protected List<LdapAttribute> getLdapAttributes(final Map<String, Object> attributes) {
        List<LdapAttribute> ldapAttributes = new ArrayList<>();
        for (val entry : attributes.entrySet()) {
            val value = entry.getValue();
            if (value != null) {
                val key = entry.getKey();
                final LdapAttribute ldapAttribute;
                if (value instanceof String) {
                    ldapAttribute = new LdapAttribute(key, (String) value);
                } else if (value instanceof List) {
                    val list = (List<String>) value;
                    ldapAttribute = new LdapAttribute(key, list.toArray(new String[list.size()]));
                } else {
                    ldapAttribute = new LdapAttribute(key, value.toString());
                }
                ldapAttributes.add(ldapAttribute);
            }
        }
        return ldapAttributes;
    }
<p>getLdapAttributes.</p>

@param attributes a {@link Map} object
@return a {@link List} object
pac4j-ldap/src/main/java/org/pac4j/ldap/profile/service/LdapProfileService.java