Hello,

I created: https://issues.jboss.org/browse/KEYCLOAK-2343 to track this.

Cheers,
Thomas

2016-01-19 10:15 GMT+01:00 Thomas Darimont <thomas.darimont@googlemail.com>:
Okay, how about offering a new search method that accepts s UserSearch DTO that would hold the attributes to search by 
as well as a "match mode". Could also be used to specify pagination.

This could also be send via a @POST in order to avoid retaining userdata like usernames, email addresses etc. in 
access logs...

Alternatively you could introduce a searchExact(..) method with the same parameterization as the existing search method.

2016-01-19 10:07 GMT+01:00 Stian Thorgersen <sthorger@redhat.com>:
It was by design, but it wasn't a good design. Would be better to make it match exact, but allow including a wildcard to make it fuzzy.

On 19 January 2016 at 09:58, Thomas Darimont <thomas.darimont@googlemail.com> wrote:
Hi,

I was looking for a way to query users based on their exact username but it turned out, that
  org.keycloak.admin.client.resource.UsersResource.search(String, String, String, String, Integer, Integer)

  @GET
  @Produces(MediaType.APPLICATION_JSON)
  List<UserRepresentation> search(@QueryParam("username") String username,
                                       @QueryParam("firstName") String firstName,
                                       @QueryParam("lastName") String lastName,
                                       @QueryParam("email") String email,
                                       @QueryParam("first") Integer firstResult,
                                       @QueryParam("max") Integer maxResults);

  ...
  usersResource.search("exactusername",null,null, null, null, email, 0, 10)

generates a like %..% query in JpaUserProvider.searchForUserByAttributes(...).

Since usernames are unique per realm I think it would make sense to be able to perform a
query for the exact username (or perhaps the combination of other attributes as well).

Was this omitted by design, or may I create a JIRA for this?

Cheers,
Thomas

_______________________________________________
keycloak-dev mailing list
keycloak-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-dev