[keycloak-user] Searching user based on firstName, lastName, etc.

Sajid Chauhan sajid at theinnovationinc.co
Mon Dec 4 21:33:47 EST 2017


Dear All,

On the admin console we can search for a user using their firstName or
lastName or a combination of the tow. (GET /admin/realms/{realm}/users)

However, when I try using the below code snippet the search does not work
as expected.

Keycloak kc = Keycloak.getInstance(serverUrl, masterRealm,
masterUsername, masterPassword, masterClientId);
List<UserRepresentation> userRepresentations =
kc.realms().realm(realmName).users().search(username, firstName,
lastName, email, firstResult, maxResults);

Can anyone please help out how can I search for a user firstName or
lastName programmatically in keycloak?
-- 
Thanks and regards,
Sajid


More information about the keycloak-user mailing list