Skip to content

Commit

Permalink
Fix #914: Operation history fails for big response (backport) (#920)
Browse files Browse the repository at this point in the history
* Fix #914: Operation history fails for big response

(cherry picked from commit 6b46e8a)

* Update PAS to 1.5.2
  • Loading branch information
banterCZ authored Nov 16, 2023
1 parent fe4f73a commit c208028
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ public OperationListResponse operationListForUser(
final OperationListForUserRequest request = new OperationListForUserRequest();
request.setUserId(userId);
request.setApplications(List.of(applicationId));
request.setPageNumber(0);
request.setPageSize(OPERATION_LIST_LIMIT);
final MultiValueMap<String, String> queryParams = httpCustomizationService.getQueryParams();
final MultiValueMap<String, String> httpHeaders = httpCustomizationService.getHttpHeaders();
final com.wultra.security.powerauth.client.model.response.OperationListResponse pendingList =
final com.wultra.security.powerauth.client.model.response.OperationListResponse operations =
pendingOnly ?
powerAuthClient.operationPendingList(request, queryParams, httpHeaders) :
powerAuthClient.operationList(request, queryParams, httpHeaders);

final OperationListResponse responseObject = new OperationListResponse();
for (OperationDetailResponse operationDetail: pendingList) {
for (OperationDetailResponse operationDetail: operations) {
final String activationFlag = operationDetail.getActivationFlag();
if (activationFlag == null || activationFlags.contains(activationFlag)) { // only return data if there is no flag, or if flag matches flags of activation
final Optional<OperationTemplateEntity> operationTemplate = operationTemplateService.findTemplate(operationDetail.getOperationType(), language);
Expand All @@ -127,10 +129,6 @@ public OperationListResponse operationListForUser(
}
final Operation operation = mobileTokenConverter.convert(operationDetail, operationTemplate.get());
responseObject.add(operation);
if (responseObject.size() >= OPERATION_LIST_LIMIT) {
logger.info("Reached the limit of operation list ({}) for user ID: {}", OPERATION_LIST_LIMIT, userId);
break;
}
}
}
return responseObject;
Expand Down
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<moneta.version>1.4.2</moneta.version>

<wultra-core.version>1.7.0</wultra-core.version>
<powerauth.version>1.5.2</powerauth.version>
<powerauth-crypto.version>1.5.1</powerauth-crypto.version>
<powerauth-restful-integration.version>1.5.0</powerauth-restful-integration.version>
<powerauth-push.version>1.5.0</powerauth-push.version>
Expand Down Expand Up @@ -121,6 +122,18 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-client-model</artifactId>
<version>${powerauth.version}</version>
</dependency>

<dependency>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-rest-client-spring</artifactId>
<version>${powerauth.version}</version>
</dependency>

<dependency>
<groupId>io.getlime.core</groupId>
<artifactId>annotations</artifactId>
Expand Down

0 comments on commit c208028

Please sign in to comment.