mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-28 12:21:10 +00:00
Added using the session id for the component mismatching
This commit is contained in:
parent
769afec6ce
commit
21525fc882
@ -17,8 +17,16 @@ public interface ComponentAttributeRepository extends JpaRepository<ComponentAtt
|
||||
|
||||
/**
|
||||
* Query to look up Attribute Results based on the validation id.
|
||||
* @param provisionSessionId uuid for the supplychainvalidationsummary
|
||||
* @param provisionSessionId unique id generated to link supply chain summary
|
||||
* @return a list of attribute results
|
||||
*/
|
||||
List<ComponentAttributeResult> findByProvisionSessionId(UUID provisionSessionId);
|
||||
|
||||
/**
|
||||
* Query to look up Attribute Results based on the component id and the session id.
|
||||
* @param componentId the unique id for the component identifier
|
||||
* @param provisionSessionId unique id generated to link supply chain summary
|
||||
* @return a list of attribute results
|
||||
*/
|
||||
List<ComponentAttributeResult> findByComponentIdAndProvisionSessionId(UUID componentId, UUID provisionSessionId);
|
||||
}
|
||||
|
@ -245,6 +245,11 @@ public class SupplyChainValidationService {
|
||||
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||
platformScv.getValidationResult(), aes, platformScv.getMessage()));
|
||||
}
|
||||
|
||||
updateComponentStatus(componentResultRepository
|
||||
.findByCertificateSerialNumberAndBoardSerialNumber(
|
||||
baseCredential.getSerialNumber().toString(),
|
||||
baseCredential.getPlatformSerial()));
|
||||
}
|
||||
if (!attrErrorMessage.isEmpty()) {
|
||||
//combine platform and platform attributes
|
||||
@ -397,10 +402,16 @@ public class SupplyChainValidationService {
|
||||
* @param componentResults list of associated component results
|
||||
*/
|
||||
private void updateComponentStatus(final List<ComponentResult> componentResults) {
|
||||
List<ComponentAttributeResult> componentAttributeResults;
|
||||
List<ComponentAttributeResult> componentAttributeResults = componentAttributeRepository
|
||||
.findByProvisionSessionId(provisionSessionId);
|
||||
List<UUID> componentIdList = new ArrayList<>();
|
||||
|
||||
for (ComponentAttributeResult componentAttributeResult : componentAttributeResults) {
|
||||
componentIdList.add(componentAttributeResult.getComponentId());
|
||||
}
|
||||
|
||||
for (ComponentResult componentResult : componentResults) {
|
||||
componentAttributeResults = componentAttributeRepository.findByComponentId(componentResult.getId());
|
||||
componentResult.setFailedValidation(!componentAttributeResults.isEmpty());
|
||||
componentResult.setFailedValidation(componentIdList.contains(componentResult.getId()));
|
||||
componentResultRepository.save(componentResult);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user