Skip to content

Commit

Permalink
Fix #852: Allow scoping operation to a single activation ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jandusil committed Nov 15, 2023
1 parent ed125f1 commit 22371c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import lombok.Data;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public OperationUserActionResponse attemptApproveOperation(OperationApproveReque
final String data = request.getData();
final SignatureType signatureType = request.getSignatureType();
final Map<String, Object> additionalData = request.getAdditionalData();
parseDeviceFromUserAgent(additionalData);
parseAndAddDeviceFromUserAgent(additionalData);

// Check if the operation exists
final Optional<OperationEntity> operationOptional = operationRepository.findOperationWithLock(operationId);
Expand Down Expand Up @@ -362,7 +362,7 @@ public OperationUserActionResponse rejectOperation(OperationRejectRequest reques
final String userId = request.getUserId();
final String applicationId = request.getApplicationId();
final Map<String, Object> additionalData = request.getAdditionalData();
parseDeviceFromUserAgent(additionalData);
parseAndAddDeviceFromUserAgent(additionalData);

// Check if the operation exists
final Optional<OperationEntity> operationOptional = operationRepository.findOperationWithLock(operationId);
Expand Down Expand Up @@ -442,7 +442,7 @@ public OperationUserActionResponse failApprovalOperation(OperationFailApprovalRe

final String operationId = request.getOperationId();
final Map<String, Object> additionalData = request.getAdditionalData();
parseDeviceFromUserAgent(additionalData);
parseAndAddDeviceFromUserAgent(additionalData);

// Check if the operation exists
final Optional<OperationEntity> operationOptional = operationRepository.findOperationWithLock(operationId);
Expand Down Expand Up @@ -520,7 +520,7 @@ public OperationDetailResponse cancelOperation(OperationCancelRequest request) t

final String operationId = request.getOperationId();
final Map<String, Object> additionalData = request.getAdditionalData();
parseDeviceFromUserAgent(additionalData);
parseAndAddDeviceFromUserAgent(additionalData);

// Check if the operation exists
final Optional<OperationEntity> operationOptional = operationRepository.findOperationWithLock(operationId);
Expand Down Expand Up @@ -821,7 +821,7 @@ private ProximityCheckResult fetchProximityCheckResult(final OperationEntity ope
}
}

private static void parseDeviceFromUserAgent(Map<String, Object> additionalData) {
private static void parseAndAddDeviceFromUserAgent(Map<String, Object> additionalData) {
final Object userAgentObject = additionalData.get(ATTR_USER_AGENT);
if (userAgentObject != null) {
final UserAgent.Device device = UserAgent.parse(userAgentObject.toString());
Expand Down

0 comments on commit 22371c7

Please sign in to comment.