diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java index 4e1691885fd4..5a2370edd30e 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaUserProvider.java @@ -1012,7 +1012,7 @@ private List predicates(Map attributes, Root users = realm.users().searchByAttributes(mapToSearchQuery(Map.of("username", "user", "test", "test1", "attr", "common", "test1", "test1"))); assertThat(users, hasSize(1)); - //custom user attribute should use wildcard search by default + //custom user attribute should not use wildcard search by default users = realm.users().searchByAttributes(mapToSearchQuery(Map.of("username", "user", "test", "est", "attr", "mm", "test1", "test1"))); + assertThat(users, hasSize(0)); + + //custom user attribute should use wildcard + users = realm.users().searchByAttributes(mapToSearchQuery(Map.of("username", "user", "test", "est", "attr", "mm", "test1", "test1")), false); assertThat(users, hasSize(1)); //with exact=true the user shouldn't be returned