public static List<Map<String, List<Object>>> syncopeUserGroupsSearch(final BaseSyncopeSearchProperties properties,
                                                                          final String user) {

        HttpResponse response = null;
        try {
            val fiql = EncodingUtils.urlEncode("$member==%s".formatted(user));
            val syncopeRestUrl = StringUtils.appendIfMissing(
                SpringExpressionLanguageValueResolver.getInstance().resolve(properties.getUrl()), "/")
                + "rest/groups/?page=1&size=50&details=true&fiql=" + fiql;
            LOGGER.debug("Executing Syncope user group search via [{}]", syncopeRestUrl);
            val requestHeaders = new LinkedHashMap<String, String>();
            requestHeaders.put("X-Syncope-Domain", properties.getDomain());
            requestHeaders.putAll(properties.getHeaders());
            val exec = HttpExecutionRequest.builder()
                .method(HttpMethod.GET)
                .url(syncopeRestUrl)
                .basicAuthUsername(properties.getBasicAuthUsername())
                .basicAuthPassword(properties.getBasicAuthPassword())
                .headers(requestHeaders)
                .build();

            response = Objects.requireNonNull(HttpUtils.execute(exec));
            if (Objects.requireNonNull(HttpStatus.resolve(response.getCode())).is2xxSuccessful()) {
                val entity = ((HttpEntityContainer) response).getEntity();
                return FunctionUtils.doUnchecked(() -> {
                    val result = EntityUtils.toString(entity);
                    val it = Optional.of(MAPPER.readTree(result))
                        .filter(sr -> sr.has("result"))
                        .map(sr -> sr.get("result"))
                        .map(JsonNode::iterator)
                        .orElse(Collections.emptyIterator());
                    val groups = new ArrayList<>();
                    StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, Spliterator.ORDERED), false)
                        .forEach(node -> convertFromGroupEntity(node, groups));
                    val name = properties.getAttributeMappings().getOrDefault("groups", "syncopeUserGroups");
                    val attributes = new HashMap<String, List<Object>>();
                    attributes.put(name, groups);
                    return List.of(attributes);
                });
            }
        } finally {
            HttpUtils.close(response);
        }
        return new ArrayList<>();

    }
Syncope user groups search.

@param properties the properties
@param user       the user
@return the list
support/cas-server-support-syncope-authentication/src/main/java/org/apereo/cas/syncope/SyncopeUtils.java