|
|
@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.keycloak.admin.client.Keycloak;
|
|
|
import org.keycloak.admin.client.resource.UserResource;
|
|
|
+import org.keycloak.representations.idm.GroupRepresentation;
|
|
|
import org.keycloak.representations.idm.RoleRepresentation;
|
|
|
import org.keycloak.representations.idm.UserRepresentation;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -115,4 +116,14 @@ public class KeycloakServiceImpl implements KeycloakService {
|
|
|
user.update(userRepresentation);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<String> getAttrByGroupPath(String groupPath, String key) {
|
|
|
+ GroupRepresentation groupRepresentation = keycloak.realm(realm).getGroupByPath(groupPath);
|
|
|
+ if (groupRepresentation != null) {
|
|
|
+ Map<String, List<String>> attributes = groupRepresentation.getAttributes();
|
|
|
+ return attributes != null ? attributes.get(key) : Collections.emptyList();
|
|
|
+ }
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
}
|