Merge pull request #688 from nsacyber/v3_issue-684

[#684] Green Check mark fix
This commit is contained in:
Cyrus 2024-02-01 10:20:31 -05:00 committed by GitHub
commit 566248b244
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -16,6 +16,8 @@ public interface CACredentialRepository extends JpaRepository<CertificateAuthori
Page<CertificateAuthorityCredential> findByArchiveFlag(boolean archiveFlag, Pageable pageable); Page<CertificateAuthorityCredential> findByArchiveFlag(boolean archiveFlag, Pageable pageable);
List<CertificateAuthorityCredential> findBySubject(String subject); List<CertificateAuthorityCredential> findBySubject(String subject);
List<CertificateAuthorityCredential> findBySubjectSorted(String subject); List<CertificateAuthorityCredential> findBySubjectSorted(String subject);
List<CertificateAuthorityCredential> findBySubjectAndArchiveFlag(String subject, boolean archiveFlag);
List<CertificateAuthorityCredential> findBySubjectSortedAndArchiveFlag(String subject, boolean archiveFlag);
CertificateAuthorityCredential findBySubjectKeyIdentifier(byte[] subjectKeyIdentifier); CertificateAuthorityCredential findBySubjectKeyIdentifier(byte[] subjectKeyIdentifier);
CertificateAuthorityCredential findBySubjectKeyIdString(String subjectKeyIdString); CertificateAuthorityCredential findBySubjectKeyIdStringAndArchiveFlag(String subjectKeyIdString, boolean archiveFlag);
} }

View File

@ -157,7 +157,7 @@ public final class CertificateStringMapBuilder {
//Check if there is a subject organization //Check if there is a subject organization
if (certificate.getAuthorityKeyIdentifier() != null if (certificate.getAuthorityKeyIdentifier() != null
&& !certificate.getAuthorityKeyIdentifier().isEmpty()) { && !certificate.getAuthorityKeyIdentifier().isEmpty()) {
skiCA = caCredentialRepository.findBySubjectKeyIdString(certificate.getAuthorityKeyIdentifier()); skiCA = caCredentialRepository.findBySubjectKeyIdStringAndArchiveFlag(certificate.getAuthorityKeyIdentifier(), false);
} else { } else {
log.error(String.format("Certificate (%s) for %s has no authority key identifier.", log.error(String.format("Certificate (%s) for %s has no authority key identifier.",
certificate.getClass().toString(), certificate.getSubject())); certificate.getClass().toString(), certificate.getSubject()));
@ -167,10 +167,10 @@ public final class CertificateStringMapBuilder {
if (certificate.getIssuerSorted() == null if (certificate.getIssuerSorted() == null
|| certificate.getIssuerSorted().isEmpty()) { || certificate.getIssuerSorted().isEmpty()) {
//Get certificates by subject //Get certificates by subject
issuerCertificates = caCredentialRepository.findBySubject(certificate.getIssuer()); issuerCertificates = caCredentialRepository.findBySubjectAndArchiveFlag(certificate.getIssuer(), false);
} else { } else {
//Get certificates by subject organization //Get certificates by subject organization
issuerCertificates = caCredentialRepository.findBySubjectSorted(certificate.getIssuerSorted()); issuerCertificates = caCredentialRepository.findBySubjectSortedAndArchiveFlag(certificate.getIssuerSorted(), false);
} }
} else { } else {
issuerCertificates.add(skiCA); issuerCertificates.add(skiCA);