diff --git a/README.md b/README.md
index 53d0b11..6bbe0c0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# midPoint-Grouper_connector
This is a connector that can read groups from a Grouper instance using REST calls.
-Currently it supports these searches only:
+Currently, it supports these searches only:
- fetching all groups,
- fetching a group by name,
- fetching a group by UUID.
@@ -12,4 +12,26 @@ Besides `search` operation the following ones are supported:
- `schema`
- `test`
-This connector was tested with Grouper 2.4.
\ No newline at end of file
+This connector was tested with Grouper 2.5.
+
+//TODO: Document baseStem, sourceId, include/exclude Group, and Group Attribute Map params and how they interact based on Grouper WS
+
+
+It's strongly recommended to add timeouts to your midPoint resource!
+
+```xml
+
+ 180000
+ 180000
+ 180000
+ 180000
+ 60000
+ 180000
+ 180000
+ 60000
+ 180000
+ 180000
+ 180000
+ 60000
+
+```
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 06e38be..a82bed4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
connector-parent
com.evolveum.polygon
- 1.4.2.14
+ 1.5.0.0
@@ -35,7 +35,9 @@
com.evolveum.polygon.connector.grouper.rest
GrouperRestConnector
- 1.8
+ 1.11
+ 1.11
+ UTF-8
@@ -65,6 +67,10 @@
org.apache.maven.plugins
maven-compiler-plugin
+
+
+ 11
+
org.apache.maven.plugins
@@ -75,6 +81,18 @@
maven-surefire-plugin
2.19.1
+
+ org.owasp
+ dependency-check-maven
+ 6.1.5
+
+
+
+ check
+
+
+
+
@@ -83,22 +101,22 @@
connector-rest
com.evolveum.polygon
- 1.4.2.14-SNAPSHOT
+ 1.5.0.0
org.apache.httpcomponents
httpclient
- 4.5.1
+ 4.5.13
org.json
json
- 20160810
+ 20210307
org.testng
testng
- 6.8
+ 7.4.0
test
diff --git a/src/main/java/com/evolveum/polygon/connector/grouper/rest/GroupProcessor.java b/src/main/java/com/evolveum/polygon/connector/grouper/rest/GroupProcessor.java
index cbd144a..9f17643 100644
--- a/src/main/java/com/evolveum/polygon/connector/grouper/rest/GroupProcessor.java
+++ b/src/main/java/com/evolveum/polygon/connector/grouper/rest/GroupProcessor.java
@@ -17,33 +17,100 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
+import org.identityconnectors.common.StringUtil;
import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.identityconnectors.framework.common.objects.*;
+import org.identityconnectors.framework.common.objects.filter.AttributeFilter;
+import org.identityconnectors.framework.common.objects.filter.ContainsFilter;
import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
import org.identityconnectors.framework.common.objects.filter.Filter;
import org.json.JSONArray;
+import org.json.JSONException;
import org.json.JSONObject;
-
import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
/**
* Contains logic for handling operations on Group object class.
*/
public class GroupProcessor extends Processor {
+ private static final String J_WS_REST_GET_MEMBERS_REQUEST = "WsRestGetMembersRequest";
+ private static final String J_WS_REST_FIND_GROUPS_REQUEST = "WsRestFindGroupsRequest";
+ private static final String J_WS_REST_FIND_STEMS_REQUEST = "WsRestFindStemsRequest";
+ private static final String J_WS_REST_ATTRIBUTE_ASSIGNMENT_LITE_REQUEST = "WsRestGetAttributeAssignmentsLiteRequest";
+
+ private static final String J_WS_QUERY_FILTER = "wsQueryFilter";
+ private static final String J_WS_STEM_QUERY_FILTER = "wsStemQueryFilter";
+ private static final String J_STEM_QUERY_FILTER_TYPE = "stemQueryFilterType";
+ private static final String J_INCLUDE_SUBJECT_DETAIL = "includeSubjectDetail";
+ private static final String J_QUERY_FILTER_TYPE = "queryFilterType";
+ private static final String J_STEM_NAME = "stemName";
+ private static final String J_STEM_NAME_SCOPE = "stemNameScope";
+ private static final String J_GROUP_NAME = "groupName";
+
+ private static final String J_WS_FIND_GROUPS_RESULTS = "WsFindGroupsResults";
+ private static final String J_WS_FIND_STEMS_RESULTS = "WsFindStemsResults";
+ private static final String J_WS_GET_MEMBERS_RESULTS = "WsGetMembersResults";
+ private static final String J_WS_ATTRIBUTE_ASSIGNMENT_RESULTS = "WsGetAttributeAssignmentsResults";
+
+ private static final String J_RESULTS = "results";
+ private static final String J_STEM_RESULTS = "stemResults";
+ private static final String J_GROUP_RESULTS = "groupResults";
+ private static final String J_WS_GROUP_LOOKUPS = "wsGroupLookups";
+ private static final String J_RESULT_METADATA = "resultMetadata";
+ private static final String J_RESULT_CODE = "resultCode";
+ private static final String J_SUCCESS = "success";
+ private static final String J_WS_ATTRIBUTE_ASSIGN_TYPE = "attributeAssignType";
+ private static final String J_WS_GROUP_NOT_FOUND = "GROUP_NOT_FOUND";
+
+ private static final String J_WS_SUBJECTS = "wsSubjects";
+ private static final String J_WS_GROUP = "wsGroup";
+ private static final String J_WS_GROUPS = "wsGroups";
+ private static final String J_WS_GROUP_TYPE = "group";
+
+ private static final String J_UUID = "uuid";
+ private static final String J_NAME = "name";
+ private static final String J_EXTENSION = "extension";
+ private static final String J_SOURCE_ID = "sourceId";
+ private static final String J_ID = "id";
+ private static final String J_PAGE_SIZE = "pageSize";
+ private static final String J_PAGE_NUMBER = "pageNumber";
+ private static final String J_ATTRIBUTE_NAME = "wsAttributeDefNameName";
+ private static final String J_ATTRIBUTE_VALUE = "wsAttributeDefValueValue";
+
+ private static final String VAL_T = "T";
+ private static final String VAL_FIND_BY_STEM_NAME = "FIND_BY_STEM_NAME";
+ private static final String VAL_ALL_IN_SUBTREE = "ALL_IN_SUBTREE";
+
+ private static final String PATH_GROUPS = "/groups";
+ private static final String PATH_STEMS = "/stems";
+ private static final String PATH_ATTRIBUTES = "/attributeAssignments";
+
+ private static final String ATTR_EXTENSION = J_EXTENSION;
+ private static final String DEFAULT_BASE_STEM = ":";
+
public static final String OBJECT_CLASS_NAME = "Group";
public static final String ATTR_NAME = "name";
public static final String ATTR_UUID = "uuid";
- private static final String ATTR_EXTENSION = J_EXTENSION;
public static final String ATTR_MEMBER = "member";
- private static final String DEFAULT_BASE_STEM = ":";
+ private final Map attributeNameValueMap = new HashMap<>();
+
GroupProcessor(GrouperConfiguration configuration) {
super(configuration);
+
+ if (configuration.getGroupAttribute() != null && configuration.getGroupAttribute().length >0) {
+ attributeNameValueMap.putAll(
+ Arrays.stream(configuration.getGroupAttribute())
+ .map(str -> str.split("\\|\\|"))
+ .collect(Collectors.toMap(str -> str[0].trim(), str -> str[1].trim()))
+ );
+ }
}
ObjectClass getObjectClass() {
@@ -53,8 +120,8 @@ ObjectClass getObjectClass() {
void read(Filter filter, ResultsHandler handler, OperationOptions options) {
if (filter == null) {
getAllGroups(handler, options);
- } else if (filter instanceof EqualsFilter) {
- Attribute attribute = ((EqualsFilter) filter).getAttribute();
+ } else if (filter instanceof EqualsFilter || filter instanceof ContainsFilter) {
+ Attribute attribute = ((AttributeFilter) filter).getAttribute();
if (attribute != null) {
List