Вот что я пробовал в моей службе Java (Spring Boot), которая использует клиент администратора Keycloak:
Код: Выделить всё
public void defineUserAttributes(String realmName) {
RealmResource realmResource = keycloak.realm(realmName);
RealmRepresentation realmRep = realmResource.toRepresentation();
realmRep.getAttributes().put("userProfileEnabled", "true");
String userProfileConfigJson = ""
" {
"attributes": [{
"name": "user_type",
"required": false
}, ]
}
""
";
realmRep.getAttributes().put("userProfileConfiguration", userProfileConfigJson);
realmResource.update(realmRep);
}
[img]https://i.sstatic.net /pZUJhEfg.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/793 ... le-via-the