@Override
    public List<Group> forGroups(final Principal principal, final User... users) {
        val members = Arrays.stream(users)
            .map(user -> Member.builder()
                .ref(user.getId().orElseThrow())
                .build())
            .toList();
        val listOfGroups = new ArrayList<Group>();
        mapAttributesToSchema(principal, ScimUserSchema.GROUPS, value -> listOfGroups.add(
            Group.builder().displayName(value).members(members).build()));
        return listOfGroups;
    }
This is {@link DefaultScimPrincipalAttributeMapper}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-scim-core/src/main/java/org/apereo/cas/scim/v2/provisioning/DefaultScimPrincipalAttributeMapper.java