Custom Identity Plugin - User groups

Hi,

first thank you for such an amazing product.

I am trying to setup a custom identity plugin and use it with Camunda Spring Boot.

Full working version is here:
https://github.com/dusanmiloradovic/camunda-custom-identity

The problem is that I can’t get the groups for the user, Camunda returns all the groups.

More specifically, the following method of the IdentittyProvider:

public List<Group> findGroupByQueryCriteria(RedisGroupQuery query) {

        if (query.getUserId() != null) {
            return getGroupsForUser(query.getUserId());
        }
        final List<String> allGroups = persons.getAllGroups();
        List<Group> ret = getGroups(allGroups);

        if (query.getId() != null) {
            ret.removeIf(group -> !group.getId().equals(query.getId()));
        }

        return ret;
    }

is called twice upon login: first time with the correct query containing the user id, and the second time without it.

Am I missing something?

Dusan