-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
area/admin/apikind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugstatus/triageteam/core-shared
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
admin/api
Describe the bug
The method org.keycloak.admin.client.resource.UsersResource.search(String, String, String, String, Boolean, String, String, Integer, Integer, Boolean, Boolean) parameter briefRepresentation = true started to return user attributes
(Javadoc says Note that it means that namely user attributes, required actions, and not before are not returned).
Version
26.5.3
Regression
- The issue is a regression
Expected behavior
As Javadoc of the method mentions: Note that it means that namely user attributes, required actions, and not before are not returned
Actual behavior
User attributes are returned now when briefRepresentation is true
How to Reproduce?
@Test
void searchWithBriefRepresentationMustNotReturnAttributes() {
RealmResource realmResource = getRealmResource();
String firstName = "f";
String lastName = "s";
String attributeName = "a";
String attributeValue = "b";
String username = "any";
UserRepresentation userRepresentation = new UserRepresentation();
userRepresentation.setFirstName(firstName);
userRepresentation.setLastName(lastName);
userRepresentation.setUsername(username);
userRepresentation.setAttributes(Map.of(attributeName, List.of(attributeValue)));
realmResource.users().create(userRepresentation);
List<UserRepresentation> searchResult = realmResource.users().search(
username, null, null, null, null, null, null, null, null, null, true
);
assertThat(searchResult, hasSize(1));
assertThat(searchResult.get(0).getUsername(), equalTo(username));
// fails in Keycloak 26.5.3, used to work in 26.2.5
assertNull(searchResult.get(0).getAttributes());
}
Anything else?
It worked in Keycloak 26.2.5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/admin/apikind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugstatus/triageteam/core-shared