Skip to content

Commit

Permalink
Merge pull request #312 from Sreejit-K/claim-mismatch-on-property-update
Browse files Browse the repository at this point in the history
claim mis-mapping fix on property update
  • Loading branch information
srprasanna authored Apr 25, 2024
2 parents c5ce259 + 1dc445e commit a23865b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,10 @@ private static JsonNode searchClaimOsIdFromRequestProperties(ArrayNode arrayNode
}
}
}
return arrayNode.get(arrayNode.size() - 1);
List<JsonNode> nodeList = new ArrayList<>();
arrayNode.elements().forEachRemaining(nodeList::add);
nodeList.sort(Comparator.comparingLong(node -> node.get("osCreatedAt").asLong()));
return nodeList.get(nodeList.size() -1 );
}

private static boolean isRequestBodyPropertyPresentInClaim(Map<String,List<String>> requestBodyProperty,Map<String,JsonNode> claimEntryProperty){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.Date;

@RestController
@ConditionalOnProperty(name = "claims.enabled", havingValue = "true")
Expand Down Expand Up @@ -140,6 +141,7 @@ public ResponseEntity<Object> riseAttestation(HttpServletRequest request, @Reque
if(!propertyData.isNull()) {
attestationRequest.setPropertyData(propertyData);
}
attestationRequest.setOsCreatedAt(new Date());
attestationRequest.setUserId(userId);
attestationRequest.setEmailId(emailId);
String attestationOSID = registryHelper.triggerAttestation(attestationRequest, attestationPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;
import java.util.Map;

Expand All @@ -22,4 +23,5 @@ public class AttestationRequest {
private Map<String, List<String>> propertiesOSID;
private JsonNode propertyData;
private String emailId;
private Date osCreatedAt;
}

0 comments on commit a23865b

Please sign in to comment.