Class KeycloakRestUserService
java.lang.Object
net.n2oapp.security.admin.sso.keycloak.KeycloakRestUserService
Сервис для создания, изменения, удаления пользователя в keycloak
https://www.keycloak.org/docs-api/6.0/rest-api/#_users_resource
-
Constructor Summary
ConstructorsConstructorDescriptionKeycloakRestUserService(AdminSsoKeycloakProperties properties, org.springframework.web.client.RestClient restClient, KeycloakRestRoleService roleService) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUserRoles(String userGuid, List<org.keycloak.representations.idm.RoleRepresentation> roles) Добавление пользователю ролейvoidchangePassword(String userGuid, String newPassword) Изменние пароляcreateUser(org.keycloak.representations.idm.UserRepresentation user) Добавление пользователяvoiddeleteUser(String guid) Удаление пользователяvoiddeleteUserRoles(String userGuid, List<org.keycloak.representations.idm.RoleRepresentation> roles) Удаление ролей у пользователяList<org.keycloak.representations.idm.RoleRepresentation> getActualUserRoles(String userGuid) Получение актуальных ролей пользователяorg.keycloak.representations.idm.UserRepresentationПолучение пользователя по guidВозвращает количество пользователейList<org.keycloak.representations.idm.UserRepresentation> searchUsers(String search, Integer first, Integer max) Поиск пользователейvoidsetRestClient(org.springframework.web.client.RestClient restClient) voidupdateUser(org.keycloak.representations.idm.UserRepresentation user) Изменение пользователя
-
Constructor Details
-
KeycloakRestUserService
public KeycloakRestUserService(AdminSsoKeycloakProperties properties, org.springframework.web.client.RestClient restClient, KeycloakRestRoleService roleService)
-
-
Method Details
-
getUsersCount
Возвращает количество пользователей -
getById
Получение пользователя по guid- Parameters:
userGuid- guid пользователя- Returns:
- данные пользователя
-
searchUsers
public List<org.keycloak.representations.idm.UserRepresentation> searchUsers(String search, Integer first, Integer max) Поиск пользователей- Parameters:
search- - строка поиска (A String contained in username, first or last name, or email)first- - с какого пользователя начатьmax- - сколько пользователей вернуть- Returns:
- -лист пользователей
-
createUser
Добавление пользователя- Parameters:
user- данные пользователя- Returns:
- giud пользователя в keycloak
-
updateUser
public void updateUser(org.keycloak.representations.idm.UserRepresentation user) Изменение пользователя- Parameters:
user- данные пользователя
-
deleteUser
Удаление пользователя- Parameters:
guid- giud пользователя keycloak
-
addUserRoles
public void addUserRoles(String userGuid, List<org.keycloak.representations.idm.RoleRepresentation> roles) Добавление пользователю ролей- Parameters:
userGuid- giud пользователяroles- список ролей
-
getActualUserRoles
public List<org.keycloak.representations.idm.RoleRepresentation> getActualUserRoles(String userGuid) Получение актуальных ролей пользователя- Parameters:
userGuid- giud пользователя- Returns:
- список ролей
-
deleteUserRoles
public void deleteUserRoles(String userGuid, List<org.keycloak.representations.idm.RoleRepresentation> roles) Удаление ролей у пользователя- Parameters:
userGuid- guid пользователяroles- список ролей
-
changePassword
Изменние пароля- Parameters:
userGuid- giud пользователяnewPassword- новый пароль
-
setRestClient
public void setRestClient(org.springframework.web.client.RestClient restClient)
-