Anyway I was able to make it work:
This one works:
curl -X POST
http://localhost:8001/apis/example-api/plugins --data "name=ldap-auth" --data "config.hide_credentials=true" --data "config.ldap_host=localhost" --data "config.ldap_port=389" --data "config.base_dn=ou=People,dc=example,dc=com" --data config.attribute="uid" --data "config.cache_ttl=60"
This one doesn't work:
curl -X POST
http://localhost:8001/apis/example-api/plugins --data "name=ldap-auth" --data "config.hide_credentials=true" --data "config.ldap_host=localhost" --data "config.ldap_port=389" --data "config.base_dn=ou=People,dc=example,dc=com" --data config.attribute="
(gidNumber=5000),uid" --data "config.cache_ttl=60"
This one doesn't work:
curl -X POST
http://localhost:8001/apis/example-api/plugins --data "name=ldap-auth" --data "config.hide_credentials=true" --data "config.ldap_host=localhost" --data "config.ldap_port=389" --data "config.base_dn=ou=People,dc=example,dc=com" --data config.attribute="(gidNumber=5000)(uid)" --data "config.cache_ttl=60"
In LDAP you put the filter for example as (&(gidNumber=5000)(uid=john))
ldapsearch -h localhost -p 389 -D cn=admin,dc=example,dc=com -w admin -b dc=example,dc=com '(&(gidNumber=5000)(uid=john))'
So currently there is no filter possible on the LDAP plugin.
I think that when you specify on the config.attribute=cn (or uid) you transfer the search as cn=XXXX,+base_dn which is correct but doesn;t allow to filter users by certain fields on the LDAP (like the ldapsearch sentence above).