| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- package com.inspur.customer.client.keycloak;
- import com.alibaba.cola.dto.PageResponse;
- import com.alibaba.cola.dto.Response;
- import com.alibaba.cola.dto.SingleResponse;
- import com.inspur.customer.object.keycloak.KeycloakUserCO;
- import com.inspur.customer.object.keycloak.UsersRoleMappingDTO;
- import com.inspur.customer.object.org.SmsbDepartmentCmd;
- import com.inspur.customer.object.org.SmsbUserAdd;
- import com.inspur.customer.object.wechat.Pair;
- import org.keycloak.representations.idm.GroupRepresentation;
- import org.keycloak.representations.idm.UserRepresentation;
- import java.util.List;
- import java.util.Map;
- /**
- * keycloak接口能力适配
- * @author wangbo13
- */
- public interface KeycloakService {
- /**
- * 获取当前releam下用户Map<id,name>
- *
- * @return
- */
- Map<String, String> getUserMap();
- List<KeycloakUserCO> getUsersInRole(String role);
- List<KeycloakUserCO> getUsersByIds(List<String> userIds);
- /**
- * 检查用户是否具备某角色权限
- *
- * @param userId
- * @param role
- * @return
- */
- Boolean checkUserRole(String userId,String role);
- /**
- * 更新用户attribute
- *
- * @param userId
- * @param property
- * @param value
- */
- void updateAttribute(String userId ,String property , String value);
- /**
- * 获取attributes
- *
- * @param groupPath
- * @param key
- * @return
- */
- List<String> getAttrByGroupPath(String groupPath, String key);
- List<KeycloakUserCO> getGroupSupervisor(String group);
- List<KeycloakUserCO> getSuperAdmin();
- List<KeycloakUserCO> getAllRoleAdmin();
- List<KeycloakUserCO> getAllRoleOperationSupervisor();
- List<KeycloakUserCO> getGroupAdmin(String group);
- String getSingleAttrByGroupPath(String group, String key);
- /**
- * 根据属性键值对查找用户
- *
- * @param entries 属性键值对
- * @return 找到的用户
- */
- List<KeycloakUserCO> searchUserByAttrEntry(List<Pair> entries);
- List<String> getUserGroupPathList(String userId);
- List<String> getUserRealmRoles(String userId);
- Map<String, List<String>> getUserClientRoles(String userId);
- void changePassword(String userId, String newPassword);
- /**
- * 获取当前releam下用户Map<id,name>
- *
- * @return
- */
- Map<String, String> getUsersMap();
- /**
- * 该租户下添加部门
- *
- * @param id
- * @param groupRepresentation
- * @return
- */
- Response addKeycloakGroup(String id , GroupRepresentation groupRepresentation);
- /**
- * 该租户下修改部门
- *
- * @param id
- * @param groupRepresentation
- * @return
- */
- Response updateKeycloakGroup(String id , GroupRepresentation groupRepresentation);
- /**
- * 该租户下删除部门
- *
- * @param id
- * @return
- */
- Response removeGroup(String id);
- /**
- * 添加用户
- *
- * @param smsbUserAdd
- * @return
- */
- SingleResponse addKeyClaokUser(SmsbUserAdd smsbUserAdd);
- /**
- * 更新用户信息
- *
- * @param userId
- * @param representation
- * @param oprateType 1:账号启用/禁用 2:重置密码
- * @return
- */
- Response updateUser(String userId , Object representation ,Integer oprateType);
- /**
- * 注销用户
- *
- * @param userId
- * @return
- */
- Response removeUser(String userId);
- /**
- * 用户重分组
- *
- * @param userId
- * @param groupId
- * @return
- */
- Response regrouping(String userId , String groupId);
- /**
- * 用户角色分配
- *
- * @param ssersRoleMappingDTO
- * @return
- */
- Response roleMapping(UsersRoleMappingDTO ssersRoleMappingDTO);
- /**
- * 获取用户凭证
- *
- * @param userId
- * @return
- */
- Response queryUserCredentials(String userId);
- /**
- * 删除用户凭证
- *
- * @param userId
- * @param credentialId
- * @return
- */
- Response removeUserCredentials(String userId ,String credentialId);
- /**
- * 新增租户
- *
- * @param groupRepresentation
- * @return
- */
- Response addKeycloakTenant(GroupRepresentation groupRepresentation);
- /**
- * 判断用户是否具有某角色
- *
- * @param userId
- * @param role
- * @return
- */
- Boolean isExitTargetRole(String userId ,String role);
- /**
- * 获取用户所属租户
- *
- * @param userId
- * @return 租户
- */
- String queryUserTenant(String userId);
- /**
- * 新增或修改用户attributes
- *
- * @param userId
- * @param key key
- * @param values values
- * @return if success
- */
- Boolean addAttributesByUserId(String userId , String key , List<String> values);
- /**
- * 获取用户列表
- *
- * @param departmentCmd
- * @param userId
- * @return
- */
- PageResponse<UserRepresentation> getUserListByIds(SmsbDepartmentCmd departmentCmd , List<String> userId);
- }
|