Whenever we send a GET request to the following URL:
https://my-keycloak/admin/realms/test-realm/users
We receive a comprehensive list of users who are associated with the test-realm
.
According to the Keycloak REST API documentation, this kind of response is categorized as "UserRepresentation" (you can find the definition in the last section of the wiki page): view response definition
However, so far, only responses containing the following attributes have been received:
export interface KeycloakUserRepresentation {
id: string;
createdTimestamp: number;
username: string;
enabled: boolean;
totp: boolean;
emailVerified: boolean;
firstName: string;
lastName: string;
email: string;
disableableCredentialTypes: [];
requiredActions: string[];
notBefore: number;
access: {
manageGroupMembership: boolean;
view: boolean;
mapRoles: boolean;
impersonate: boolean;
manage: boolean;
};
}
I am now looking for a way to customize the response by adding the optional attribute clientRoles
. What steps should I take to make this happen?
I have experimented by assigning role mappings and groups to various users to see if it affects the response, but there were no noticeable changes. The only action that seems to alter the response is manually including the user attribute to User. However, my goal is to display the clientRoles attribute.