protected Map<String, Object> flattenUserProfile(final Map<String, Object> model) {
        val flattened = new LinkedHashMap<String, Object>();
        if (model.containsKey(MODEL_ATTRIBUTE_ATTRIBUTES)) {
            val attributes = (Map) model.get(MODEL_ATTRIBUTE_ATTRIBUTES);
            flattened.putAll(attributes);
        }
        model.keySet()
            .stream()
            .filter(attributeName -> !attributeName.equalsIgnoreCase(MODEL_ATTRIBUTE_ATTRIBUTES))
            .forEach(attributeName -> flattened.put(attributeName, model.get(attributeName)));
        LOGGER.trace("Flattened user profile attributes with the final model as [{}]", model);
        return flattened;
    }
This is {@link OAuth20DefaultUserProfileViewRenderer}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/views/OAuth20DefaultUserProfileViewRenderer.java