Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing ServiceProviderConfig to show cursor pagination is enabled. #370

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class CharonConfiguration implements Configuration {

//default count value for pagination
private int count;
private boolean cursorSupport;

/*
* set documentationURL
Expand Down Expand Up @@ -78,6 +79,15 @@ public void setFilterSupport(boolean supported, int maxResults) {
this.maxResults = maxResults;
}

/**
* Set pagination support
* @param supported
*/
public void setCursorPaginationSupport(boolean supported) {

this.cursorSupport = supported;
}

/*
* set Change Password Support
* @param supported
Expand Down Expand Up @@ -145,6 +155,7 @@ public HashMap<String, Object> getConfig() {
configMap.put(SCIMConfigConstants.PATCH, patchSupport);
configMap.put(SCIMConfigConstants.AUTHENTICATION_SCHEMES, authenticationSchemes);
configMap.put(SCIMConfigConstants.PAGINATION_DEFAULT_COUNT, count);
configMap.put(SCIMConfigConstants.CURSOR, cursorSupport);
return configMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class SCIMConfigConstants {
public static final String AUTHENTICATION_SCHEMES = "authenticationSchemes";
public static final String SCIM_SCHEMA_EXTENSION_CONFIG = "scim2-schema-extension.config";
public static final String PAGINATION_DEFAULT_COUNT = "pagination-default-count";

public static final String CURSOR = "cursor";

}

Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ public String buildServiceProviderConfigJsonBody(HashMap<String, Object> config)
changePasswordObject.put(SCIMConstants.ServiceProviderConfigSchemaConstants.SUPPORTED,
config.get(SCIMConfigConstants.CHNAGE_PASSWORD));

JSONObject paginationObject = new JSONObject();
paginationObject.put(SCIMConstants.ServiceProviderConfigSchemaConstants.CURSOR,
config.get(SCIMConfigConstants.CURSOR));

JSONArray authenticationSchemesArray = new JSONArray();
ArrayList<Object[]> values = (ArrayList<Object[]>) config.get(SCIMConfigConstants.AUTHENTICATION_SCHEMES);

Expand Down Expand Up @@ -457,6 +461,8 @@ public String buildServiceProviderConfigJsonBody(HashMap<String, Object> config)
etagObject);
rootObject.put(SCIMConstants.ServiceProviderConfigSchemaConstants.AUTHENTICATION_SCHEMAS,
authenticationSchemesArray);
rootObject.put(SCIMConstants.ServiceProviderConfigSchemaConstants.PAGINATION,
paginationObject);

return rootObject.toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,21 @@ public static class ServiceProviderConfigSchemaConstants {
"urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig:etag.supported";
public static final String AUTHENTICATION_SCHEMAS_DOCUMENTATION_URI_URI =
"urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig:authenticationSchemes.documentationUri";
public static final String PAGINATION = "pagination";
public static final String PAGINATION_URI =
"urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig:pagination";
public static final String CURSOR = "cursor";
public static final String CURSOR_URI =
"urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig:pagination.cursor";


/*******Attributes descriptions of the attributes found in Service Provider Config Schema.***************/

public static final String DOCUMENTATION_URI_DESC = "An HTTP-addressable URL pointing to the service " +
"provider's human-consumable help documentation.";
public static final String PATCH_DESC = "A complex type that specifies PATCH configuration options.";
public static final String PAGINATION_DESC = "A complex type which specifies the pagination types available.";
public static final String CURSOR_DESC = "A boolean which specifies if cursor pagination is supported";
public static final String BULK_DESC = "A complex type that specifies bulk configuration options.";
public static final String FILTERS_DESC = "A complex type that specifies FILTER options.";
public static final String CHANGE_PASSWORD_DESC = "A complex type that specifies configuration options " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,15 @@ public static class SCIMServiceProviderConfigSchemaDefinition {
.EXTERNAL)),
null);

public static final SCIMAttributeSchema CURSOR_PAGINATION =
SCIMAttributeSchema.createSCIMAttributeSchema(
SCIMConstants.ServiceProviderConfigSchemaConstants.CURSOR_URI,
SCIMConstants.ServiceProviderConfigSchemaConstants.CURSOR,
SCIMDefinitions.DataType.BOOLEAN, false,
SCIMConstants.ServiceProviderConfigSchemaConstants.CURSOR_DESC, true, false,
SCIMDefinitions.Mutability.READ_ONLY, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null, null);

public static final SCIMAttributeSchema TYPE =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.ServiceProviderConfigSchemaConstants
.TYPE_URL,
Expand Down Expand Up @@ -1319,7 +1328,15 @@ public static class SCIMServiceProviderConfigSchemaDefinition {
new ArrayList<AttributeSchema>(Arrays.asList(NAME, DESCRIPTION,
SPEC_URI, AUTHENTICATION_SCHEMES_DOCUMENTATION_URI, TYPE, PRIMARY)));


public static final SCIMAttributeSchema PAGINATION =
SCIMAttributeSchema.createSCIMAttributeSchema(
SCIMConstants.ServiceProviderConfigSchemaConstants.PAGINATION_URI,
SCIMConstants.ServiceProviderConfigSchemaConstants.PAGINATION,
SCIMDefinitions.DataType.COMPLEX, false,
SCIMConstants.ServiceProviderConfigSchemaConstants.PAGINATION_DESC, true, false,
SCIMDefinitions.Mutability.READ_ONLY, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null,
new ArrayList<AttributeSchema>(Arrays.asList(CURSOR_PAGINATION)));
}

/**
Expand Down Expand Up @@ -1490,6 +1507,7 @@ public static class SCIMResourceTypeSchemaDefinition {
SCIMServiceProviderConfigSchemaDefinition.SORT,
SCIMServiceProviderConfigSchemaDefinition.FILTER,
SCIMServiceProviderConfigSchemaDefinition.CHANGE_PASSWORD,
SCIMServiceProviderConfigSchemaDefinition.PAGINATION,
SCIMServiceProviderConfigSchemaDefinition.ETAG,
SCIMServiceProviderConfigSchemaDefinition.AUTHENTICATION_SCHEMES);

Expand Down