You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to integrate Keycloak in our company-wide solution and we found that it's not always easy to find specific users matching complex criteria.
For example, if we wanted to find users matching a specified first or last name, but not contained withing the email, it would not be possible with the current API endpoint "{{keycloak_url}}/admin/realms/my_realm/users", unless we make several calls or if we fetch more user than necessary and filter the results on our side.
What we are suggesting is to make the Search API more powerful and flexible by adding a small JSON query language. This would allow KeyCloak administrators to craft and execute complex queries. Furthermore, we think it could bring a performance boost, as the Hibernate queries can be more finely-tuned to search exactly for what we need.
Here is an example of what this mini query language would look like. The "or", "not", and "and" operators can be combined, while "like", "equals" and "in" are terminals.
Although the proposed JSON expression is not a really a query language but simply a data structure representing the search criteria, we feel like it's a simple way of expressing the search criteria. By using a JSON structure, we can benefit from the Jackson library already included in Keycloak.
One drawback from JSON would be long queries with extra quotes and braces could go past the GET request size limit (although this limitation can also occurs with any other language).
I looked around for a query language that could fit this proposal and found "RSQL/FIQL", which seems to be a good candidate. There's already a java library to parse this language (https://github.com/jirutka/rsql-parser) (unfortunately, it doesn't seem to be maintained anymore, but it seem to be stable as it is).
Pull Request
We already created a PR implementing this feature: #15998
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Proposition
We are trying to integrate Keycloak in our company-wide solution and we found that it's not always easy to find specific users matching complex criteria.
For example, if we wanted to find users matching a specified first or last name, but not contained withing the email, it would not be possible with the current API endpoint "
{{keycloak_url}}/admin/realms/my_realm/users", unless we make several calls or if we fetch more user than necessary and filter the results on our side.What we are suggesting is to make the Search API more powerful and flexible by adding a small JSON query language. This would allow KeyCloak administrators to craft and execute complex queries. Furthermore, we think it could bring a performance boost, as the Hibernate queries can be more finely-tuned to search exactly for what we need.
Here is an example of what this mini query language would look like. The "
or", "not", and "and" operators can be combined, while "like", "equals" and "in" are terminals.{ "operator": "or", "values":[ { "operator": "like", "property": "username", "value": "john.wick*" }, { "operator": "like", "property": "email", "value": "john.wick@*" }, { "operator": "and", "values": [ { "operator": "equals", "property": "firstName", "value": "John" }, { "operator": "equals", "property": "lastName", "value": "Wick" } ] } ] }Discussion
Although the proposed JSON expression is not a really a query language but simply a data structure representing the search criteria, we feel like it's a simple way of expressing the search criteria. By using a JSON structure, we can benefit from the Jackson library already included in Keycloak.
One drawback from JSON would be long queries with extra quotes and braces could go past the GET request size limit (although this limitation can also occurs with any other language).
I looked around for a query language that could fit this proposal and found "RSQL/FIQL", which seems to be a good candidate. There's already a java library to parse this language (https://github.com/jirutka/rsql-parser) (unfortunately, it doesn't seem to be maintained anymore, but it seem to be stable as it is).
Pull Request
We already created a PR implementing this feature: #15998
All reactions