mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-28 20:26:05 +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.
|
* 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
|
* @return a list of attribute results
|
||||||
*/
|
*/
|
||||||
List<ComponentAttributeResult> findByProvisionSessionId(UUID provisionSessionId);
|
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,
|
SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL,
|
||||||
platformScv.getValidationResult(), aes, platformScv.getMessage()));
|
platformScv.getValidationResult(), aes, platformScv.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateComponentStatus(componentResultRepository
|
||||||
|
.findByCertificateSerialNumberAndBoardSerialNumber(
|
||||||
|
baseCredential.getSerialNumber().toString(),
|
||||||
|
baseCredential.getPlatformSerial()));
|
||||||
}
|
}
|
||||||
if (!attrErrorMessage.isEmpty()) {
|
if (!attrErrorMessage.isEmpty()) {
|
||||||
//combine platform and platform attributes
|
//combine platform and platform attributes
|
||||||
@ -397,10 +402,16 @@ public class SupplyChainValidationService {
|
|||||||
* @param componentResults list of associated component results
|
* @param componentResults list of associated component results
|
||||||
*/
|
*/
|
||||||
private void updateComponentStatus(final List<ComponentResult> componentResults) {
|
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) {
|
for (ComponentResult componentResult : componentResults) {
|
||||||
componentAttributeResults = componentAttributeRepository.findByComponentId(componentResult.getId());
|
componentResult.setFailedValidation(componentIdList.contains(componentResult.getId()));
|
||||||
componentResult.setFailedValidation(!componentAttributeResults.isEmpty());
|
|
||||||
componentResultRepository.save(componentResult);
|
componentResultRepository.save(componentResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user