Updated certain parameters to easily identify and pull information from

the DB for the component comparison page
This commit is contained in:
Cyrus 2024-03-19 08:35:19 -04:00
parent 32b10260fd
commit a0c2b227f0
11 changed files with 30 additions and 21 deletions

View File

@ -20,7 +20,7 @@ public interface ComponentAttributeRepository extends JpaRepository<ComponentAtt
* @param provisionSessionId unique id generated to link supply chain summary
* @return a list of attribute results
*/
List<ComponentAttributeResult> findByProvisionSessionId(UUID provisionSessionId);
List<ComponentAttributeResult> findByProvisionSessionId(String provisionSessionId);
/**
* Query to look up Attribute Results based on the component id and the session id.

View File

@ -60,7 +60,9 @@ public class SupplyChainValidationSummary extends ArchivableEntity {
private final Set<SupplyChainValidation> validations;
@Column
private UUID provisionSessionId;
private String provisionSessionId;
@Column
private String deviceName;
/**
* Default constructor necessary for Hibernate.
@ -70,6 +72,7 @@ public class SupplyChainValidationSummary extends ArchivableEntity {
overallValidationResult = AppraisalStatus.Status.FAIL;
validations = Collections.emptySet();
this.message = Strings.EMPTY;
this.deviceName = Strings.EMPTY;
}
/**
@ -190,9 +193,10 @@ public class SupplyChainValidationSummary extends ArchivableEntity {
*/
public SupplyChainValidationSummary(final Device device,
final Collection<SupplyChainValidation> validations,
final UUID provisionSessionId) {
final String provisionSessionId) {
this(device, validations);
this.provisionSessionId = provisionSessionId;
this.deviceName = this.device.getName();
}
/**

View File

@ -6,6 +6,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import java.util.UUID;
@ -21,7 +22,7 @@ public class ComponentAttributeResult extends ArchivableEntity {
private UUID componentId;
@Setter
private UUID provisionSessionId;
private String provisionSessionId;
private String expectedValue;
private String actualValue;

View File

@ -55,7 +55,7 @@ public class SupplyChainValidationService {
private CertificateRepository certificateRepository;
private SupplyChainValidationRepository supplyChainValidationRepository;
private SupplyChainValidationSummaryRepository supplyChainValidationSummaryRepository;
private UUID provisionSessionId;
private String provisionSessionId;
/**
* Constructor.
@ -109,7 +109,7 @@ public class SupplyChainValidationService {
final Device device,
final List<ComponentInfo> componentInfos) {
boolean acceptExpiredCerts = getPolicySettings().isExpiredCertificateValidationEnabled();
provisionSessionId = UUID.randomUUID();
provisionSessionId = UUID.randomUUID().toString();
PlatformCredential baseCredential = null;
SupplyChainValidation platformScv = null;
SupplyChainValidation basePlatformScv = null;

View File

@ -109,7 +109,7 @@ public class ValidationService {
final ComponentResultRepository componentResultRepository,
final ComponentAttributeRepository componentAttributeRepository,
final List<ComponentInfo> componentInfos,
final UUID provisionSessionId) {
final String provisionSessionId) {
final SupplyChainValidation.ValidationType validationType
= SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL_ATTRIBUTES;

View File

@ -208,7 +208,7 @@ public class CertificateAttributeScvValidator extends SupplyChainCredentialValid
final ComponentResultRepository componentResultRepository,
final ComponentAttributeRepository componentAttributeRepository,
final List<ComponentInfo> componentInfos,
final UUID provisionSessionId) {
final String provisionSessionId) {
boolean passesValidation = true;
StringBuilder resultMessage = new StringBuilder();

View File

@ -177,7 +177,7 @@ public class CredentialValidator extends SupplyChainCredentialValidator {
final ComponentResultRepository componentResultRepository,
final ComponentAttributeRepository componentAttributeRepository,
final List<ComponentInfo> componentInfos,
final UUID provisionSessionId) {
final String provisionSessionId) {
final String baseErrorMessage = "Can't validate platform credential attributes without ";
String message;
if (platformCredential == null) {

View File

@ -1,6 +1,5 @@
package hirs.attestationca.portal.page.controllers;
import hirs.attestationca.persist.entity.manager.CertificateRepository;
import hirs.attestationca.persist.entity.manager.ComponentAttributeRepository;
import hirs.attestationca.persist.entity.manager.ComponentInfoRepository;
import hirs.attestationca.persist.entity.manager.ComponentResultRepository;
@ -68,14 +67,14 @@ public class ComponentComparisonPageController extends PageController<Certificat
mav.addObject(MESSAGES_ATTRIBUTE, messages);
mav.addObject(INITIAL_DATA, data);
// Check if parameters were set
if (params.getId() == null) {
if (params.getSessionId() == null) {
String typeError = "ID was not provided";
messages.addError(typeError);
log.debug(typeError);
mav.addObject(MESSAGES_ATTRIBUTE, messages);
} else {
try {
UUID uuid = UUID.fromString(params.getId());
String uuid = params.getSessionId();
data.putAll(getPlatformComponentInformation(uuid, params.getDeviceName(),
platformCertificateRepository, componentResultRepository,
componentInfoRepository,
@ -113,7 +112,7 @@ public class ComponentComparisonPageController extends PageController<Certificat
* @throws IllegalArgumentException invalid argument on parsing the certificate
*/
public static HashMap<String, Object> getPlatformComponentInformation(
final UUID sessionId, final String deviceName,
final String sessionId, final String deviceName,
final PlatformCertificateRepository platformCertificateRepository,
final ComponentResultRepository componentResultRepository,
final ComponentInfoRepository componentInfoRepository,

View File

@ -13,10 +13,11 @@
<link type="text/css" rel="stylesheet" href="${common}/certificate_details.css"/>
<link type="text/css" rel="stylesheet" href="${common}/rim_details.css"/>
</jsp:attribute>
<c:if test="${param.sessionId==null}">
<c:redirect url = "${portal}/validation-reports"/>
</c:if>
<jsp:attribute name="pageHeaderTitle">Platform Component Failure Comparison</jsp:attribute>
<jsp:attribute name="pageHeaderTitle">Platform Component Failure Comparison
<c:if test="${param.sessionId==null}">
<c:redirect url = "${portal}/validation-reports"/>
</c:if>
</jsp:attribute>
<jsp:body>
<div id="certificate-details-page" class="container-fluid">

View File

@ -9,7 +9,7 @@
<jsp:attribute name="pageHeaderTitle">Error - 404</jsp:attribute>
<jsp:body>
<!--<div> Exception Message: <c:out value="${exception}"</c:out></div>
<div> from URL -> <span th:text="${url}"</span></div>-->
<div> Exception Message: <c:out value="${exception}" /></div>
<div> from URL -> <span th:text="${url}"</span></div>
</jsp:body>
</my:page>

View File

@ -185,7 +185,7 @@
var curValidation = full.validations[i];
var curResult = curValidation.validationResult;
var curMessage = curValidation.message;
var session = full.provisionSessionId;
var deviceName = full.deviceName
if (curValidation.validationType === validation_type) {
var unknownStatus = '<img class="icon" src="${unknownIcon}" title="${unknownText}"/>';
@ -209,12 +209,16 @@
switch (validation_type) {
case "PLATFORM_CREDENTIAL":
case "PLATFORM_CREDENTIAL_ATTRIBUTES":
case "ENDORSEMENT_CREDENTIAL":
html += '<a href="${portal}/certificate-details?id='
+ curValidation.certificatesUsed[0].id
+ '&type=' + certType + '">';
break;
case "PLATFORM_CREDENTIAL_ATTRIBUTES":
html += '<a href="${portal}/component-comparison?sessionId='
+ full.provisionSessionId
+ '&deviceName=' + deviceName + '">';
break;
}
}