Repository navigation
Allow explicit search by username for user search queries in admin-console #13184
thomasdarimont
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Context
Currently Keycloak supports to search for a concrete user with the special pattern
id:$USER_UUID.Problem Statement
In many support scenarios admins need to look for a user by a given username. When admins currently try to search for a specific user by username then Keycloak generates a query that searches over multiple fields of a user entity. This search with
search=usernamecan be quite slow, and can, depending on the actual number of users and current database configuration, even lead to timeouts.Although Keycloak provides optimized search queries for searching users by username, those are currently not used by the admin-console, neither by the legacy admin-console nor the new admin-console.v2.
Proposal
I propose to allow the additonal search pattern
username:$USERNAMEto be used via the search parameter of the UsersResource#getUsers endpoint.This would enable to search for users by exact usernames from the legacy admin-console and the new admin-console.v2 without any additional code change. At a later stage the (new) admin-console could be enhanced to allow explicit selection of the field and mode (exact, fuzzy) to search for.
Since usernames are unique we can use a similar logic to the seach for user by userId
id:$USER_UUID.Being able to explicitly search by username helps to reduce database load due to more efficient queries and improves the admin user experience.
PR
An implementation of this feature can be found here: #13185
All reactions