issue_847: Started handling a good chunk of the styling issues. Lots of javadocumenting.

This commit is contained in:
TheSilentCoder 2024-10-16 17:59:58 -04:00
parent 2dcdc15c54
commit af75105f35
25 changed files with 580 additions and 58 deletions

View File

@ -45,15 +45,7 @@ public abstract class AttestationCertificateAuthority {
* A handle to the service used to validate the supply chain.
*/
private final SupplyChainValidationService supplyChainValidationService;
/**
* Container wired application configuration property identifying the number of days that
* certificates issued by this ACA are valid for.
*/
private Integer validDays = 1;
private final ComponentResultRepository componentResultRepository;
private ComponentInfoRepository componentInfoRepository;
private final CertificateRepository certificateRepository;
private final IssuedCertificateRepository issuedCertificateRepository;
private final ReferenceManifestRepository referenceManifestRepository;
@ -62,12 +54,18 @@ public abstract class AttestationCertificateAuthority {
private final ReferenceDigestValueRepository referenceDigestValueRepository;
private final PolicyRepository policyRepository;
private final TPM2ProvisionerStateRepository tpm2ProvisionerStateRepository;
private CertificateRequestProcessor certificateRequestHandler;
private IdentityClaimProcessor identityClaimHandler;
private final ComponentInfoRepository componentInfoRepository;
private final CertificateRequestProcessor certificateRequestHandler;
private final IdentityClaimProcessor identityClaimHandler;
/**
* Container wired application configuration property identifying the number of days that
* certificates issued by this ACA are valid for.
*/
private Integer validDays = 1;
/**
* Constructor.
*
* @param supplyChainValidationService the supply chain service
* @param privateKey the ACA private key
* @param acaCertificate the ACA certificate
@ -75,6 +73,7 @@ public abstract class AttestationCertificateAuthority {
* @param componentResultRepository the component result manager
* @param componentInfoRepository the component info manager
* @param certificateRepository the certificate manager
* @param issuedCertificateRepository the issued certificate repository
* @param referenceManifestRepository the Reference Manifest manager
* @param validDays the number of days issued certs are valid
* @param deviceRepository the device manager
@ -82,7 +81,6 @@ public abstract class AttestationCertificateAuthority {
* @param policyRepository policy setting repository
* @param tpm2ProvisionerStateRepository tpm2 provisioner state repository
*/
@SuppressWarnings("checkstyle:parameternumber")
public AttestationCertificateAuthority(
final SupplyChainValidationService supplyChainValidationService,
final PrivateKey privateKey, final X509Certificate acaCertificate,
@ -121,14 +119,31 @@ public abstract class AttestationCertificateAuthority {
deviceRepository, tpm2ProvisionerStateRepository, policyRepository);
}
/**
* Processes the provided identity claim.
*
* @param identityClaim a byte array representation of the identity claim
* @return processed identity claim response
*/
byte[] processIdentityClaimTpm2(final byte[] identityClaim) {
return this.identityClaimHandler.processIdentityClaimTpm2(identityClaim);
}
/**
* Processes the provided certificate request.
*
* @param certificateRequest a byte array representation of the certificate request
* @return processed certificate request response
*/
byte[] processCertificateRequest(final byte[] certificateRequest) {
return this.certificateRequestHandler.processCertificateRequest(certificateRequest);
}
/**
* Retrieves the encoded public key.
*
* @return encoded public key
*/
public byte[] getPublicKey() {
return acaCertificate.getPublicKey().getEncoded();
}

View File

@ -4,10 +4,13 @@ import jakarta.persistence.criteria.CriteriaQuery;
/**
* Allows a user of the DBManager to modify the criteria object before processing.
*
* @param <T> the parameter type
*/
public interface CriteriaModifier<T> {
/**
* Allows a client to modify the criteria object by reference.
*
* @param criteria The hibernate criteria builder object
*/
void modify(CriteriaQuery<T> criteria);

View File

@ -12,8 +12,7 @@ public class DBManagerException extends RuntimeException {
* Creates a new <code>DBManagerException</code> that has the message
* <code>msg</code>.
*
* @param msg
* exception message
* @param msg exception message
*/
public DBManagerException(final String msg) {
super(msg);
@ -23,8 +22,7 @@ public class DBManagerException extends RuntimeException {
* Creates a new <code>DBManagerException</code> that wraps the given
* <code>Throwable</code>.
*
* @param t
* root cause
* @param t root cause
*/
public DBManagerException(final Throwable t) {
super(t);
@ -34,10 +32,8 @@ public class DBManagerException extends RuntimeException {
* Creates a new <code>DBManagerException</code> that has the message
* <code>msg</code> and wraps the root cause.
*
* @param msg
* exception message
* @param t
* root cause
* @param msg exception message
* @param t root cause
*/
public DBManagerException(final String msg, final Throwable t) {
super(msg, t);

View File

@ -17,5 +17,7 @@ import java.util.ArrayList;
@EqualsAndHashCode(callSuper = false)
public class FilteredRecordsList<T> extends ArrayList<T> {
private long recordsTotal, recordsFiltered;
private long recordsTotal;
private long recordsFiltered;
}

View File

@ -33,13 +33,13 @@ import java.security.cert.X509Certificate;
// detects if file exists, if not, ignore errors
@PropertySource(value = "file:/etc/hirs/aca/application.properties",
ignoreResourceNotFound = true),
@PropertySource(value = "file:C:/ProgramData/hirs/aca/application.win.properties",
ignoreResourceNotFound = true)
})
@RestController
@RequestMapping("/HIRS_AttestationCA")
public class RestfulAttestationCertificateAuthority extends AttestationCertificateAuthority implements RestfulInterface {
public class RestfulAttestationCertificateAuthority extends AttestationCertificateAuthority
implements RestfulInterface {
/**
* Constructor.
@ -47,8 +47,11 @@ public class RestfulAttestationCertificateAuthority extends AttestationCertifica
* @param supplyChainValidationService scp service
* @param privateKey the ACA private key
* @param acaCertificate the ACA certificate
* @param structConverter the struct converter
* @param componentResultRepository the component result repository
* @param componentInfoRepository the component info repository
* @param certificateRepository the certificate manager
* @param issuedCertificateRepository the issued certificate repository
* @param referenceManifestRepository the referenceManifestManager
* @param validDays the number of days issued certs are valid
* @param deviceRepository the device manager
@ -56,11 +59,11 @@ public class RestfulAttestationCertificateAuthority extends AttestationCertifica
* @param policyRepository the provisioning policy entity
* @param tpm2ProvisionerStateRepository the provisioner state
*/
@SuppressWarnings({"checkstyle:parameternumber"})
@Autowired
public RestfulAttestationCertificateAuthority(
final SupplyChainValidationService supplyChainValidationService,
final PrivateKey privateKey, final X509Certificate acaCertificate,
final PrivateKey privateKey,
final X509Certificate acaCertificate,
final StructConverter structConverter,
final ComponentResultRepository componentResultRepository,
final ComponentInfoRepository componentInfoRepository,
@ -82,7 +85,7 @@ public class RestfulAttestationCertificateAuthority extends AttestationCertifica
/**
* Listener for identity requests from TPM 2.0 provisioning.
*
* <p>
* Processes a given IdentityClaim and generates a response
* containing an encrypted nonce to be returned by the client in
* a future handshake request.
@ -121,8 +124,8 @@ public class RestfulAttestationCertificateAuthority extends AttestationCertifica
* (non-javadoc)
* <p>
* Wrap the {@link AttestationCertificateAuthority#getPublicKey()} with a Spring
* {@link org.springframework.web.bind.annotation.RequestMapping} such that Spring can serialize the certificate to be returned to an
* HTTP Request.
* {@link org.springframework.web.bind.annotation.RequestMapping} such that Spring can serialize
* the certificate to be returned to an HTTP Request.
*/
@Override
@ResponseBody

View File

@ -5,8 +5,20 @@ package hirs.attestationca.persist;
*/
public interface RestfulInterface {
/**
* Processes the provided identity claim.
*
* @param identityClaim a byte array representation of the identity claim
* @return a byte array representation of the identity claim response
*/
byte[] processIdentityClaimTpm2(byte[] identityClaim);
/**
* Processes the provided certificate request.
*
* @param certificateRequest a byte array representation of the certificate request
* @return a byte array representation of the certificate request response
*/
byte[] processCertificateRequest(byte[] certificateRequest);
}

View File

@ -47,9 +47,10 @@ public abstract class AbstractEntity implements Serializable {
/**
* Setter for the UUID that can not be null
* and can not be overridden.
*
* @param id - primary able key
*/
public void setId(UUID id) {
public void setId(final UUID id) {
if (id != null) {
this.id = id;
}
@ -74,6 +75,11 @@ public abstract class AbstractEntity implements Serializable {
createTime.setTime(new Date().getTime());
}
/**
* Generates an integer hash code for this entity.
*
* @return hash code
*/
@Override
public int hashCode() {
if (id != null) {
@ -82,6 +88,13 @@ public abstract class AbstractEntity implements Serializable {
return super.hashCode();
}
/**
* Compares this entity to the provided object to verify
* that both objects are equal.
*
* @param object object to compare
* @return true if they are equal, false otherwise
*/
@Override
public boolean equals(final Object object) {
if (this == object) {

View File

@ -6,7 +6,11 @@ import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.*;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* The <code>Appraiser</code> class represents an appraiser that can appraise a <code>Report</code>.

View File

@ -12,12 +12,77 @@ import java.util.UUID;
@Repository
public interface CACredentialRepository extends JpaRepository<CertificateAuthorityCredential, UUID> {
/**
* Query that retrieves a list of certificate authority credentials using the provided archive flag.
*
* @param archiveFlag archive flag
* @return a list of certificate authority credentials
*/
List<CertificateAuthorityCredential> findByArchiveFlag(boolean archiveFlag);
/**
* Query that retrieves a page of certificate authority credentials using the provided archive
* flag and the provided pageable.
*
* @param archiveFlag archive flag
* @param pageable pageable
* @return a page of certificate authority credentials
*/
Page<CertificateAuthorityCredential> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
* Query that retrieves a list of certificate authority credentials using the provided subject.
*
* @param subject subject
* @return a list of certificate authority credentials
*/
List<CertificateAuthorityCredential> findBySubject(String subject);
/**
* Query that retrieves a sorted list of certificate authority credentials using the provided subject.
*
* @param subject subject
* @return a sorted list of certificate authority credentials
*/
List<CertificateAuthorityCredential> findBySubjectSorted(String subject);
/**
* Query that retrieves a list of certificate authority credentials using the provided subject
* and the provided archive flag.
*
* @param subject subject
* @param archiveFlag archive flag
* @return a list of certificate authority credentials
*/
List<CertificateAuthorityCredential> findBySubjectAndArchiveFlag(String subject, boolean archiveFlag);
List<CertificateAuthorityCredential> findBySubjectSortedAndArchiveFlag(String subject, boolean archiveFlag);
/**
* Query that retrieves a sorted list of certificate authority credentials using the provided subject
* and the provided archive flag.
*
* @param subject subject
* @param archiveFlag archive flag
* @return a sorted list of certificate authority credentials
*/
List<CertificateAuthorityCredential> findBySubjectSortedAndArchiveFlag(String subject,
boolean archiveFlag);
/**
* Query that retrieves a certificate authority credential using the provided subject key identifier.
*
* @param subjectKeyIdentifier byte array representation of the subject key identifier
* @return a certificate authority credential
*/
CertificateAuthorityCredential findBySubjectKeyIdentifier(byte[] subjectKeyIdentifier);
CertificateAuthorityCredential findBySubjectKeyIdStringAndArchiveFlag(String subjectKeyIdString, boolean archiveFlag);
/**
* Query that retrieves a certificate authority credential using the provided subject key identifier
* and the provided archive flag.
*
* @param subjectKeyIdString string representation of the subject key id
* @param archiveFlag archive flag
* @return a certificate authority credential
*/
CertificateAuthorityCredential findBySubjectKeyIdStringAndArchiveFlag(String subjectKeyIdString,
boolean archiveFlag);
}

View File

@ -16,26 +16,122 @@ import java.util.UUID;
@Repository
public interface CertificateRepository extends JpaRepository<Certificate, UUID> {
/**
* Query that retrieves a certificate using the provided uuid.
*
* @param uuid uuid
* @return a certificate
*/
@Query(value = "SELECT * FROM Certificate where id = ?1", nativeQuery = true)
Certificate getCertificate(UUID uuid);
/**
* Query that retrieves a list of certificates using the provided subject and dtype.
*
* @param subject subject
* @param dType d type
* @return a list of certificates
*/
@Query(value = "SELECT * FROM Certificate where subject = ?1 AND DTYPE = ?2", nativeQuery = true)
List<Certificate> findBySubject(String subject, String dType);
/**
* Query that retrieves a sorted list of certificates using the provided subject and dtype.
*
* @param subjectSorted
* @param dType
* @return a list of sorted certificates
*/
@Query(value = "SELECT * FROM Certificate where subjectSorted = ?1 AND DTYPE = ?2", nativeQuery = true)
List<Certificate> findBySubjectSorted(String subjectSorted, String dType);
/**
* Query that retrieves a
*
* @param dType
* @return
*/
@Query(value = "SELECT * FROM Certificate where DTYPE = ?1", nativeQuery = true)
List<Certificate> findByType(String dType);
/**
* Query that retrieves a
*
* @param serialNumber
* @param dType
* @return
*/
@Query(value = "SELECT * FROM Certificate where serialNumber = ?1 AND DTYPE = ?2", nativeQuery = true)
Certificate findBySerialNumber(BigInteger serialNumber, String dType);
/**
* Query that retrieves a
*
* @param boardSerialNumber
* @return
*/
@Query(value = "SELECT * FROM Certificate where platformSerial = ?1 AND DTYPE = 'PlatformCredential'", nativeQuery = true)
List<PlatformCredential> byBoardSerialNumber(String boardSerialNumber);
/**
* Query that retrieves a
*
* @param holderSerialNumber
* @return
*/
@Query(value = "SELECT * FROM Certificate where holderSerialNumber = ?1 AND DTYPE = 'PlatformCredential'", nativeQuery = true)
PlatformCredential getPcByHolderSerialNumber(BigInteger holderSerialNumber);
/**
* Query that retrieves a
*
* @param holderSerialNumber
* @return
*/
@Query(value = "SELECT * FROM Certificate where holderSerialNumber = ?1 AND DTYPE = 'PlatformCredential'", nativeQuery = true)
List<PlatformCredential> getByHolderSerialNumber(BigInteger holderSerialNumber);
/**
* Query that retrieves a
*
* @param certificateHash
* @param dType
* @return
*/
@Query(value = "SELECT * FROM Certificate where certificateHash = ?1 AND DTYPE = ?2", nativeQuery = true)
Certificate findByCertificateHash(int certificateHash, String dType);
/**
* Query that retrieves a
*
* @param publicKeyModulusHexValue
* @return
*/
EndorsementCredential findByPublicKeyModulusHexValue(String publicKeyModulusHexValue);
/**
* Query that retrieves a
*
* @param deviceId
* @return
*/
IssuedAttestationCertificate findByDeviceId(UUID deviceId);
/**
* Query that retrieves a
*
* @param deviceId
* @param isLDevID
* @param sort
* @return
*/
List<IssuedAttestationCertificate> findByDeviceIdAndIsLDevID(UUID deviceId, boolean isLDevID, Sort sort);
/**
* Query that retrieves a
*
* @param certificateHash
* @return
*/
Certificate findByCertificateHash(int certificateHash);
}

View File

@ -8,5 +8,11 @@ import java.util.UUID;
@Repository
public interface DeviceRepository extends JpaRepository<Device, UUID> {
/**
* Query that retrieves a device using the provided device name.
*
* @param deviceName device name
* @return a device
*/
Device findByName(String deviceName);
}

View File

@ -13,9 +13,44 @@ import java.util.UUID;
@Repository
public interface EndorsementCredentialRepository extends JpaRepository<EndorsementCredential, UUID> {
/**
* Query that retrieves a
*
* @param archiveFlag
* @return
*/
List<EndorsementCredential> findByArchiveFlag(boolean archiveFlag);
/**
* Query that retrieves a
*
* @param archiveFlag
* @param pageable
* @return
*/
Page<EndorsementCredential> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
* Query that retrieves a
*
* @param holderSerialNumber
* @return
*/
EndorsementCredential findByHolderSerialNumber(BigInteger holderSerialNumber);
/**
* Query that retrieves a
*
* @param serialNumber
* @return
*/
EndorsementCredential findBySerialNumber(BigInteger serialNumber);
/**
* Query that retrieves a
*
* @param deviceId
* @return
*/
List<EndorsementCredential> findByDeviceId(UUID deviceId);
}

View File

@ -12,8 +12,21 @@ import java.util.UUID;
@Repository
public interface IDevIDCertificateRepository extends JpaRepository<IDevIDCertificate, UUID> {
/**
* Query that retrieves a
*
* @param archiveFlag
* @return
*/
List<IDevIDCertificate> findByArchiveFlag(boolean archiveFlag);
/**
* Query that retrieves a
*
* @param archiveFlag
* @param pageable
* @return
*/
Page<IDevIDCertificate> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/*List<IDevIDCertificate> findBySubject(String subject);
List<IDevIDCertificate> findBySubjectSorted(String subject);

View File

@ -12,7 +12,26 @@ import java.util.UUID;
@Repository
public interface IssuedCertificateRepository extends JpaRepository<IssuedAttestationCertificate, UUID> {
/**
* Query that retrieves a
*
* @param archiveFlag
* @return
*/
List<IssuedAttestationCertificate> findByArchiveFlag(boolean archiveFlag);
/**
* Query that retrieves a
*
* @param archiveFlag
* @param pageable
* @return
*/
Page<IssuedAttestationCertificate> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
* @param deviceId
* @return
*/
List<IssuedAttestationCertificate> findByDeviceId(UUID deviceId);
}

View File

@ -12,7 +12,28 @@ import java.util.UUID;
@Repository
public interface PlatformCertificateRepository extends JpaRepository<PlatformCredential, UUID> {
/**
* Query that retrieves a
*
* @param archiveFlag
* @return
*/
List<PlatformCredential> findByArchiveFlag(boolean archiveFlag);
/**
* Query that retrieves a
*
* @param archiveFlag
* @param pageable
* @return
*/
Page<PlatformCredential> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
* Query that retrieves a
*
* @param deviceId
* @return
*/
List<PlatformCredential> findByDeviceId(UUID deviceId);
}

View File

@ -8,5 +8,12 @@ import java.util.UUID;
@Repository
public interface PolicyRepository extends JpaRepository<PolicySettings, UUID> {
/**
* Query that retrieves policy settings using the provided name.
*
* @param name name
* @return policy settings
*/
PolicySettings findByName(String name);
}

View File

@ -10,10 +10,52 @@ import java.util.UUID;
@Repository
public interface ReferenceDigestValueRepository extends JpaRepository<ReferenceDigestValue, UUID> {
/**
* Query that retrieves a
*
* @param model
* @return
*/
List<ReferenceDigestValue> findByModel(String model);
/**
* Query that retrieves a
*
* @param manufacturer
* @return
*/
List<ReferenceDigestValue> findByManufacturer(String manufacturer);
/**
* Query that retrieves a
*
* @param associatedRimId
* @return
*/
List<ReferenceDigestValue> findValuesByBaseRimId(UUID associatedRimId);
/**
* Query that retrieves a
*
* @param supportRimId
* @return
*/
List<ReferenceDigestValue> findBySupportRimId(UUID supportRimId);
/**
* Query that retrieves a
*
* @param supportRimHash
* @return
*/
List<ReferenceDigestValue> findBySupportRimHash(String supportRimHash);
/**
* Query that retrieves a
*
* @param manufacturer
* @param model
* @return
*/
List<ReferenceDigestValue> findByManufacturerAndModel(String manufacturer, String model);
}

View File

@ -15,36 +15,160 @@ import java.util.UUID;
@Repository
public interface ReferenceManifestRepository extends JpaRepository<ReferenceManifest, UUID> {
/**
* Query that retrieves a
*
* @param hexDecHash
* @return
*/
ReferenceManifest findByHexDecHash(String hexDecHash);
/**
* Query that retrieves a
*
* @param base64Hash
* @return
*/
ReferenceManifest findByBase64Hash(String base64Hash);
/**
* @param hexDecHash
* @param rimType
* @return
*/
ReferenceManifest findByHexDecHashAndRimType(String hexDecHash, String rimType);
/**
* @param hexDecHash
* @param rimType
* @return
*/
ReferenceManifest findByEventLogHashAndRimType(String hexDecHash, String rimType);
/**
* @param manufacturer
* @param model
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformManufacturer = ?1 AND platformModel = ?2 AND rimType = 'Base'", nativeQuery = true)
List<BaseReferenceManifest> getBaseByManufacturerModel(String manufacturer, String model);
/**
* @param manufacturer
* @param dType
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformManufacturer = ?1 AND DTYPE = ?2", nativeQuery = true)
List<BaseReferenceManifest> getByManufacturer(String manufacturer, String dType);
/**
* @param model
* @param dType
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformModel = ?1 AND DTYPE = ?2", nativeQuery = true)
ReferenceManifest getByModel(String model, String dType);
/**
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE DTYPE = 'BaseReferenceManifest'", nativeQuery = true)
List<BaseReferenceManifest> findAllBaseRims();
/**
* Query that retrieves a
*
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE DTYPE = 'SupportReferenceManifest'", nativeQuery = true)
List<SupportReferenceManifest> findAllSupportRims();
/**
* Query that retrieves a
*
* @param uuid
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE id = ?1 AND DTYPE = 'BaseReferenceManifest'", nativeQuery = true)
BaseReferenceManifest getBaseRimEntityById(UUID uuid);
/**
* Query that retrieves a
*
* @param uuid
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE id = ?1 AND DTYPE = 'SupportReferenceManifest'", nativeQuery = true)
SupportReferenceManifest getSupportRimEntityById(UUID uuid);
/**
* Query that retrieves a
*
* @param uuid
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE id = ?1 AND DTYPE = 'EventLogMeasurements'", nativeQuery = true)
EventLogMeasurements getEventLogRimEntityById(UUID uuid);
/**
* Query that retrieves a
*
* @param deviceName
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE deviceName = ?1 AND DTYPE = 'SupportReferenceManifest'", nativeQuery = true)
List<SupportReferenceManifest> byDeviceName(String deviceName);
/**
* Query that retrieves a
*
* @param deviceName
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE deviceName = ?1 AND DTYPE = 'EventLogMeasurements'", nativeQuery = true)
EventLogMeasurements byMeasurementDeviceName(String deviceName);
/**
* Query that retrieves a
*
* @param manufacturer
* @param model
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformManufacturer = ?1 AND platformModel = ?2 AND rimType = 'Support'", nativeQuery = true)
List<SupportReferenceManifest> getSupportByManufacturerModel(String manufacturer, String model);
/**
* Query that retrieves a
*
* @param model
* @return
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformModel = ?1 AND DTYPE = 'EventLogMeasurements'", nativeQuery = true)
EventLogMeasurements getLogByModel(String model);
/**
* Query that retrieves a
*
* @param deviceName
* @return
*/
List<ReferenceManifest> findByDeviceName(String deviceName);
/**
* Query that retrieves a
*
* @param archiveFlag
* @return
*/
List<ReferenceManifest> findByArchiveFlag(boolean archiveFlag);
/**
* Query that retrieves a
*
* @param archiveFlag
* @param pageable
* @return
*/
Page<ReferenceManifest> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
}

View File

@ -9,6 +9,19 @@ import java.util.UUID;
@Repository
public interface SupplyChainValidationRepository extends JpaRepository<SupplyChainValidation, UUID> {
/**
* Query that retrieves a list of supply chain validation using the provided validate type.
*
* @param validateType validate type
* @return a list of supply chain validation
*/
List<SupplyChainValidation> findByValidationType(String validateType);
/**
* Query that retrieves a list of supply chain validation using the provided validation result.
*
* @param validationResult validation result
* @return a list of supply chain validation
*/
List<SupplyChainValidation> findByValidationResult(String validationResult);
}

View File

@ -7,12 +7,27 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.UUID;
import java.util.List;
import java.util.UUID;
@Repository
public interface SupplyChainValidationSummaryRepository extends JpaRepository<SupplyChainValidationSummary, UUID> {
public interface SupplyChainValidationSummaryRepository
extends JpaRepository<SupplyChainValidationSummary, UUID> {
/**
* @param device
* @return
*/
SupplyChainValidationSummary findByDevice(Device device);
/**
* @return
*/
List<SupplyChainValidationSummary> findByArchiveFlagFalse();
/**
* @param pageable
* @return
*/
Page<SupplyChainValidationSummary> findByArchiveFlagFalse(Pageable pageable);
}

View File

@ -7,5 +7,11 @@ import org.springframework.stereotype.Repository;
@Repository
public interface TPM2ProvisionerStateRepository extends JpaRepository<TPM2ProvisionerState, Long> {
/**
* Query that retrieves the TPM2 Provisioner State using the provided first part of nonce.
*
* @param findByFirstPartOfNonce
* @return TPM2 Provisioner State
*/
TPM2ProvisionerState findByFirstPartOfNonce(Long findByFirstPartOfNonce);
}

View File

@ -0,0 +1 @@
package hirs.attestationca.persist.entity.manager;

View File

@ -0,0 +1 @@
package hirs.attestationca.persist.entity.tpm;

View File

@ -0,0 +1 @@
package hirs.attestationca.persist;

View File

@ -109,7 +109,10 @@
<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/checks/naming/index.html -->
<module name="ConstantName"/>
<module name="ConstantName">
<property name="format"
value="[A-Z_][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
@ -131,7 +134,6 @@
<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/checks/sizes/index.html -->
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/checks/whitespace/index.html -->
@ -163,10 +165,17 @@
<!-- See https://checkstyle.org/checks/coding/index.html -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MagicNumber">
<property name="ignoreAnnotation" value="true"/>
<property name="ignoreFieldDeclaration" value="true"/>
<property name="constantWaiverParentToken" value="ASSIGN,ARRAY_INIT,EXPR,
UNARY_PLUS, UNARY_MINUS, TYPECAST, ELIST, LITERAL_NEW"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>