public static Map<String, Object> convertAttributeValuesToObjects(final Map<String, ?> attributes) {
        val entries = attributes.entrySet();
        return entries
            .stream()
            .map(entry -> Map.entry(entry.getKey(), entry.getValue()))
            .collect(Collectors.toMap(Map.Entry::getKey, entry -> {
                val value = CollectionUtils.toCollection(entry.getValue());
                return value.size() == 1 && !(value.iterator().next() instanceof Map) ? value.iterator().next() : value;
            }));
    }
Convert attribute values to objects.

@param attributes the attributes
@return the map
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java