Cleaned up some comments and code.

This commit is contained in:
Cyrus 2020-12-07 09:47:54 -05:00
parent a3de35ed27
commit 209024c12a
2 changed files with 9 additions and 18 deletions

View File

@ -361,13 +361,9 @@ public abstract class AbstractAttestationCertificateAuthority
// generate the identity credential // generate the identity credential
LOG.debug("generating credential from identity proof"); LOG.debug("generating credential from identity proof");
// check the policy set valid date // check the policy set valid date
try { SupplyChainPolicy scp = this.supplyChainValidationService.getPolicy();
SupplyChainPolicy scp = this.supplyChainValidationService.getPolicy(); if (scp != null) {
if (scp != null) { this.validDays = Integer.parseInt(scp.getValidityDays());
this.validDays = Integer.parseInt(scp.getValidityDays());
}
} catch (Exception ex) {
LOG.error("Error");
} }
// transform the public key struct into a public key // transform the public key struct into a public key
PublicKey publicKey = assemblePublicKey(proof.getIdentityKey().getStorePubKey().getKey()); PublicKey publicKey = assemblePublicKey(proof.getIdentityKey().getStorePubKey().getKey());
@ -1714,9 +1710,9 @@ public abstract class AbstractAttestationCertificateAuthority
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error saving generated Attestation Certificate to database.", e); LOG.error("Error saving generated Attestation Certificate to database.", e);
// throw new CertificateProcessingException( throw new CertificateProcessingException(
// "Encountered error while storing Attestation Certificate: " "Encountered error while storing Attestation Certificate: "
// + e.getMessage(), e); + e.getMessage(), e);
} }
} }
} }

View File

@ -44,7 +44,6 @@ public class PolicyPageController extends PageController<NoPageParams> {
private static final String ENABLED_EXPIRES_PARAMETER_VALUE = "expires"; private static final String ENABLED_EXPIRES_PARAMETER_VALUE = "expires";
private PolicyManager policyManager; private PolicyManager policyManager;
private AppraiserManager appraiserManager; private AppraiserManager appraiserManager;
/** /**
@ -69,7 +68,6 @@ public class PolicyPageController extends PageController<NoPageParams> {
public PolicyPageController(final PolicyManager policyManager, public PolicyPageController(final PolicyManager policyManager,
final AppraiserManager appraiserManager) { final AppraiserManager appraiserManager) {
super(POLICY); super(POLICY);
this.policyManager = policyManager; this.policyManager = policyManager;
this.appraiserManager = appraiserManager; this.appraiserManager = appraiserManager;
} }
@ -231,7 +229,7 @@ public class PolicyPageController extends PageController<NoPageParams> {
try { try {
SupplyChainPolicy policy = getDefaultPolicyAndSetInModel(ppModel, model); SupplyChainPolicy policy = getDefaultPolicyAndSetInModel(ppModel, model);
if (issuedAttestationOptionEnabled) { if (issuedAttestationOptionEnabled || generateCertificateEnabled) {
successMessage = "Attestation Certificate generation enabled."; successMessage = "Attestation Certificate generation enabled.";
} else { } else {
successMessage = "Attestation Certificate generation disabled."; successMessage = "Attestation Certificate generation disabled.";
@ -302,12 +300,10 @@ public class PolicyPageController extends PageController<NoPageParams> {
} }
savePolicyAndApplySuccessMessage(ppModel, model, messages, successMessage, policy); savePolicyAndApplySuccessMessage(ppModel, model, messages, successMessage, policy);
} catch (PolicyManagerException e) { } catch (PolicyManagerException e) {
handlePolicyManagerUpdateError(model, messages, e, handlePolicyManagerUpdateError(model, messages, e,
"Error changing ACA endorsement validation policy", "Error changing ACA endorsement validation policy",
"Error updating policy. \n" + e.getMessage()); "Error updating policy. \n" + e.getMessage());
} }
// return the redirect // return the redirect
@ -396,7 +392,7 @@ public class PolicyPageController extends PageController<NoPageParams> {
if (ignoreImaOptionEnabled && !policy.isFirmwareValidationEnabled()) { if (ignoreImaOptionEnabled && !policy.isFirmwareValidationEnabled()) {
handleUserError(model, messages, handleUserError(model, messages,
"Ignore IMA can not be " "Ignore IMA can not be "
+ "enabled without Firmware Valdiation policy enabled."); + "enabled without Firmware Validation policy enabled.");
return redirectToSelf(new NoPageParams(), model, attr); return redirectToSelf(new NoPageParams(), model, attr);
} }
@ -447,7 +443,7 @@ public class PolicyPageController extends PageController<NoPageParams> {
if (ignoreTbootOptionEnabled && !policy.isFirmwareValidationEnabled()) { if (ignoreTbootOptionEnabled && !policy.isFirmwareValidationEnabled()) {
handleUserError(model, messages, handleUserError(model, messages,
"Ignore TBoot can not be " "Ignore TBoot can not be "
+ "enabled without Firmware Valdiation policy enabled."); + "enabled without Firmware Validation policy enabled.");
return redirectToSelf(new NoPageParams(), model, attr); return redirectToSelf(new NoPageParams(), model, attr);
} }
@ -551,5 +547,4 @@ public class PolicyPageController extends PageController<NoPageParams> {
model.put(MESSAGES_ATTRIBUTE, messages); model.put(MESSAGES_ATTRIBUTE, messages);
} }
} }