IMPORTANT: Attaching roles does not work through POST and PUT, instead use dedicated endpoint
services/src/main/java/keycloak/services/resources/admin/UserResource.javaCreateUser in UserResourse.javaRepresentationToModel.createRoleMappings(rep, user, realm) should resolve this issuePOST /admin/realms/cuckoo/users
# Put works like a PATCH essentially.
# It does not require full object to be sent
PUT /admin/realms/cuckoo/users
{
...,
"realmRoles": ["admin"],
"clientRoles": {
"realm-management": ["company_admin"]
}
}