diff --git a/components/org.wso2.carbon.identity.scim2.provider/src/main/java/org/wso2/carbon/identity/scim2/provider/resources/UserResource.java b/components/org.wso2.carbon.identity.scim2.provider/src/main/java/org/wso2/carbon/identity/scim2/provider/resources/UserResource.java index fd1dcba01..817fc7278 100644 --- a/components/org.wso2.carbon.identity.scim2.provider/src/main/java/org/wso2/carbon/identity/scim2/provider/resources/UserResource.java +++ b/components/org.wso2.carbon.identity.scim2.provider/src/main/java/org/wso2/carbon/identity/scim2/provider/resources/UserResource.java @@ -197,6 +197,11 @@ public Response getUser(@HeaderParam(SCIMProviderConstants.ACCEPT_HEADER) String throw new FormatNotSupportedException(error); } + // Validates the count parameter if exists. + if (count != null && IdentityUtil.isSCIM2UserMaxItemsPerPageEnabled()) { + count = validateCountParameter(count); + } + // obtain the user store manager UserManager userManager = IdentitySCIMManager.getInstance().getUserManager(); @@ -392,4 +397,24 @@ private void removeAskPasswordConfirmationCodeThreadLocal() { IdentityUtil.threadLocalProperties.get() .remove(IdentityRecoveryConstants.AP_CONFIRMATION_CODE_THREAD_LOCAL_PROPERTY); } + + /** + * Validate the count query parameter. + * + * @param count Requested item count. + * @return Validated count parameter. + */ + private int validateCountParameter(Integer count) { + + int maximumItemsPerPage = IdentityUtil.getMaximumItemPerPage(); + if (count > maximumItemsPerPage) { + if (LOG.isDebugEnabled()) { + LOG.debug(String.format("Given limit exceeds the maximum limit. Therefore the limit is set to %s.", + maximumItemsPerPage)); + } + return maximumItemsPerPage; + } + + return count; + } } diff --git a/pom.xml b/pom.xml index 791dc36f8..035d9b4fe 100644 --- a/pom.xml +++ b/pom.xml @@ -285,7 +285,7 @@ 6.5.3 3.2.0.wso2v1 4.10.2 - 7.0.105 + 7.0.112 4.13.1 20030203.000129 1.8.12