From 6931d379b542591b40f05d83ca18ca246f8bcff4 Mon Sep 17 00:00:00 2001 From: Cyrus <24922493+cyrus-dev@users.noreply.github.com> Date: Tue, 23 May 2023 13:36:29 -0400 Subject: [PATCH] Checking in updated code. This set does build and load in a rocky container. [no ci] --- HIRS_AttestationCA/build.gradle | 1 + .../persist/PCRQuoteValidator.java | 6 +- .../entity/manager/CertificateRepository.java | 2 +- .../entity/manager/DeviceRepository.java | 3 +- .../ReferenceDigestValueRepository.java | 13 + .../manager/ReferenceManifestRepository.java | 10 + .../entity/manager/SettingsRepository.java | 12 - .../SupplyChainValidationRepository.java | 2 + .../entity/userdefined/Certificate.java | 3 + .../entity/userdefined/ReferenceManifest.java | 3 + .../userdefined/SupplyChainSettings.java | 123 - .../CertificateAuthorityCredential.java | 12 +- .../certificate/PlatformCredential.java | 16 +- .../rim/BaseReferenceManifest.java | 5 +- .../userdefined/rim/EventLogMeasurements.java | 6 +- .../rim/SupportReferenceManifest.java | 6 +- .../persist/service/CertificateService.java | 23 - .../service/CertificateServiceImpl.java | 68 +- .../persist/service/DefaultDbService.java | 56 +- .../persist/service/DefaultService.java | 4 - .../persist/service/DeviceServiceImpl.java | 4 +- .../persist/service/HibernateDbService.java | 132 - .../persist/service/PolicyServiceImpl.java | 25 + .../service/ReferenceDigestValueService.java | 20 - .../ReferenceDigestValueServiceImpl.java | 49 +- .../service/ReferenceManifestService.java | 23 - .../service/ReferenceManifestServiceImpl.java | 42 +- .../persist/service/SettingsServiceImpl.java | 41 - .../service/SupplyChainValidationService.java | 16 - .../SupplyChainValidationServiceImpl.java | 30 +- .../service/selector/CertificateSelector.java | 21 +- .../selector/ReferenceManifestSelector.java | 19 +- HIRS_AttestationCAPortal/build.gradle | 13 +- .../attestationca/portal/HIRSApplication.java | 19 +- .../portal/HIRSDbInitializer.java | 53 +- .../portal/PageConfiguration.java | 60 + .../portal/PersistenceJPAConfig.java | 41 +- .../portal/datatables/DataTableView.java | 45 + .../portal/page/PageController.java | 2 +- .../portal/page/PolicyPageModel.java | 4 +- .../CertificateDetailsPageController.java | 18 +- .../CertificatePageController.java | 58 +- .../controllers/DevicePageController.java | 6 +- .../controllers/PolicyPageController.java | 74 +- ...eferenceManifestDetailsPageController.java | 71 +- .../ReferenceManifestPageController.java | 410 +- ...estfulAttestationCertificateAuthority.java | 35 + .../RimDatabasePageController.java | 30 +- .../utils/CertificateStringMapBuilder.java | 20 +- .../src/main/resources/application.properties | 18 +- .../src/main/webapp/WEB-INF/tags/page.tag | 4 +- .../src/main/webapp/WEB-INF/web.xml | 15 +- .../lib/jquery.dataTables-1.10.13/Readme.md | 59 + .../extensions/AutoFill/License.txt | 22 + .../extensions/AutoFill/Readme.md | 39 + .../AutoFill/css/autoFill.bootstrap.css | 81 + .../AutoFill/css/autoFill.bootstrap.min.css | 1 + .../AutoFill/css/autoFill.bootstrap4.css | 81 + .../AutoFill/css/autoFill.bootstrap4.min.css | 1 + .../AutoFill/css/autoFill.dataTables.css | 92 + .../AutoFill/css/autoFill.dataTables.min.css | 1 + .../AutoFill/css/autoFill.foundation.css | 85 + .../AutoFill/css/autoFill.foundation.min.css | 1 + .../AutoFill/css/autoFill.jqueryui.css | 85 + .../AutoFill/css/autoFill.jqueryui.min.css | 1 + .../AutoFill/css/autoFill.semanticui.css | 81 + .../AutoFill/css/autoFill.semanticui.min.css | 1 + .../AutoFill/js/autoFill.bootstrap.js | 43 + .../AutoFill/js/autoFill.bootstrap.min.js | 5 + .../AutoFill/js/autoFill.bootstrap4.js | 43 + .../AutoFill/js/autoFill.bootstrap4.min.js | 5 + .../AutoFill/js/autoFill.foundation.js | 43 + .../AutoFill/js/autoFill.foundation.min.js | 5 + .../AutoFill/js/autoFill.jqueryui.js | 43 + .../AutoFill/js/autoFill.jqueryui.min.js | 6 + .../AutoFill/js/autoFill.semanticui.js | 43 + .../AutoFill/js/autoFill.semanticui.min.js | 5 + .../AutoFill/js/dataTables.autoFill.js | 1068 ++ .../AutoFill/js/dataTables.autoFill.min.js | 23 + .../extensions/Buttons/License.txt | 22 + .../extensions/Buttons/Readme.md | 39 + .../Buttons/css/buttons.bootstrap.css | 102 + .../Buttons/css/buttons.bootstrap.min.css | 1 + .../Buttons/css/buttons.bootstrap4.css | 163 + .../Buttons/css/buttons.bootstrap4.min.css | 1 + .../Buttons/css/buttons.dataTables.css | 298 + .../Buttons/css/buttons.dataTables.min.css | 1 + .../Buttons/css/buttons.foundation.css | 129 + .../Buttons/css/buttons.foundation.min.css | 1 + .../Buttons/css/buttons.jqueryui.css | 162 + .../Buttons/css/buttons.jqueryui.min.css | 1 + .../Buttons/css/buttons.semanticui.css | 114 + .../Buttons/css/buttons.semanticui.min.css | 1 + .../extensions/Buttons/css/common.scss | 27 + .../extensions/Buttons/css/mixins.scss | 89 + .../Buttons/js/buttons.bootstrap.js | 68 + .../Buttons/js/buttons.bootstrap.min.js | 6 + .../Buttons/js/buttons.bootstrap4.js | 60 + .../Buttons/js/buttons.bootstrap4.min.js | 6 + .../extensions/Buttons/js/buttons.colVis.js | 198 + .../Buttons/js/buttons.colVis.min.js | 5 + .../extensions/Buttons/js/buttons.flash.js | 1415 ++ .../Buttons/js/buttons.flash.min.js | 30 + .../Buttons/js/buttons.foundation.js | 85 + .../Buttons/js/buttons.foundation.min.js | 6 + .../extensions/Buttons/js/buttons.html5.js | 1340 ++ .../Buttons/js/buttons.html5.min.js | 25 + .../extensions/Buttons/js/buttons.jqueryui.js | 62 + .../Buttons/js/buttons.jqueryui.min.js | 6 + .../extensions/Buttons/js/buttons.print.js | 178 + .../Buttons/js/buttons.print.min.js | 4 + .../Buttons/js/buttons.semanticui.js | 57 + .../Buttons/js/buttons.semanticui.min.js | 6 + .../Buttons/js/dataTables.buttons.js | 1664 ++ .../Buttons/js/dataTables.buttons.min.js | 35 + .../extensions/Buttons/swf/flashExport.swf | Bin 0 -> 64573 bytes .../extensions/ColReorder/License.txt | 22 + .../extensions/ColReorder/Readme.md | 35 + .../ColReorder/css/colReorder.bootstrap.css | 11 + .../css/colReorder.bootstrap.min.css | 1 + .../ColReorder/css/colReorder.bootstrap4.css | 11 + .../css/colReorder.bootstrap4.min.css | 1 + .../ColReorder/css/colReorder.dataTables.css | 11 + .../css/colReorder.dataTables.min.css | 1 + .../ColReorder/css/colReorder.foundation.css | 11 + .../css/colReorder.foundation.min.css | 1 + .../ColReorder/css/colReorder.jqueryui.css | 11 + .../css/colReorder.jqueryui.min.css | 1 + .../ColReorder/css/colReorder.semanticui.css | 11 + .../css/colReorder.semanticui.min.css | 1 + .../ColReorder/js/dataTables.colReorder.js | 1335 ++ .../js/dataTables.colReorder.min.js | 27 + .../extensions/FixedColumns/License.txt | 22 + .../extensions/FixedColumns/Readme.md | 44 + .../css/fixedColumns.bootstrap.css | 44 + .../css/fixedColumns.bootstrap.min.css | 1 + .../css/fixedColumns.bootstrap4.css | 44 + .../css/fixedColumns.bootstrap4.min.css | 1 + .../css/fixedColumns.dataTables.css | 18 + .../css/fixedColumns.dataTables.min.css | 1 + .../css/fixedColumns.foundation.css | 27 + .../css/fixedColumns.foundation.min.css | 1 + .../css/fixedColumns.jqueryui.css | 8 + .../css/fixedColumns.jqueryui.min.css | 1 + .../css/fixedColumns.semanticui.css | 16 + .../css/fixedColumns.semanticui.min.css | 1 + .../js/dataTables.fixedColumns.js | 1623 ++ .../js/dataTables.fixedColumns.min.js | 35 + .../extensions/FixedHeader/License.txt | 22 + .../extensions/FixedHeader/Readme.md | 41 + .../FixedHeader/css/fixedHeader.bootstrap.css | 20 + .../css/fixedHeader.bootstrap.min.css | 1 + .../css/fixedHeader.bootstrap4.css | 20 + .../css/fixedHeader.bootstrap4.min.css | 1 + .../css/fixedHeader.dataTables.css | 19 + .../css/fixedHeader.dataTables.min.css | 1 + .../css/fixedHeader.foundation.css | 20 + .../css/fixedHeader.foundation.min.css | 1 + .../FixedHeader/css/fixedHeader.jqueryui.css | 15 + .../css/fixedHeader.jqueryui.min.css | 1 + .../css/fixedHeader.semanticui.css | 14 + .../css/fixedHeader.semanticui.min.css | 1 + .../FixedHeader/js/dataTables.fixedHeader.js | 672 + .../js/dataTables.fixedHeader.min.js | 17 + .../extensions/KeyTable/License.txt | 22 + .../extensions/KeyTable/Readme.md | 39 + .../KeyTable/css/keyTable.bootstrap.css | 5 + .../KeyTable/css/keyTable.bootstrap.min.css | 1 + .../KeyTable/css/keyTable.bootstrap4.css | 5 + .../KeyTable/css/keyTable.bootstrap4.min.css | 1 + .../KeyTable/css/keyTable.dataTables.css | 5 + .../KeyTable/css/keyTable.dataTables.min.css | 1 + .../KeyTable/css/keyTable.foundation.css | 5 + .../KeyTable/css/keyTable.foundation.min.css | 1 + .../KeyTable/css/keyTable.jqueryui.css | 5 + .../KeyTable/css/keyTable.jqueryui.min.css | 1 + .../KeyTable/css/keyTable.semanticui.css | 5 + .../KeyTable/css/keyTable.semanticui.min.css | 1 + .../KeyTable/js/dataTables.keyTable.js | 952 + .../KeyTable/js/dataTables.keyTable.min.js | 19 + .../extensions/Responsive/License.txt | 22 + .../extensions/Responsive/Readme.md | 41 + .../Responsive/css/responsive.bootstrap.css | 181 + .../css/responsive.bootstrap.min.css | 1 + .../Responsive/css/responsive.bootstrap4.css | 181 + .../css/responsive.bootstrap4.min.css | 1 + .../Responsive/css/responsive.dataTables.css | 178 + .../css/responsive.dataTables.min.css | 1 + .../Responsive/css/responsive.foundation.css | 181 + .../css/responsive.foundation.min.css | 1 + .../Responsive/css/responsive.jqueryui.css | 178 + .../css/responsive.jqueryui.min.css | 1 + .../Responsive/css/responsive.semanticui.css | 181 + .../css/responsive.semanticui.min.css | 1 + .../Responsive/js/dataTables.responsive.js | 1255 ++ .../js/dataTables.responsive.min.js | 26 + .../Responsive/js/responsive.bootstrap.js | 85 + .../Responsive/js/responsive.bootstrap.min.js | 6 + .../Responsive/js/responsive.bootstrap4.js | 85 + .../js/responsive.bootstrap4.min.js | 6 + .../Responsive/js/responsive.foundation.js | 62 + .../js/responsive.foundation.min.js | 6 + .../Responsive/js/responsive.jqueryui.js | 63 + .../Responsive/js/responsive.jqueryui.min.js | 6 + .../Responsive/js/responsive.semanticui.js | 77 + .../js/responsive.semanticui.min.js | 6 + .../extensions/RowReorder/License.txt | 22 + .../extensions/RowReorder/Readme.md | 41 + .../RowReorder/css/rowReorder.bootstrap.css | 22 + .../css/rowReorder.bootstrap.min.css | 1 + .../RowReorder/css/rowReorder.bootstrap4.css | 22 + .../css/rowReorder.bootstrap4.min.css | 1 + .../RowReorder/css/rowReorder.dataTables.css | 22 + .../css/rowReorder.dataTables.min.css | 1 + .../RowReorder/css/rowReorder.foundation.css | 22 + .../css/rowReorder.foundation.min.css | 1 + .../RowReorder/css/rowReorder.jqueryui.css | 22 + .../css/rowReorder.jqueryui.min.css | 1 + .../RowReorder/css/rowReorder.semanticui.css | 22 + .../css/rowReorder.semanticui.min.css | 1 + .../extensions/RowReorder/css/semanticui.scss | 5 + .../RowReorder/js/dataTables.rowReorder.js | 767 + .../js/dataTables.rowReorder.min.js | 17 + .../extensions/Scroller/License.txt | 22 + .../extensions/Scroller/Readme.md | 49 + .../Scroller/css/scroller.bootstrap.css | 24 + .../Scroller/css/scroller.bootstrap.min.css | 1 + .../Scroller/css/scroller.bootstrap4.css | 24 + .../Scroller/css/scroller.bootstrap4.min.css | 1 + .../Scroller/css/scroller.dataTables.css | 20 + .../Scroller/css/scroller.dataTables.min.css | 1 + .../Scroller/css/scroller.foundation.css | 17 + .../Scroller/css/scroller.foundation.min.css | 1 + .../Scroller/css/scroller.jqueryui.css | 20 + .../Scroller/css/scroller.jqueryui.min.css | 1 + .../Scroller/css/scroller.semanticui.css | 20 + .../Scroller/css/scroller.semanticui.min.css | 1 + .../Scroller/js/dataTables.scroller.js | 1349 ++ .../Scroller/js/dataTables.scroller.min.js | 27 + .../extensions/Select/License.txt | 22 + .../extensions/Select/Readme.md | 41 + .../Select/css/select.bootstrap.css | 115 + .../Select/css/select.bootstrap.min.css | 1 + .../Select/css/select.bootstrap4.css | 115 + .../Select/css/select.bootstrap4.min.css | 1 + .../Select/css/select.dataTables.css | 105 + .../Select/css/select.dataTables.min.css | 1 + .../Select/css/select.foundation.css | 117 + .../Select/css/select.foundation.min.css | 1 + .../extensions/Select/css/select.jqueryui.css | 105 + .../Select/css/select.jqueryui.min.css | 1 + .../Select/css/select.semanticui.css | 110 + .../Select/css/select.semanticui.min.css | 1 + .../extensions/Select/js/dataTables.select.js | 1134 ++ .../Select/js/dataTables.select.min.js | 26 + .../lib/jquery.dataTables-1.10.13/license.txt | 20 + .../media/css/dataTables.bootstrap.css | 184 + .../media/css/dataTables.bootstrap.min.css | 1 + .../media/css/dataTables.bootstrap4.css | 193 + .../media/css/dataTables.bootstrap4.min.css | 1 + .../media/css/dataTables.foundation.css | 116 + .../media/css/dataTables.foundation.min.css | 1 + .../media/css/dataTables.jqueryui.css | 481 + .../media/css/dataTables.jqueryui.min.css | 1 + .../media/css/dataTables.material.css | 87 + .../media/css/dataTables.material.min.css | 1 + .../media/css/dataTables.semanticui.css | 102 + .../media/css/dataTables.semanticui.min.css | 1 + .../media/css/dataTables.uikit.css | 146 + .../media/css/dataTables.uikit.min.css | 1 + .../media/css/jquery.dataTables.css | 452 + .../media/css/jquery.dataTables.min.css | 1 + .../css/jquery.dataTables_themeroller.css | 416 + .../media/images/Sorting icons.psd | Bin 0 -> 27490 bytes .../media/images/favicon.ico | Bin 0 -> 894 bytes .../media/images/sort_asc.png | Bin 0 -> 160 bytes .../media/images/sort_asc_disabled.png | Bin 0 -> 148 bytes .../media/images/sort_both.png | Bin 0 -> 201 bytes .../media/images/sort_desc.png | Bin 0 -> 158 bytes .../media/images/sort_desc_disabled.png | Bin 0 -> 146 bytes .../media/js/dataTables.bootstrap.js | 182 + .../media/js/dataTables.bootstrap.min.js | 8 + .../media/js/dataTables.bootstrap4.js | 184 + .../media/js/dataTables.bootstrap4.min.js | 8 + .../media/js/dataTables.foundation.js | 174 + .../media/js/dataTables.foundation.min.js | 8 + .../media/js/dataTables.jqueryui.js | 164 + .../media/js/dataTables.jqueryui.min.js | 9 + .../media/js/dataTables.material.js | 191 + .../media/js/dataTables.material.min.js | 8 + .../media/js/dataTables.semanticui.js | 208 + .../media/js/dataTables.semanticui.min.js | 9 + .../media/js/dataTables.uikit.js | 176 + .../media/js/dataTables.uikit.min.js | 8 + .../media/js/jquery.dataTables.js | 15307 ++++++++++++++++ .../media/js/jquery.dataTables.min.js | 167 + .../media/js/jquery.js | 5 + build.gradle | 68 + settings.gradle | 9 + 299 files changed, 41061 insertions(+), 807 deletions(-) delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SettingsRepository.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainSettings.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateService.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultService.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HibernateDbService.java create mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PolicyServiceImpl.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueService.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestService.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SettingsServiceImpl.java delete mode 100644 HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java create mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PageConfiguration.java create mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/datatables/DataTableView.java create mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RestfulAttestationCertificateAuthority.java create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/css/autoFill.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.bootstrap.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.bootstrap.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.bootstrap4.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.bootstrap4.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.foundation.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.foundation.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.jqueryui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.jqueryui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.semanticui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/autoFill.semanticui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/dataTables.autoFill.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/AutoFill/js/dataTables.autoFill.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/buttons.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/common.scss create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/css/mixins.scss create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.bootstrap.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.bootstrap.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.bootstrap4.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.bootstrap4.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.colVis.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.colVis.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.flash.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.flash.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.foundation.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.foundation.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.html5.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.html5.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.jqueryui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.jqueryui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.print.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.print.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.semanticui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/buttons.semanticui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/dataTables.buttons.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/js/dataTables.buttons.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Buttons/swf/flashExport.swf create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/css/colReorder.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/js/dataTables.colReorder.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/ColReorder/js/dataTables.colReorder.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/css/fixedColumns.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/js/dataTables.fixedColumns.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedColumns/js/dataTables.fixedColumns.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/css/fixedHeader.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/js/dataTables.fixedHeader.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/FixedHeader/js/dataTables.fixedHeader.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/css/keyTable.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/js/dataTables.keyTable.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/KeyTable/js/dataTables.keyTable.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/css/responsive.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/dataTables.responsive.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/dataTables.responsive.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.bootstrap.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.bootstrap.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.bootstrap4.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.bootstrap4.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.foundation.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.foundation.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.jqueryui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.jqueryui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.semanticui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Responsive/js/responsive.semanticui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/rowReorder.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/css/semanticui.scss create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/js/dataTables.rowReorder.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/RowReorder/js/dataTables.rowReorder.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/css/scroller.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/js/dataTables.scroller.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Scroller/js/dataTables.scroller.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/License.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/Readme.md create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/css/select.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/js/dataTables.select.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/extensions/Select/js/dataTables.select.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/license.txt create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.bootstrap.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.bootstrap.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.bootstrap4.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.bootstrap4.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.foundation.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.foundation.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.jqueryui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.jqueryui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.material.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.material.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.semanticui.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.semanticui.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.uikit.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/dataTables.uikit.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/jquery.dataTables.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/jquery.dataTables.min.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/css/jquery.dataTables_themeroller.css create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/Sorting icons.psd create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/favicon.ico create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/sort_asc.png create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/sort_asc_disabled.png create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/sort_both.png create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/sort_desc.png create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/images/sort_desc_disabled.png create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.bootstrap.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.bootstrap.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.bootstrap4.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.bootstrap4.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.foundation.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.foundation.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.jqueryui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.jqueryui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.material.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.material.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.semanticui.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.semanticui.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.uikit.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/dataTables.uikit.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/jquery.dataTables.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/jquery.dataTables.min.js create mode 100644 HIRS_AttestationCAPortal/src/main/webapp/lib/jquery.dataTables-1.10.13/media/js/jquery.js diff --git a/HIRS_AttestationCA/build.gradle b/HIRS_AttestationCA/build.gradle index 1580bfce..c6f20171 100644 --- a/HIRS_AttestationCA/build.gradle +++ b/HIRS_AttestationCA/build.gradle @@ -27,6 +27,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa:3.0.1' implementation 'com.github.darrachequesne:spring-data-jpa-datatables:6.0.1' implementation 'org.springframework.retry:spring-retry:2.0.0' + implementation libs.springdatajpa implementation libs.bouncycastle implementation libs.commons.codec diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/PCRQuoteValidator.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/PCRQuoteValidator.java index 0aa2a4b4..431dacf6 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/PCRQuoteValidator.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/PCRQuoteValidator.java @@ -1,6 +1,6 @@ package hirs.attestationca.persist; -import hirs.attestationca.persist.entity.userdefined.SupplyChainSettings; +import hirs.attestationca.persist.entity.userdefined.PolicySettings; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -46,7 +46,7 @@ public class PCRQuoteValidator { private String[] baselinePCRS = new String[MAX_PCR_ID + 1]; @Getter @Setter - private SupplyChainSettings settings; + private PolicySettings settings; /** * Constructor to parse PCR values. @@ -54,7 +54,7 @@ public class PCRQuoteValidator { * @param settings settings for the supply chain portal settings for provisioning */ public PCRQuoteValidator(final String[] pcrValues, - final SupplyChainSettings settings) { + final PolicySettings settings) { if (pcrValues != null) { baselinePCRS = new String[MAX_PCR_ID + 1]; for (int i = 0; i <= MAX_PCR_ID; i++) { diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CertificateRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CertificateRepository.java index 68c76323..c6ad7d9d 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CertificateRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CertificateRepository.java @@ -7,5 +7,5 @@ import org.springframework.stereotype.Repository; import java.util.UUID; @Repository -public interface CertificateRepository extends JpaRepository { +public interface CertificateRepository extends JpaRepository { } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/DeviceRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/DeviceRepository.java index a22d74ee..3b18d7cc 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/DeviceRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/DeviceRepository.java @@ -4,10 +4,9 @@ import hirs.attestationca.persist.entity.userdefined.Device; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import java.util.List; import java.util.UUID; @Repository public interface DeviceRepository extends JpaRepository { - List findByName(String deviceName); +// List findByName(String deviceName); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceDigestValueRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceDigestValueRepository.java index 7117a66d..666b9338 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceDigestValueRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceDigestValueRepository.java @@ -2,10 +2,23 @@ package hirs.attestationca.persist.entity.manager; import hirs.attestationca.persist.entity.userdefined.rim.ReferenceDigestValue; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.UUID; @Repository public interface ReferenceDigestValueRepository extends JpaRepository { + + @Query(value = "SELECT * FROM ReferenceDigestValue", nativeQuery = true) + List listAll(); + @Query(value = "SELECT * FROM ReferenceDigestValue WHERE u.model = ?1", nativeQuery = true) + List listByModel(String model); + @Query(value = "SELECT * FROM ReferenceDigestValue WHERE u.manufacturer = ?1", nativeQuery = true) + List listByManufacturer(String manufacturer); + @Query(value = "SELECT * FROM ReferenceDigestValue WHERE u.baseRimId = ?1 OR u.supportRimId = ?1", nativeQuery = true) + List getValuesByRimId(UUID associatedRimId); + @Query(value = "SELECT * FROM ReferenceDigestValue WHERE u.supportRimId = ?1", nativeQuery = true) + List getValuesBySupportRimId(UUID supportRimId); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java index f6406cec..fb0a908a 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java @@ -1,11 +1,21 @@ package hirs.attestationca.persist.entity.manager; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; +import hirs.attestationca.persist.entity.userdefined.rim.BaseReferenceManifest; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.UUID; @Repository public interface ReferenceManifestRepository extends JpaRepository { + + @Query(value = "SELECT * FROM ReferenceManifest WHERE u.hexDecHash = ?1", nativeQuery = true) + ReferenceManifest findByHash(String rimHash); + @Query(value = "SELECT * FROM ReferenceManifest WHERE u.hexDecHash = ?1 AND u.rimType = ?2", nativeQuery = true) + ReferenceManifest findByHash(String rimHash, String rimType); + @Query(value = "SELECT * FROM ReferenceManifest WHERE u.platformManufacturer = ?1 AND u.platformModel = ?2 AND u.rimType = 'Base'", nativeQuery = true) + List getBaseByManufacturerModel(String manufacturer, String model); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SettingsRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SettingsRepository.java deleted file mode 100644 index be84710e..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SettingsRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package hirs.attestationca.persist.entity.manager; - -import hirs.attestationca.persist.entity.userdefined.SupplyChainSettings; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import java.util.UUID; - -@Repository -public interface SettingsRepository extends JpaRepository { - SupplyChainSettings findByName(String name); -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationRepository.java index 7111c3a9..537a57de 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationRepository.java @@ -2,8 +2,10 @@ package hirs.attestationca.persist.entity.manager; import hirs.attestationca.persist.entity.userdefined.SupplyChainValidation; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; import java.util.UUID; +@Repository public interface SupplyChainValidationRepository extends JpaRepository { } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/Certificate.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/Certificate.java index bddaa21f..aba3f274 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/Certificate.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/Certificate.java @@ -7,6 +7,8 @@ import hirs.attestationca.persist.entity.userdefined.certificate.CertificateVari import hirs.utils.HexUtils; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; import jakarta.persistence.Transient; import lombok.Getter; import lombok.extern.log4j.Log4j2; @@ -75,6 +77,7 @@ import java.util.Objects; * It stores certain attributes separately from the serialized certificate to enable querying on * those attributes. */ +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Log4j2 @Entity public abstract class Certificate extends ArchivableEntity { diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/ReferenceManifest.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/ReferenceManifest.java index 4b363c59..3be14b56 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/ReferenceManifest.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/ReferenceManifest.java @@ -7,6 +7,8 @@ import jakarta.persistence.Access; import jakarta.persistence.AccessType; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.Inheritance; +import jakarta.persistence.InheritanceType; import jakarta.persistence.Table; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -29,6 +31,7 @@ import java.util.UUID; @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false) @Log4j2 @Entity +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Table(name = "ReferenceManifest") @Access(AccessType.FIELD) public class ReferenceManifest extends ArchivableEntity { diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainSettings.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainSettings.java deleted file mode 100644 index 59423534..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainSettings.java +++ /dev/null @@ -1,123 +0,0 @@ -package hirs.attestationca.persist.entity.userdefined; - -import hirs.attestationca.persist.entity.UserDefinedEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Table; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Class represents Supply Chain policy. Supply Chain Policy identifies the methods in - * SupplyChainValidator that should be used in order to validate a supply chain. - * By default, the policy does not enable any validations. - */ -@Table(name = "SupplyChainSettings") -@Getter -@Setter -@Entity -@ToString(callSuper = true) -public class SupplyChainSettings extends UserDefinedEntity { - /** - * Name of the default Supply Chain Policy. - */ - public static final String DEFAULT_POLICY = "Default Supply Chain Policy"; - /** - * Number of days in 10 years. - */ - public static final String TEN_YEARS = "3651"; - /** - * Number of days in 1 year. - */ - public static final String YEAR = "365"; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean ecValidationEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean pcValidationEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean pcAttributeValidationEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean firmwareValidationEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean utcValidationEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean expiredCertificateValidationEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean replaceEC = false; - - @Column(nullable = false, columnDefinition = "boolean default true") - private boolean issueAttestationCertificate = true; - - @Column(nullable = false, columnDefinition = "boolean default true") - private boolean issueDevIdCertificate = true; - - @Column(nullable = false) - private String validityDays = TEN_YEARS; - - @Column(nullable = false) - private String devIdValidityDays = TEN_YEARS; - - @Column(nullable = false) - private String reissueThreshold = YEAR; - - @Column(nullable = false) - private String devIdReissueThreshold = YEAR; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean generateOnExpiration = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean devIdExpirationFlag = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean ignoreImaEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean ignoretBootEnabled = false; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean linuxOs = false; - - @Column(nullable = false, columnDefinition = "boolean default true") - private boolean ignoreGptEnabled = true; - - @Column(nullable = false, columnDefinition = "boolean default false") - private boolean ignoreOsEvtEnabled = false; - - /** - * Default constructor necessary for Hibernate. - */ - protected SupplyChainSettings() { - super(); - } - - /** - * Constructor used to initialize SupplyChainSettings object. - * - * @param name - * A name used to uniquely identify and reference the Supply Chain policy. - */ - public SupplyChainSettings(final String name) { - super(name); - } - - /** - * Constructor used to initialize SupplyChainSettings object. - * - * @param name - * A name used to uniquely identify and reference the supply chain policy. - * @param description - * Optional description of the policy that can be added by the user - */ - public SupplyChainSettings(final String name, final String description) { - super(name, description); - } -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java index 006d7a47..a0fbe115 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java @@ -1,7 +1,7 @@ package hirs.attestationca.persist.entity.userdefined.certificate; import hirs.attestationca.persist.entity.userdefined.Certificate; -import hirs.attestationca.persist.service.CertificateService; +import hirs.attestationca.persist.service.CertificateServiceImpl; import hirs.attestationca.persist.service.selector.CertificateSelector; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -51,13 +51,13 @@ public class CertificateAuthorityCredential extends Certificate { */ public static class Selector extends CertificateSelector { /** - * Construct a new CertificateSelector that will use the given {@link CertificateService} to + * Construct a new CertificateSelector that will use the given {@link CertificateServiceImpl} to * retrieve one or many CertificateAuthorityCredentials. * - * @param certificateManager the certificate manager to be used to retrieve certificates + * @param certificateService the certificate manager to be used to retrieve certificates */ - public Selector(final CertificateService certificateManager) { - super(certificateManager, CertificateAuthorityCredential.class); + public Selector(final CertificateServiceImpl certificateService) { + super(certificateService, CertificateAuthorityCredential.class); } /** @@ -79,7 +79,7 @@ public class CertificateAuthorityCredential extends Certificate { * @param certMan the CertificateService to be used to retrieve persisted certificates * @return a CertificateAuthorityCredential.Selector instance to use for retrieving certificates */ - public static Selector select(final CertificateService certMan) { + public static Selector select(final CertificateServiceImpl certMan) { return new Selector(certMan); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/PlatformCredential.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/PlatformCredential.java index 30babffc..3cc3edbc 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/PlatformCredential.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/PlatformCredential.java @@ -7,7 +7,7 @@ import hirs.attestationca.persist.entity.userdefined.certificate.attributes.Plat import hirs.attestationca.persist.entity.userdefined.certificate.attributes.TBBSecurityAssertion; import hirs.attestationca.persist.entity.userdefined.certificate.attributes.URIReference; import hirs.attestationca.persist.entity.userdefined.certificate.attributes.V2.PlatformConfigurationV2; -import hirs.attestationca.persist.service.CertificateService; +import hirs.attestationca.persist.service.CertificateServiceImpl; import hirs.attestationca.persist.service.selector.CertificateSelector; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -133,13 +133,13 @@ public class PlatformCredential extends DeviceAssociatedCertificate { */ public static class Selector extends CertificateSelector { /** - * Construct a new CertificateSelector that will use the given {@link CertificateService} to + * Construct a new CertificateSelector that will use the given {@link CertificateServiceImpl} to * retrieve one or many PlatformCredentials. * - * @param certificateManager the certificate manager to be used to retrieve certificates + * @param certificateService the certificate manager to be used to retrieve certificates */ - public Selector(final CertificateService certificateManager) { - super(certificateManager, PlatformCredential.class); + public Selector(final CertificateServiceImpl certificateService) { + super(certificateService, PlatformCredential.class); } /** @@ -275,11 +275,11 @@ public class PlatformCredential extends DeviceAssociatedCertificate { /** * Get a Selector for use in retrieving PlatformCredentials. * - * @param certMan the CertificateManager to be used to retrieve persisted certificates + * @param certificateService the CertificateManager to be used to retrieve persisted certificates * @return a PlatformCredential.Selector instance to use for retrieving certificates */ - public static Selector select(final CertificateService certMan) { - return new Selector(certMan); + public static Selector select(final CertificateServiceImpl certificateService) { + return new Selector(certificateService); } /** diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java index 14f4714c..2adc46c7 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java @@ -2,7 +2,6 @@ package hirs.attestationca.persist.entity.userdefined.rim; import com.fasterxml.jackson.annotation.JsonIgnore; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; -import hirs.attestationca.persist.service.ReferenceManifestService; import hirs.attestationca.persist.service.ReferenceManifestServiceImpl; import hirs.attestationca.persist.service.selector.ReferenceManifestSelector; import hirs.utils.SwidResource; @@ -107,7 +106,7 @@ public class BaseReferenceManifest extends ReferenceManifest { * @param referenceManifestManager the reference manifest manager to be used to retrieve * reference manifests. */ - public Selector(final ReferenceManifestService referenceManifestManager) { + public Selector(final ReferenceManifestServiceImpl referenceManifestManager) { super(referenceManifestManager, BaseReferenceManifest.class); } @@ -350,7 +349,7 @@ public class BaseReferenceManifest extends ReferenceManifest { * persisted RIMs * @return a Selector instance to use for retrieving RIMs */ - public static Selector select(final ReferenceManifestService rimMan) { + public static Selector select(final ReferenceManifestServiceImpl rimMan) { return new Selector(rimMan); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/EventLogMeasurements.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/EventLogMeasurements.java index d62a89e6..b3987b29 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/EventLogMeasurements.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/EventLogMeasurements.java @@ -3,7 +3,7 @@ package hirs.attestationca.persist.entity.userdefined.rim; import com.fasterxml.jackson.annotation.JsonIgnore; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; import hirs.attestationca.persist.enums.AppraisalStatus; -import hirs.attestationca.persist.service.ReferenceManifestService; +import hirs.attestationca.persist.service.ReferenceManifestServiceImpl; import hirs.attestationca.persist.service.selector.ReferenceManifestSelector; import hirs.utils.tpm.eventlog.TCGEventLog; import hirs.utils.tpm.eventlog.TpmPcrEvent; @@ -53,7 +53,7 @@ public class EventLogMeasurements extends ReferenceManifest { * @param referenceManifestManager the reference manifest manager to be used to retrieve * reference manifests. */ - public Selector(final ReferenceManifestService referenceManifestManager) { + public Selector(final ReferenceManifestServiceImpl referenceManifestManager) { super(referenceManifestManager, EventLogMeasurements.class, false); } @@ -142,7 +142,7 @@ public class EventLogMeasurements extends ReferenceManifest { * persisted RIMs * @return a Selector instance to use for retrieving RIMs */ - public static Selector select(final ReferenceManifestService rimMan) { + public static Selector select(final ReferenceManifestServiceImpl rimMan) { return new Selector(rimMan); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/SupportReferenceManifest.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/SupportReferenceManifest.java index a5ada73f..07204929 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/SupportReferenceManifest.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/SupportReferenceManifest.java @@ -2,7 +2,7 @@ package hirs.attestationca.persist.entity.userdefined.rim; import com.fasterxml.jackson.annotation.JsonIgnore; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; -import hirs.attestationca.persist.service.ReferenceManifestService; +import hirs.attestationca.persist.service.ReferenceManifestServiceImpl; import hirs.attestationca.persist.service.selector.ReferenceManifestSelector; import hirs.utils.tpm.eventlog.TCGEventLog; import hirs.utils.tpm.eventlog.TpmPcrEvent; @@ -48,7 +48,7 @@ public class SupportReferenceManifest extends ReferenceManifest { * @param referenceManifestManager the reference manifest manager to be used to retrieve * reference manifests. */ - public Selector(final ReferenceManifestService referenceManifestManager) { + public Selector(final ReferenceManifestServiceImpl referenceManifestManager) { super(referenceManifestManager, SupportReferenceManifest.class); } @@ -150,7 +150,7 @@ public class SupportReferenceManifest extends ReferenceManifest { * persisted RIMs * @return a Selector instance to use for retrieving RIMs */ - public static Selector select(final ReferenceManifestService rimMan) { + public static Selector select(final ReferenceManifestServiceImpl rimMan) { return new Selector(rimMan); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateService.java deleted file mode 100644 index 7cd7f4b6..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateService.java +++ /dev/null @@ -1,23 +0,0 @@ -package hirs.attestationca.persist.service; - -import hirs.attestationca.persist.entity.userdefined.Certificate; -import hirs.attestationca.persist.service.selector.CertificateSelector; - -import java.util.List; -import java.util.Set; -import java.util.UUID; - -public interface CertificateService { - - Certificate saveCertificate(Certificate certificate); - - List fetchCertificates(Class classType); - - Certificate updateCertificate(Certificate certificate, UUID certificateId); - - Certificate updateCertificate(Certificate certificate); - - void deleteCertificate(Certificate certificate); - - Set get(CertificateSelector certificateSelector); -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateServiceImpl.java index 7320ab3e..1288dc78 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/CertificateServiceImpl.java @@ -1,45 +1,35 @@ package hirs.attestationca.persist.service; +import hirs.attestationca.persist.DBManagerException; +import hirs.attestationca.persist.entity.ArchivableEntity; import hirs.attestationca.persist.entity.manager.CertificateRepository; import hirs.attestationca.persist.entity.userdefined.Certificate; import hirs.attestationca.persist.service.selector.CertificateSelector; -import jakarta.persistence.EntityManager; +import lombok.NoArgsConstructor; +import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; -import java.util.List; import java.util.Set; import java.util.UUID; +@Log4j2 +@NoArgsConstructor @Service -public class CertificateServiceImpl extends DefaultDbService implements CertificateService { +public class CertificateServiceImpl extends DefaultDbService { - @Autowired(required = false) - private EntityManager entityManager; +// @PersistenceContext // I'll need this if I want to make custom native calls +// private EntityManager entityManager; @Autowired - private CertificateRepository repository; + private CertificateRepository certificateRepository; - @Override - public Certificate saveCertificate(Certificate certificate) { - return repository.save(certificate); - } - - @Override - @SuppressWarnings("unchecked") - public List fetchCertificates(Class classType) { - return (List) repository.findAll(Sort.sort(classType)); - } - - @Override - public Certificate updateCertificate(Certificate certificate, UUID certificateId) { - return saveCertificate(certificate); - } - - @Override - public Certificate updateCertificate(Certificate certificate) { - return saveCertificate(certificate); + /** + * Default Constructor. + */ + public CertificateServiceImpl(final Class clazz) { + super(clazz); + this.defineRepository(certificateRepository); } /** @@ -73,13 +63,29 @@ public class CertificateServiceImpl extends DefaultDbServ return null; } + /** - * Remove a certificate from the database. + * Archives the named object and updates it in the database. * - * @param certificate the certificate to delete - * @return true if deletion was successful, false otherwise + * @param id UUID of the object to archive + * @return true if the object was successfully found and archived, false if the object was not + * found + * @throws hirs.attestationca.persist.DBManagerException if the object is not an instance of ArchivableEntity */ - public void deleteCertificate(final Certificate certificate) { - repository.delete(certificate); + public final boolean archive(final UUID id) throws DBManagerException { + log.debug("archiving object: {}", id); + if (id == null) { + log.debug("null id argument"); + return false; + } + + T target = get(id); + if (target == null) { + return false; + } + + ((ArchivableEntity) target).archive(); + this.certificateRepository.save(target); + return true; } } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultDbService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultDbService.java index 577928fc..a90799fd 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultDbService.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultDbService.java @@ -1,7 +1,7 @@ package hirs.attestationca.persist.service; import hirs.attestationca.persist.DBManagerException; -import hirs.attestationca.persist.entity.ArchivableEntity; +import hirs.attestationca.persist.entity.AbstractEntity; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import lombok.NoArgsConstructor; @@ -19,12 +19,14 @@ import org.springframework.stereotype.Service; import java.io.Serializable; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.UUID; @Log4j2 @Service @NoArgsConstructor -public class DefaultDbService extends HibernateDbService { +public class DefaultDbService { /** * The default maximum number of retries to attempt a database transaction. */ @@ -49,10 +51,29 @@ public class DefaultDbService extends HibernateDbSer * unfortunately class type of T cannot be determined using only T */ public DefaultDbService(final Class clazz) { - super(clazz, null); setRetryTemplate(); } + public void defineRepository(final JpaRepository repository) { + this.repository = repository; + } + + public List listAll() { + return this.repository.findAll(); + } + + public void save(final T entity) { + this.repository.save(entity); + } + + public void delete(final T entity) { + this.repository.delete(entity); + } + + public void delete(final UUID id) { + this.repository.deleteById(id); + } + /** * Set the parameters used to retry database transactions. The retry template will * retry transactions that throw a LockAcquisitionException or StaleObjectStateException. @@ -167,33 +188,4 @@ public class DefaultDbService extends HibernateDbSer return clazz.cast(entity); } - - /** - * Archives the named object and updates it in the database. - * - * @param name name of the object to archive - * @return true if the object was successfully found and archived, false if the object was not - * found - * @throws DBManagerException if the object is not an instance of ArchivableEntity - */ -// @Override -// public final boolean archive(final String name) throws DBManagerException { -// log.debug("archiving object: {}", name); -// if (name == null) { -// log.debug("null name argument"); -// return false; -// } -// -// T target = get(name); -// if (target == null) { -// return false; -// } -// if (!(target instanceof ArchivableEntity)) { -// throw new DBManagerException("unable to archive non-archivable object"); -// } -// -// ((ArchivableEntity) target).archive(); -// repository.save(target); -// return true; -// } } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultService.java deleted file mode 100644 index 5da9fb2c..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DefaultService.java +++ /dev/null @@ -1,4 +0,0 @@ -package hirs.attestationca.persist.service; - -public interface DefaultService { -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DeviceServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DeviceServiceImpl.java index 705e934e..ecd2df77 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DeviceServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DeviceServiceImpl.java @@ -12,9 +12,9 @@ import java.util.List; * https://github.com/darrachequesne/spring-data-jpa-datatables */ @Service -public class DeviceServiceImpl { +public class DeviceServiceImpl extends DefaultDbService { - @Autowired(required = false) + @Autowired private EntityManager entityManager; @Autowired private DeviceRepository deviceRepository; diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HibernateDbService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HibernateDbService.java deleted file mode 100644 index e949f46d..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HibernateDbService.java +++ /dev/null @@ -1,132 +0,0 @@ -package hirs.attestationca.persist.service; - -import hirs.attestationca.persist.DBManagerException; -import jakarta.persistence.EntityManager; -import jakarta.persistence.PersistenceContext; -import jakarta.persistence.criteria.CriteriaBuilder; -import jakarta.persistence.criteria.CriteriaQuery; -import lombok.extern.log4j.Log4j2; - -import java.util.ArrayList; -import java.util.List; - -/** - * Abstract class that has the underlying Hibernate commands used by other DB Managers. - * This class exists primarily to reduce code in {@link hirs.attestationca.persist.service.DefaultDbService} which retries these methods - * using a RetryTemplate. - * - * @param type of objects to manage by this manager - */ -@Log4j2 -public abstract class HibernateDbService { - - private static final int MAX_CLASS_CACHE_ENTRIES = 500; - - private final Class clazz; - @PersistenceContext - private EntityManager entityManager; - private CriteriaBuilder criteriaBuilder; - private CriteriaQuery criteriaQuery; - - /** - * Creates a new AbstractDbManager. - * - * @param clazz Class to search for when doing Hibernate queries, - * unfortunately class type of T cannot be determined using only T - * @param entityManager the session factory to use to interact with the database - */ - public HibernateDbService(final Class clazz, final EntityManager entityManager) { - if (clazz == null) { - log.error("HibernateDbService cannot be instantiated with a null class"); - throw new IllegalArgumentException( - "HibernateDbService cannot be instantiated with a null class" - ); - } -// if (entityManager == null) { -// log.error("HibernateDbService cannot be instantiated with a null SessionFactory"); -// throw new IllegalArgumentException( -// "HibernateDbService cannot be instantiated with a null SessionFactory" -// ); -// } - this.clazz = clazz; - this.entityManager = entityManager; - } - - public HibernateDbService() { - clazz = null; - } - - /** - * Returns a list of all Ts of type clazz in the database, with an - * additional restriction also specified in the query. - *

- * This would be useful if T has several subclasses being - * managed. This class argument allows the caller to limit which types of - * T should be returned. - * - * @param clazz class type of Ts to search for (may be null to - * use Class<T>) - * @param additionalRestriction - an added Criterion to use in the query, null for none - * @return list of T names - * @throws DBManagerException if unable to search the database - */ - protected List doGetList(final Class clazz) - throws DBManagerException { - log.debug("Getting object list"); - Class searchClass = clazz; - if (clazz == null) { - log.debug("clazz is null"); - searchClass = this.clazz; - } - - List objects = new ArrayList<>(); - - return objects; - } - - /** - * Deletes the object from the database. This removes all of the database - * entries that stored information with regards to the this object. - *

- * If the object is referenced by any other tables then this will throw a - * DBManagerException. - * - * @param name name of the object to delete - * @return true if successfully found and deleted the object - * @throws DBManagerException if unable to find the baseline or delete it - * from the database - */ -// protected boolean doDelete(final String name) throws DBManagerException { -// log.debug("deleting object: {}", name); -// if (name == null) { -// log.debug("null name argument"); -// return false; -// } -// -// boolean deleted = false; -// Session session = entityManager.unwrap(Session.class); -// try { -// log.debug("retrieving object from db"); -// criteriaBuilder = session.getCriteriaBuilder(); -// criteriaQuery = criteriaBuilder.createQuery(clazz); -// Root root = criteriaQuery.from(clazz); -// criteriaQuery.select(root).where(criteriaBuilder.equal(root.get("name"), name)); -// -// Object object = session.createQuery(criteriaQuery).getSingleResult(); -// -// if (clazz.isInstance(object)) { -// T objectOfTypeT = clazz.cast(object); -// log.debug("found object, deleting it"); -// session.delete(objectOfTypeT); -// deleted = true; -// } -// } catch (Exception e) { -// final String msg = "unable to retrieve object"; -// log.error(msg, e); -// throw new DBManagerException(msg, e); -// } -// return deleted; -// } - - -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PolicyServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PolicyServiceImpl.java new file mode 100644 index 00000000..47cc45ea --- /dev/null +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PolicyServiceImpl.java @@ -0,0 +1,25 @@ +package hirs.attestationca.persist.service; + +import hirs.attestationca.persist.entity.manager.PolicyRepository; +import hirs.attestationca.persist.entity.userdefined.PolicySettings; +import jakarta.persistence.EntityManager; +import org.springframework.beans.factory.annotation.Autowired; + +//@Service +public class PolicyServiceImpl extends DefaultDbService { + + @Autowired + private EntityManager entityManager; + + @Autowired + private PolicyRepository repository; + + public void saveSettings(PolicySettings settings) { + repository.save(settings); + } + + +// public Policy getDefaultPolicy(Appraiser appraiser) { +// return repository.findByAppraiser(appraiser); +// } +} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueService.java deleted file mode 100644 index cef27536..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueService.java +++ /dev/null @@ -1,20 +0,0 @@ -package hirs.attestationca.persist.service; - -import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; -import hirs.attestationca.persist.entity.userdefined.rim.ReferenceDigestValue; - -import java.util.List; -import java.util.UUID; - -public interface ReferenceDigestValueService { - - ReferenceDigestValue saveReferenceDigestValue(ReferenceDigestValue referenceDigestValue); - - List fetchDigestValues(); - - ReferenceDigestValue updateRefDigestValue(ReferenceDigestValue referenceDigestValue, UUID rdvId); - - List getValuesByRimId(ReferenceManifest baseRim); - - void deleteRefDigestValueById(UUID rdvId); -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueServiceImpl.java index 52fa1502..cd44bd8e 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValueServiceImpl.java @@ -1,11 +1,8 @@ package hirs.attestationca.persist.service; import hirs.attestationca.persist.entity.manager.ReferenceDigestValueRepository; -import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; import hirs.attestationca.persist.entity.userdefined.rim.ReferenceDigestValue; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.jpa.datatables.mapping.DataTablesInput; -import org.springframework.data.jpa.datatables.mapping.DataTablesOutput; import org.springframework.stereotype.Service; import java.util.LinkedList; @@ -13,52 +10,12 @@ import java.util.List; import java.util.UUID; @Service -public class ReferenceDigestValueServiceImpl extends DefaultDbService implements ReferenceDigestValueService { +public class ReferenceDigestValueServiceImpl extends DefaultDbService { @Autowired private ReferenceDigestValueRepository repository; - @Override - public ReferenceDigestValue saveReferenceDigestValue(ReferenceDigestValue referenceDigestValue) { - return repository.save(referenceDigestValue); - } - - public List findAll() { - return repository.findAll(); - } - - @Override - public List fetchDigestValues() { - return repository.findAll(); - } - - @Override - public ReferenceDigestValue updateRefDigestValue(ReferenceDigestValue referenceDigestValue, UUID rdvId) { - return saveReferenceDigestValue(referenceDigestValue); - } - - public ReferenceDigestValue updateRefDigestValue(ReferenceDigestValue referenceDigestValue) { - if (referenceDigestValue.getId() != null) { - return updateRefDigestValue(referenceDigestValue, referenceDigestValue.getId()); - } - return null; - } - - public List getValuesByRimId(ReferenceManifest baseRim) { - List results = new LinkedList<>(); - if (baseRim != null) { - for (ReferenceDigestValue rdv : repository.findAll()) { - if (rdv.getBaseRimId() == baseRim.getId()) { - results.add(rdv); - } - } - } - - return results; - } - - @Override - public void deleteRefDigestValueById(UUID rdvId) { - repository.getReferenceById(rdvId).archive(); + public List getValuesByRimId(final UUID baseId) { + return new LinkedList<>(); } } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestService.java deleted file mode 100644 index 49b2e7e6..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestService.java +++ /dev/null @@ -1,23 +0,0 @@ -package hirs.attestationca.persist.service; - -import hirs.attestationca.persist.OrderedListQuerier; -import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; -import hirs.attestationca.persist.service.selector.ReferenceManifestSelector; - -import java.util.List; -import java.util.Set; -import java.util.UUID; - -public interface ReferenceManifestService extends OrderedListQuerier { - - ReferenceManifest saveReferenceManifest(ReferenceManifest referenceManifest); - - List fetchReferenceManifests(); -// DataTablesOutput fetchReferenceManifests(DataTablesInput input); - - ReferenceManifest updateReferenceManifest(ReferenceManifest referenceManifest, UUID rimId); - - void deleteReferenceManifestById(UUID rimId); - - Set get(ReferenceManifestSelector referenceManifestSelector); -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestServiceImpl.java index 6baf680e..11592bfe 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestServiceImpl.java @@ -3,13 +3,13 @@ package hirs.attestationca.persist.service; import hirs.attestationca.persist.CriteriaModifier; import hirs.attestationca.persist.DBManagerException; import hirs.attestationca.persist.FilteredRecordsList; +import hirs.attestationca.persist.OrderedListQuerier; import hirs.attestationca.persist.entity.manager.ReferenceManifestRepository; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; import hirs.attestationca.persist.service.selector.ReferenceManifestSelector; import jakarta.persistence.EntityManager; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.xml.sax.SAXException; @@ -20,12 +20,10 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.UUID; @Log4j2 @Service -public class ReferenceManifestServiceImpl extends DefaultDbService implements ReferenceManifestService { +public class ReferenceManifestServiceImpl extends DefaultDbService implements OrderedListQuerier { /** * The variable that establishes a schema factory for xml processing. @@ -33,7 +31,7 @@ public class ReferenceManifestServiceImpl extends D public static final SchemaFactory SCHEMA_FACTORY = SchemaFactory.newInstance(ReferenceManifest.SCHEMA_LANGUAGE); - @Autowired(required = false) + @Autowired private EntityManager entityManager; @Autowired @@ -77,29 +75,18 @@ public class ReferenceManifestServiceImpl extends D return schema; } - @Override - public ReferenceManifest saveReferenceManifest(ReferenceManifest referenceManifest) { - return repository.save(referenceManifest); - } - - @Override - public List fetchReferenceManifests() { - return repository.findAll(); - } - /** * This method does not need to be used directly as it is used by * {@link ReferenceManifestSelector}'s get* methods. Regardless, it may be * used to retrieve ReferenceManifest by other code in this package, given a * configured ReferenceManifestSelector. * - * @param referenceManifestSelector a configured * {@link ReferenceManifestSelector} to use for querying * @return the resulting set of ReferenceManifest, possibly empty */ @SuppressWarnings("unchecked") public List get( - Class classType) { + final ReferenceManifestSelector referenceManifestSelector) { log.info("Getting the full set of Reference Manifest files."); // return new HashSet<>( // (List) getWithCriteria( @@ -107,22 +94,7 @@ public class ReferenceManifestServiceImpl extends D // Collections.singleton(referenceManifestSelector.getCriterion()) // ) // ); - return (List) repository.findAll(Sort.sort(classType)); - } - - @Override - public ReferenceManifest updateReferenceManifest(ReferenceManifest referenceManifest, UUID rimId) { - return null; - } - - @Override - public void deleteReferenceManifestById(UUID rimId) { - repository.deleteById(rimId); - } - - @Override - public Set get(ReferenceManifestSelector referenceManifestSelector) { - return null; + return (List) repository.findAll(); } @Override @@ -130,7 +102,7 @@ public class ReferenceManifestServiceImpl extends D String columnToOrder, boolean ascending, int firstResult, int maxResults, String search, Map searchableColumns) throws DBManagerException { - return null; + return new FilteredRecordsList(); } @Override @@ -139,6 +111,6 @@ public class ReferenceManifestServiceImpl extends D int firstResult, int maxResults, String search, Map searchableColumns, CriteriaModifier criteriaModifier) throws DBManagerException { - return null; + return new FilteredRecordsList<>(); } } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SettingsServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SettingsServiceImpl.java deleted file mode 100644 index e3e9e553..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SettingsServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package hirs.attestationca.persist.service; - -import hirs.attestationca.persist.entity.manager.SettingsRepository; -import hirs.attestationca.persist.entity.userdefined.SupplyChainSettings; -import jakarta.persistence.EntityManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class SettingsServiceImpl { - - @Autowired(required = false) - private EntityManager entityManager; - - @Autowired - private SettingsRepository repository; - - public SupplyChainSettings updateSettings(SupplyChainSettings settings) { - SupplyChainSettings existing = repository.findByName(settings.getName()); - - if (existing != null) { - settings.setId(existing.getId()); - } - return repository.save(settings); - } - - public void saveSettings(SupplyChainSettings settings) { - repository.save(settings); - } - - public SupplyChainSettings getByName(String name) { - if (name == null) { - return null; - } - return repository.findByName(name); - } - -// public Policy getDefaultPolicy(Appraiser appraiser) { -// return repository.findByAppraiser(appraiser); -// } -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java deleted file mode 100644 index b8ce4c56..00000000 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package hirs.attestationca.persist.service; - -import hirs.attestationca.persist.entity.userdefined.SupplyChainValidation; - -import java.util.List; -import java.util.UUID; - -public interface SupplyChainValidationService { - SupplyChainValidation saveSupplyChainValidation(SupplyChainValidation supplyChainValidation); - - List fetchSupplyChainValidations(); - - SupplyChainValidation updateSupplyChainValidation(SupplyChainValidation supplyChainValidation, UUID scvId); - - void deleteSupplyChainValidation(UUID scvId); -} diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationServiceImpl.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationServiceImpl.java index 0bb287e0..9065925f 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationServiceImpl.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationServiceImpl.java @@ -9,7 +9,6 @@ import hirs.utils.BouncyCastleUtils; import lombok.extern.log4j.Log4j2; import org.bouncycastle.util.encoders.Hex; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import java.io.IOException; import java.security.KeyStore; @@ -20,43 +19,22 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.UUID; import java.util.stream.Collectors; @Log4j2 -@Service -public class SupplyChainValidationServiceImpl extends DefaultDbService implements SupplyChainValidationService { +//@Service +public class SupplyChainValidationServiceImpl extends DefaultDbService { @Autowired SupplyChainValidationRepository repository; @Autowired - private CertificateService certificateService; + private CertificateServiceImpl certificateService; - public SupplyChainValidationServiceImpl(final CertificateService certificateService) { + public SupplyChainValidationServiceImpl(final CertificateServiceImpl certificateService) { super(); this.certificateService = certificateService; } - @Override - public SupplyChainValidation saveSupplyChainValidation(SupplyChainValidation supplyChainValidation) { - return repository.save(supplyChainValidation); - } - - @Override - public List fetchSupplyChainValidations() { - return repository.findAll(); - } - - @Override - public SupplyChainValidation updateSupplyChainValidation(SupplyChainValidation supplyChainValidation, UUID scvId) { - return null; - } - - @Override - public void deleteSupplyChainValidation(UUID scvId) { - repository.deleteById(scvId); - } - /** * This method is used to retrieve the entire CA chain (up to a trusted * self-signed certificate) for the given certificate. This method will look diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/CertificateSelector.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/CertificateSelector.java index 2c5dac16..bc8f3c9a 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/CertificateSelector.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/CertificateSelector.java @@ -2,7 +2,6 @@ package hirs.attestationca.persist.service.selector; import com.google.common.base.Preconditions; import hirs.attestationca.persist.entity.userdefined.Certificate; -import hirs.attestationca.persist.service.CertificateService; import hirs.attestationca.persist.service.CertificateServiceImpl; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaQuery; @@ -77,7 +76,7 @@ import java.util.UUID; */ public abstract class CertificateSelector { - private final CertificateService certificateManager; + private final CertificateServiceImpl certificateService; private final Class certificateClass; private final Map fieldValueSelections; @@ -87,28 +86,28 @@ public abstract class CertificateSelector { * Construct a new CertificateSelector that will use the given {@link CertificateServiceImpl} to * retrieve certificates of the given type. * - * @param certificateManager the certificate manager to be used to retrieve certificates + * @param certificateService the certificate manager to be used to retrieve certificates * @param certificateClass the class of certificate to be retrieved */ public CertificateSelector( - final CertificateService certificateManager, + final CertificateServiceImpl certificateService, final Class certificateClass) { - this(certificateManager, certificateClass, true); + this(certificateService, certificateClass, true); } /** - * Construct a new CertificateSelector that will use the given {@link CertificateService} to + * Construct a new CertificateSelector that will use the given {@link CertificateServiceImpl } to * retrieve certificates of the given type. * - * @param certificateManager the certificate manager to be used to retrieve certificates + * @param certificateService the certificate manager to be used to retrieve certificates * @param certificateClass the class of certificate to be retrieved * @param excludeArchivedCertificates true if excluding archived certificates */ public CertificateSelector( - final CertificateService certificateManager, + final CertificateServiceImpl certificateService, final Class certificateClass, final boolean excludeArchivedCertificates) { Preconditions.checkArgument( - certificateManager != null, + certificateService != null, "certificate manager cannot be null" ); @@ -117,7 +116,7 @@ public abstract class CertificateSelector { "type cannot be null" ); - this.certificateManager = certificateManager; + this.certificateService = certificateService; this.certificateClass = certificateClass; this.fieldValueSelections = new HashMap<>(); this.excludeArchivedCertificates = excludeArchivedCertificates; @@ -459,7 +458,7 @@ public abstract class CertificateSelector { // construct and execute query private Set execute() { - return certificateManager.get(this); + return certificateService.get(this); } /** diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/ReferenceManifestSelector.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/ReferenceManifestSelector.java index b110c923..6090fcd9 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/ReferenceManifestSelector.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/selector/ReferenceManifestSelector.java @@ -3,7 +3,7 @@ package hirs.attestationca.persist.service.selector; import com.google.common.base.Preconditions; import hirs.attestationca.persist.entity.userdefined.Certificate; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; -import hirs.attestationca.persist.service.ReferenceManifestService; +import hirs.attestationca.persist.service.ReferenceManifestServiceImpl; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Predicate; @@ -12,16 +12,15 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; /** * This class is used to select one or many RIMs in conjunction - * with a {@link ReferenceManifestService}. To make use of this object, + * with a {@link ReferenceManifestServiceImpl}. To make use of this object, * use (some ReferenceManifest).select(ReferenceManifestManager). * * @param the type of Reference Integrity Manifest that will be retrieved. @@ -45,7 +44,7 @@ public abstract class ReferenceManifestSelector { public static final String RIM_FILENAME_FIELD = "fileName"; private static final String RIM_TYPE_FIELD = "rimType"; - private final ReferenceManifestService referenceManifestManager; + private final ReferenceManifestServiceImpl referenceManifestManager; private final Class referenceTypeClass; private final Map fieldValueSelections; @@ -57,7 +56,7 @@ public abstract class ReferenceManifestSelector { * @param referenceManifestManager the RIM manager to be used to retrieve RIMs * @param referenceTypeClass the type of Reference Manifest to process. */ - public ReferenceManifestSelector(final ReferenceManifestService referenceManifestManager, + public ReferenceManifestSelector(final ReferenceManifestServiceImpl referenceManifestManager, final Class referenceTypeClass) { this(referenceManifestManager, referenceTypeClass, true); } @@ -69,7 +68,7 @@ public abstract class ReferenceManifestSelector { * @param referenceTypeClass the type of Reference Manifest to process. * @param excludeArchivedRims true if excluding archived RIMs */ - public ReferenceManifestSelector(final ReferenceManifestService referenceManifestManager, + public ReferenceManifestSelector(final ReferenceManifestServiceImpl referenceManifestManager, final Class referenceTypeClass, final boolean excludeArchivedRims) { Preconditions.checkArgument( @@ -164,7 +163,7 @@ public abstract class ReferenceManifestSelector { * @return a matching RIM or null if none is found */ public T getRIM() { - Set rims = execute(); + List rims = execute(); if (rims.isEmpty()) { return null; } @@ -216,8 +215,8 @@ public abstract class ReferenceManifestSelector { } // construct and execute query - private Set execute() { - Set results = this.referenceManifestManager.get(this); + private List execute() { + List results = this.referenceManifestManager.get(this); return results; } diff --git a/HIRS_AttestationCAPortal/build.gradle b/HIRS_AttestationCAPortal/build.gradle index 7b62bc4a..f402c4de 100644 --- a/HIRS_AttestationCAPortal/build.gradle +++ b/HIRS_AttestationCAPortal/build.gradle @@ -3,7 +3,7 @@ plugins { id 'java' id 'war' id "nebula.ospackage" version "9.1.1" - id 'org.springframework.boot' version '3.0.6' + id 'org.springframework.boot' version '3.1.0' id 'io.spring.dependency-management' version '1.1.0' } @@ -34,6 +34,7 @@ dependencies { implementation project(':HIRS_AttestationCA') implementation libs.pci + implementation libs.gson implementation libs.bouncycastle implementation libs.guava implementation libs.jakarta.servlet @@ -41,8 +42,10 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'com.github.darrachequesne:spring-data-jpa-datatables:6.0.1' implementation 'org.projectlombok:lombok' + implementation 'commons-fileupload:commons-fileupload:1.5' + implementation 'org.junit.jupiter:junit-jupiter:5.4.2' + implementation 'org.junit.jupiter:junit-jupiter:5.4.2' compileOnly 'org.projectlombok:lombok' runtimeOnly 'org.mariadb.jdbc:mariadb-java-client' @@ -50,7 +53,13 @@ dependencies { providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation libs.testng + testImplementation libs.mockito } +// +//test { +// useTestNG() +//} war { from(buildDir) { diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSApplication.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSApplication.java index d00522e0..855aea4d 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSApplication.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSApplication.java @@ -1,19 +1,22 @@ package hirs.attestationca.portal; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; import lombok.extern.log4j.Log4j2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; -import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.web.servlet.DispatcherServlet; import java.util.Collections; @SpringBootApplication @EnableAutoConfiguration @Log4j2 -@ComponentScan({"hirs.attestationca.portal", "hirs.attestationca.portal.page.controllers", "hirs.attestationca.persist.entity", "hirs.attestationca.persist.service"}) public class HIRSApplication extends SpringBootServletInitializer { @Override @@ -21,16 +24,24 @@ public class HIRSApplication extends SpringBootServletInitializer { return application.sources(HIRSApplication.class); } + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + ServletRegistration.Dynamic appServlet = servletContext.addServlet("mvc", new DispatcherServlet( + new GenericWebApplicationContext())); + + appServlet.setLoadOnStartup(1); + } + public static void main(String[] args) { SpringApplication springApplication = new SpringApplication(HIRSApplication.class); springApplication.setDefaultProperties(Collections.singletonMap("server.servlet.context-path", "/portal")); springApplication.run(args); - log.debug("Debug log message"); +// log.debug("Debug log message"); log.info("Info log message"); log.error("Error log message"); log.warn("Warn log message"); log.fatal("Fatal log message"); - log.trace("Trace log message"); +// log.trace("Trace log message"); } } \ No newline at end of file diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSDbInitializer.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSDbInitializer.java index 01cdaf94..d7a4a580 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSDbInitializer.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/HIRSDbInitializer.java @@ -1,16 +1,55 @@ package hirs.attestationca.portal; -import hirs.attestationca.persist.service.SettingsServiceImpl; +import jakarta.servlet.ServletContextEvent; import jakarta.servlet.ServletContextListener; import jakarta.servlet.annotation.WebListener; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; +@Log4j2 @WebListener -public class HIRSDbInitializer implements ServletContextListener { +public class HIRSDbInitializer extends AbstractAnnotationConfigDispatcherServletInitializer implements ServletContextListener { + + @Override + public void contextInitialized(final ServletContextEvent servletContextEvent) { + AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); + applicationContext.getEnvironment().addActiveProfile("Server"); + +// applicationContext.register(PersistenceConfiguration.class); + try { + applicationContext.refresh(); + + } catch (NoSuchBeanDefinitionException nsbdEx) { + if (log.isDebugEnabled()) { + log.debug("Unable to locate MultipartResolver with name 'multipartResolver': no multipart request handling provided"); + } + } catch (Exception ex) { + log.error("DAVY********************************************************************************"); + log.error(ex.getMessage()); + } + } + + @Override + protected Class [] getRootConfigClasses() { + return new Class[] { + PersistenceJPAConfig.class + }; + } + + @Override + protected Class [] getServletConfigClasses() { + return new Class[] { + PageConfiguration.class + }; + } + + @Override + protected String[] getServletMappings() { + return new String[] { + "/" + }; + } - @Autowired - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - @Autowired - static SettingsServiceImpl settingsService = new SettingsServiceImpl(); } diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PageConfiguration.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PageConfiguration.java new file mode 100644 index 00000000..a1550aa9 --- /dev/null +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PageConfiguration.java @@ -0,0 +1,60 @@ +package hirs.attestationca.portal; + +import hirs.attestationca.portal.datatables.DataTableView; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.UrlBasedViewResolver; + + +/** + * Specifies the location to scan for page controllers, view resolver for JSON data, and view + * resolver to map view names to jsp files. + */ +@Configuration +@EnableWebMvc +@ComponentScan("hirs.attestationca.portal.page.controllers") +public class PageConfiguration { + + /** + * @return bean to resolve injected annotation.Value + * property expressions for beans. + */ + @Bean + public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { + return new PropertySourcesPlaceholderConfigurer(); + } + + /** + * Makes all URLs that end in "dataTable" use DataTableView to serialize DataTableResponse. + * + * @return ViewResolver that uses DataTableView. + */ + @Bean + public ViewResolver dataTableViewResolver() { + UrlBasedViewResolver resolver = new UrlBasedViewResolver(); + resolver.setViewClass(DataTableView.class); + resolver.setViewNames("*dataTable"); + resolver.setOrder(0); + return resolver; + } + + /** + * Maps view names to the appropriate jsp file. + *

+ * Only seems to apply to GET requests. + * + * @return a ViewResolver bean containing the mapping. + */ + @Bean + public ViewResolver pageViewResolver() { + InternalResourceViewResolver resolver = new InternalResourceViewResolver(); + resolver.setPrefix("/WEB-INF/jsp/"); + resolver.setSuffix(".jsp"); + return resolver; + } +} diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PersistenceJPAConfig.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PersistenceJPAConfig.java index d03daf12..a4aa1789 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PersistenceJPAConfig.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/PersistenceJPAConfig.java @@ -1,6 +1,5 @@ package hirs.attestationca.portal; -import hirs.attestationca.persist.entity.userdefined.SupplyChainSettings; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -18,6 +17,9 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; +import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.sql.DataSource; import java.security.cert.X509Certificate; @@ -27,9 +29,9 @@ import java.util.Properties; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:hibernate.properties", "classpath:portal.properties" }) -@ComponentScan({ "hirs.attestationca.portal.page.controllers", "hirs.attestationca.persist.entity" }) +@ComponentScan({"hirs.attestationca.portal", "hirs.attestationca.portal.page.controllers", "hirs.attestationca.persist.entity"})//, "hirs.attestationca.persist.service"}) @EnableJpaRepositories(basePackages = "hirs.attestationca.persist.entity.manager") -public class PersistenceJPAConfig { +public class PersistenceJPAConfig implements WebMvcConfigurer { @Value("${aca.directories.certificates}") private String certificatesLocation; @@ -50,7 +52,7 @@ public class PersistenceJPAConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean entityManagerBean = new LocalContainerEntityManagerFactoryBean(); entityManagerBean.setDataSource(dataSource()); - entityManagerBean.setPackagesToScan(new String[] {"hirs.attestationca.persist"}); + entityManagerBean.setPackagesToScan("hirs.attestationca.persist.entity"); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); entityManagerBean.setJpaVendorAdapter(vendorAdapter); @@ -62,7 +64,8 @@ public class PersistenceJPAConfig { @Bean public DataSource dataSource() { final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(environment.getProperty("hibernate.connection.driver_class")); + dataSource.setDriverClassName(environment.getProperty("hibernate.connection.driver_class", + "org.mariadb.jdbc.Driver")); dataSource.setUrl(environment.getProperty("hibernate.connection.url")); dataSource.setUsername(environment.getProperty("hibernate.connection.username")); dataSource.setPassword(environment.getProperty("hibernate.connection.password")); @@ -185,10 +188,28 @@ public class PersistenceJPAConfig { return hibernateProperties; } - @Bean(name="default-settings") - public SupplyChainSettings supplyChainSettings() { - SupplyChainSettings scSettings = new SupplyChainSettings("Default", "Settings are configured for no validation flags set."); - - return scSettings; + /** + * Creates a Spring Resolver for Multi-part form uploads. This is required + * for spring controllers to be able to process Spring MultiPartFiles + * + * @return bean to handle multipart form requests + */ + @Bean(name = "multipartResolver") + public StandardServletMultipartResolver multipartResolver() { + return new StandardServletMultipartResolver(); } + +// @Bean(name="default-settings") +// public PolicySettings supplyChainSettings() { +// PolicySettings scSettings = new PolicySettings("Default", "Settings are configured for no validation flags set."); +// +// return scSettings; +// } + + + @Override + public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) { + configurer.enable(); + } + } diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/datatables/DataTableView.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/datatables/DataTableView.java new file mode 100644 index 00000000..034fc819 --- /dev/null +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/datatables/DataTableView.java @@ -0,0 +1,45 @@ +package hirs.attestationca.portal.datatables; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.util.Map; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.http.MediaType; +import org.springframework.web.servlet.view.AbstractUrlBasedView; + +/** + * Serializes the DataTableResponse from the view as JSON and writes it to the HTTP response. + * + */ +public class DataTableView extends AbstractUrlBasedView { + + private static final Gson GSON = new GsonBuilder().create(); + private static final String MODEL_FIELD; + static { + final String name = DataTableResponse.class.getSimpleName(); + MODEL_FIELD = name.substring(0, 1).toLowerCase() + name.substring(1); + } + + /** + * Serializes the DataTableResponse from the view as JSON and writes it to the HTTP response. + * + * @param model combined output Map (never {@code null}), with dynamic values taking precedence + * over static attributes + * @param request current HTTP request + * @param response current HTTP response + * @throws Exception if rendering failed + */ + @Override + protected void renderMergedOutputModel( + final Map model, + final HttpServletRequest request, + final HttpServletResponse response) throws Exception { + response.setContentType(MediaType.APPLICATION_JSON_VALUE); + DataTableResponse dataTable = (DataTableResponse) model.get(MODEL_FIELD); + ServletOutputStream out = response.getOutputStream(); + String json = GSON.toJson(dataTable); + out.print(json); + } +} diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PageController.java index 4ab1306e..13cf7455 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PageController.java @@ -146,7 +146,7 @@ public abstract class PageController

{ if (params != null) { for (Map.Entry e : params.asMap().entrySet()) { - Object v = Optional.ofNullable(e.getValue()).orElse(""); + Object v = Optional.ofNullable(e.getValue()).orElse(null); uri.addParameter(e.getKey(), v.toString()); } } diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PolicyPageModel.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PolicyPageModel.java index dbf8d37a..7fff5afe 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PolicyPageModel.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/PolicyPageModel.java @@ -1,6 +1,6 @@ package hirs.attestationca.portal.page; -import hirs.attestationca.persist.entity.userdefined.SupplyChainSettings; +import hirs.attestationca.persist.entity.userdefined.PolicySettings; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -55,7 +55,7 @@ public class PolicyPageModel { * * @param policy The supply chain policy */ - public PolicyPageModel(final SupplyChainSettings policy) { + public PolicyPageModel(final PolicySettings policy) { this.enableEcValidation = policy.isEcValidationEnabled(); this.enablePcCertificateValidation = policy.isPcValidationEnabled(); this.enablePcCertificateAttributeValidation = policy.isPcAttributeValidationEnabled(); diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java index 75bef9eb..21a007e7 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java @@ -1,7 +1,7 @@ package hirs.attestationca.portal.page.controllers; +import hirs.attestationca.persist.entity.manager.CertificateRepository; import hirs.attestationca.portal.page.Page; -import hirs.attestationca.persist.service.CertificateServiceImpl; import hirs.attestationca.portal.page.PageController; import hirs.attestationca.portal.page.PageMessages; import hirs.attestationca.portal.page.params.CertificateDetailsPageParams; @@ -29,16 +29,16 @@ public class CertificateDetailsPageController extends PageController { - private final CertificateServiceImpl certificateServiceImpl; +// private final CertificateServiceImpl certificateService; private CertificateAuthorityCredential certificateAuthorityCredential; + private final CertificateRepository certificateRepository; private static final String TRUSTCHAIN = "trust-chain"; private static final String PLATFORMCREDENTIAL = "platform-credentials"; @@ -64,18 +65,19 @@ public class CertificatePageController extends PageController { /** * Constructor providing the Page's display and routing specification. * - * @param certificateServiceImpl the certificate manager + * @param certificateRepository the certificate manager // * @param crudManager the CRUD manager for certificates // * @param acaCertificate the ACA's X509 certificate */ @Autowired - public CertificatePageController( - final CertificateServiceImpl certificateServiceImpl//, + public CertificatePageController(final CertificateRepository certificateRepository + //final CertificateServiceImpl certificateService, // final CrudManager crudManager, // final X509Certificate acaCertificate ) { super(Page.TRUST_CHAIN); - this.certificateServiceImpl = certificateServiceImpl; +// this.certificateService = certificateService; + this.certificateRepository = certificateRepository; // this.dataTableQuerier = crudManager; // try { @@ -132,7 +134,7 @@ public class CertificatePageController extends PageController { mav = getBaseModelAndView(Page.TRUST_CHAIN); // Map with the ACA certificate information data.putAll(CertificateStringMapBuilder.getCertificateAuthorityInformation( - certificateAuthorityCredential, this.certificateServiceImpl)); + certificateAuthorityCredential, null)); mav.addObject(ACA_CERT_DATA, data); break; default: @@ -171,7 +173,7 @@ public class CertificatePageController extends PageController { certificateType, file.getOriginalFilename(), messages, certificate, - certificateServiceImpl); + null); } } @@ -224,7 +226,7 @@ public class CertificatePageController extends PageController { try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) { // get all files - bulkDownload(zipOut, this.certificateServiceImpl.fetchCertificates(CertificateAuthorityCredential.class), singleFileName); +// bulkDownload(zipOut, this.certificateRepository.fetchCertificates(CertificateAuthorityCredential.class), singleFileName); // write cert to output stream } catch (IllegalArgumentException ex) { String uuidError = "Failed to parse ID from: "; @@ -256,7 +258,7 @@ public class CertificatePageController extends PageController { try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) { // get all files - bulkDownload(zipOut, this.certificateServiceImpl.fetchCertificates(PlatformCredential.class), singleFileName); +// bulkDownload(zipOut, this.certificateRepository.fetchCertificates(PlatformCredential.class), singleFileName); // write cert to output stream } catch (IllegalArgumentException ex) { String uuidError = "Failed to parse ID from: "; @@ -288,7 +290,7 @@ public class CertificatePageController extends PageController { try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) { // get all files - bulkDownload(zipOut, this.certificateServiceImpl.fetchCertificates(IssuedAttestationCertificate.class), singleFileName); +// bulkDownload(zipOut, this.certificateRepository.fetchCertificates(IssuedAttestationCertificate.class), singleFileName); // write cert to output stream } catch (IllegalArgumentException ex) { String uuidError = "Failed to parse ID from: "; @@ -319,7 +321,7 @@ public class CertificatePageController extends PageController { try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) { // get all files - bulkDownload(zipOut, this.certificateServiceImpl.fetchCertificates(EndorsementCredential.class), singleFileName); +// bulkDownload(zipOut, this.certificateService.findAll(), singleFileName); // write cert to output stream } catch (IllegalArgumentException ex) { String uuidError = "Failed to parse ID from: "; @@ -372,18 +374,18 @@ public class CertificatePageController extends PageController { * * @param certificateType String containing the certificate type * @param certificateHash the hash of the certificate's bytes - * @param certificateManager the certificate manager to query + * @param certificateService the certificate manager to query * @return the certificate or null if none is found */ private Certificate getCertificateByHash( final String certificateType, final int certificateHash, - final CertificateService certificateManager) { + final CertificateServiceImpl certificateService) { switch (certificateType) { case PLATFORMCREDENTIAL: return PlatformCredential - .select(certificateManager) + .select(certificateService) .includeArchived() .byHashCode(certificateHash) .getCertificate(); @@ -395,7 +397,7 @@ public class CertificatePageController extends PageController { // .getCertificate(); case TRUSTCHAIN: return CertificateAuthorityCredential - .select(certificateManager) + .select(certificateService) .includeArchived() .byHashCode(certificateHash) .getCertificate(); @@ -409,13 +411,13 @@ public class CertificatePageController extends PageController { * * @param certificateType String containing the certificate type * @param serialNumber the platform serial number - * @param certificateManager the certificate manager to query + * @param certificateService the certificate manager to query * @return the certificate or null if none is found */ private List getCertificateByBoardSN( final String certificateType, final String serialNumber, - final CertificateService certificateManager) { + final CertificateServiceImpl certificateService) { if (serialNumber == null) { return null; @@ -424,7 +426,7 @@ public class CertificatePageController extends PageController { switch (certificateType) { case PLATFORMCREDENTIAL: return PlatformCredential - .select(certificateManager) + .select(certificateService) .byBoardSerialNumber(serialNumber) .getCertificates().stream().collect(Collectors.toList()); default: @@ -504,7 +506,7 @@ public class CertificatePageController extends PageController { * be stored * @param messages contains any messages that will be display on the page * @param certificate the certificate to store - * @param certificateManager the DB manager to use + * @param certificateService the DB manager to use * @return the messages for the page */ private void storeCertificate( @@ -512,7 +514,7 @@ public class CertificatePageController extends PageController { final String fileName, final PageMessages messages, final Certificate certificate, - final CertificateService certificateManager) { + final CertificateServiceImpl certificateService) { Certificate existingCertificate; @@ -521,7 +523,7 @@ public class CertificatePageController extends PageController { existingCertificate = getCertificateByHash( certificateType, certificate.getCertificateHash(), - certificateManager); + certificateService); } catch (DBServiceException e) { final String failMessage = "Querying for existing certificate failed (" + fileName + "): "; @@ -539,7 +541,7 @@ public class CertificatePageController extends PageController { List sharedCertificates = getCertificateByBoardSN( certificateType, platformCertificate.getPlatformSerial(), - certificateManager); + certificateService); if (sharedCertificates != null) { for (PlatformCredential pc : sharedCertificates) { @@ -575,7 +577,7 @@ public class CertificatePageController extends PageController { }**/ } - certificateManager.saveCertificate(certificate); + certificateService.save(certificate); final String successMsg = String.format("New certificate successfully uploaded (%s): ", fileName); @@ -597,7 +599,7 @@ public class CertificatePageController extends PageController { if (existingCertificate.isArchived()) { existingCertificate.restore(); existingCertificate.resetCreateTime(); - certificateManager.updateCertificate(existingCertificate); + certificateService.save(existingCertificate); final String successMsg = String.format("Pre-existing certificate " + "found and unarchived (%s): ", fileName); diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java index c4dec9c0..25986103 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java @@ -3,7 +3,6 @@ package hirs.attestationca.portal.page.controllers; import hirs.attestationca.persist.entity.manager.DeviceRepository; import hirs.attestationca.persist.entity.userdefined.Device; import hirs.attestationca.portal.page.Page; -import hirs.attestationca.persist.service.DeviceServiceImpl; import hirs.attestationca.portal.page.PageController; import hirs.attestationca.portal.page.params.NoPageParams; import org.springframework.beans.factory.annotation.Autowired; @@ -23,14 +22,11 @@ public class DevicePageController extends PageController { * Autowiring property vs constructor */ - private final DeviceServiceImpl deviceServiceImpl; private final DeviceRepository deviceRepository; @Autowired - public DevicePageController(DeviceServiceImpl deviceServiceImpl, - DeviceRepository deviceRepository) { + public DevicePageController(final DeviceRepository deviceRepository) { super(Page.DEVICES); - this.deviceServiceImpl = deviceServiceImpl; this.deviceRepository = deviceRepository; } diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java index 6e703abd..5c926a67 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java @@ -1,7 +1,7 @@ package hirs.attestationca.portal.page.controllers; -import hirs.attestationca.persist.entity.userdefined.SupplyChainSettings; -import hirs.attestationca.persist.service.SettingsServiceImpl; +import hirs.attestationca.persist.entity.manager.PolicyRepository; +import hirs.attestationca.persist.entity.userdefined.PolicySettings; import hirs.attestationca.portal.page.Page; import hirs.attestationca.portal.page.PageController; import hirs.attestationca.portal.page.PageMessages; @@ -39,7 +39,7 @@ public class PolicyPageController extends PageController { private static final String ENABLED_EXPIRES_PARAMETER_VALUE = "expires"; - private SettingsServiceImpl settingsService; + private final PolicyRepository policyRepository; /** * Model attribute name used by initPage for the initial data passed to the @@ -56,16 +56,16 @@ public class PolicyPageController extends PageController { /** * Constructor. * - * @param policyService the policy service + * @param policyRepository the policy service */ @Autowired - public PolicyPageController(final SettingsServiceImpl policyService) { + public PolicyPageController(final PolicyRepository policyRepository) { super(Page.POLICY); - this.settingsService = policyService; + this.policyRepository = policyRepository; - if (this.settingsService.getByName("Default") == null) { - this.settingsService.saveSettings(new SupplyChainSettings("Default", "Settings are configured for no validation flags set.")); - } +// if (this.settingsService.findByName("Default") == null) { +// this.settingsService.saveSettings(new PolicySettings("Default", "Settings are configured for no validation flags set.")); +// } } /** @@ -82,7 +82,7 @@ public class PolicyPageController extends PageController { // get the basic information to render the page ModelAndView mav = getBaseModelAndView(); - SupplyChainSettings policy = getDefaultPolicy(); + PolicySettings policy = getDefaultPolicy(); log.debug(policy); PolicyPageModel pageModel = new PolicyPageModel(policy); mav.addObject(INITIAL_DATA, pageModel); @@ -113,7 +113,7 @@ public class PolicyPageController extends PageController { = ppModel.getPcValidate().equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); // If PC policy setting change results in invalid policy, inform user if (!isPolicyValid(policy.isEcValidationEnabled(), pcValidationOptionEnabled, @@ -164,7 +164,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); // If PC Attribute Validation is enabled without PC Validation, disallow change if (!isPolicyValid(policy.isEcValidationEnabled(), @@ -216,7 +216,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); if (issuedAttestationOptionEnabled) { successMessage = "Attestation Certificate generation enabled."; @@ -260,7 +260,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); if (issuedDevIdOptionEnabled) { successMessage = "DevID Certificate generation enabled."; @@ -312,7 +312,7 @@ public class PolicyPageController extends PageController { } try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); boolean issuedAttestationOptionEnabled = policy.isIssueAttestationCertificate(); @@ -326,7 +326,7 @@ public class PolicyPageController extends PageController { if (generateCertificateEnabled) { numOfDays = ppModel.getExpirationValue(); if (numOfDays == null) { - numOfDays = SupplyChainSettings.TEN_YEARS; + numOfDays = PolicySettings.TEN_YEARS; } } else { numOfDays = policy.getValidityDays(); @@ -382,7 +382,7 @@ public class PolicyPageController extends PageController { } try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); boolean issuedDevIdOptionEnabled = policy.isIssueDevIdCertificate(); @@ -396,7 +396,7 @@ public class PolicyPageController extends PageController { if (generateDevIdCertificateEnabled) { numOfDays = ppModel.getDevIdExpirationValue(); if (numOfDays == null) { - numOfDays = SupplyChainSettings.TEN_YEARS; + numOfDays = PolicySettings.TEN_YEARS; } } else { numOfDays = policy.getDevIdValidityDays(); @@ -452,7 +452,7 @@ public class PolicyPageController extends PageController { } try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); boolean issuedAttestationOptionEnabled = policy.isIssueAttestationCertificate(); @@ -470,7 +470,7 @@ public class PolicyPageController extends PageController { } if (threshold == null || threshold.isEmpty()) { - threshold = SupplyChainSettings.YEAR; + threshold = PolicySettings.YEAR; } policy.setReissueThreshold(threshold); @@ -522,7 +522,7 @@ public class PolicyPageController extends PageController { } try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); boolean issuedDevIdOptionEnabled = policy.isIssueDevIdCertificate(); @@ -540,7 +540,7 @@ public class PolicyPageController extends PageController { } if (threshold == null || threshold.isEmpty()) { - threshold = SupplyChainSettings.YEAR; + threshold = PolicySettings.YEAR; } policy.setDevIdReissueThreshold(threshold); @@ -584,7 +584,7 @@ public class PolicyPageController extends PageController { = ppModel.getEcValidate().equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); //If PC Validation is enabled without EC Validation, disallow change if (!isPolicyValid(ecValidationOptionEnabled, policy.isPcValidationEnabled(), @@ -636,7 +636,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); //If firmware is enabled without PC attributes, disallow change if (firmwareValidationOptionEnabled && !policy.isPcAttributeValidationEnabled()) { @@ -692,7 +692,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); //If Ignore IMA is enabled without firmware, disallow change if (ignoreImaOptionEnabled && !policy.isFirmwareValidationEnabled()) { @@ -743,7 +743,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); //If Ignore TBoot is enabled without firmware, disallow change if (ignoreTbootOptionEnabled && !policy.isFirmwareValidationEnabled()) { @@ -794,7 +794,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); //If Ignore TBoot is enabled without firmware, disallow change if (ignoreGptOptionEnabled && !policy.isFirmwareValidationEnabled()) { @@ -847,7 +847,7 @@ public class PolicyPageController extends PageController { .equalsIgnoreCase(ENABLED_CHECKED_PARAMETER_VALUE); try { - SupplyChainSettings policy = getDefaultPolicyAndSetInModel(ppModel, model); + PolicySettings policy = getDefaultPolicyAndSetInModel(ppModel, model); //If Ignore TBoot is enabled without firmware, disallow change if (ignoreOsEvtOptionEnabled && !policy.isFirmwareValidationEnabled()) { @@ -918,12 +918,12 @@ public class PolicyPageController extends PageController { * * @return The default Supply Chain Policy */ - private SupplyChainSettings getDefaultPolicy() { - SupplyChainSettings defaultSettings = this.settingsService.getByName("Default"); + private PolicySettings getDefaultPolicy() { + PolicySettings defaultSettings = null;//this.policyRepository.findByName("Default"); - if (defaultSettings == null) { - defaultSettings = new SupplyChainSettings("Default", "Settings are configured for no validation flags set."); - } +// if (defaultSettings == null) { +// defaultSettings = new PolicySettings("Default", "Settings are configured for no validation flags set."); +// } return defaultSettings; } @@ -935,10 +935,10 @@ public class PolicyPageController extends PageController { * @param model the map of string messages to be displayed on the view * @return The default Supply Chain Policy */ - private SupplyChainSettings getDefaultPolicyAndSetInModel( + private PolicySettings getDefaultPolicyAndSetInModel( final PolicyPageModel ppModel, final Map model) { // load the current default policy from the DB - SupplyChainSettings policy = getDefaultPolicy(); + PolicySettings policy = getDefaultPolicy(); // set the data received to be populated back into the form model.put(RESULT_DATA, ppModel); @@ -948,9 +948,9 @@ public class PolicyPageController extends PageController { private void savePolicyAndApplySuccessMessage( final PolicyPageModel ppModel, final Map model, final PageMessages messages, final String successMessage, - final SupplyChainSettings settings) { + final PolicySettings settings) { // save the policy to the DB - settingsService.updateSettings(settings); + policyRepository.saveAndFlush(settings); // Log and set the success message messages.addSuccess(successMessage); diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java index 98554883..3d4fcb5a 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java @@ -1,16 +1,15 @@ package hirs.attestationca.portal.page.controllers; import hirs.attestationca.persist.DBServiceException; +import hirs.attestationca.persist.entity.manager.ReferenceManifestRepository; import hirs.attestationca.persist.entity.userdefined.ReferenceManifest; import hirs.attestationca.persist.entity.userdefined.certificate.CertificateAuthorityCredential; import hirs.attestationca.persist.entity.userdefined.rim.BaseReferenceManifest; import hirs.attestationca.persist.entity.userdefined.rim.EventLogMeasurements; import hirs.attestationca.persist.entity.userdefined.rim.ReferenceDigestValue; import hirs.attestationca.persist.entity.userdefined.rim.SupportReferenceManifest; -import hirs.attestationca.persist.service.CertificateService; -import hirs.attestationca.persist.service.ReferenceDigestValueService; +import hirs.attestationca.persist.service.CertificateServiceImpl; import hirs.attestationca.persist.service.ReferenceDigestValueServiceImpl; -import hirs.attestationca.persist.service.ReferenceManifestService; import hirs.attestationca.persist.service.ReferenceManifestServiceImpl; import hirs.attestationca.persist.service.SupplyChainValidationServiceImpl; import hirs.attestationca.persist.validation.ReferenceManifestValidator; @@ -52,28 +51,32 @@ import java.util.UUID; @RequestMapping("/rim-details") public class ReferenceManifestDetailsPageController extends PageController { - private final ReferenceManifestService referenceManifestManager; - private final ReferenceDigestValueService referenceEventManager; - private final CertificateService certificateService; + private final ReferenceManifestRepository referenceManifestRepository; +// private final ReferenceManifestServiceImpl referenceManifestManager; +// private final ReferenceDigestValueServiceImpl referenceEventManager; +// private final CertificateServiceImpl certificateService; private static final ReferenceManifestValidator RIM_VALIDATOR = new ReferenceManifestValidator(); /** * Constructor providing the Page's display and routing specification. * - * @param referenceManifestManager the reference manifest manager. - * @param referenceEventManager the reference event manager. - * @param certificateService the certificate manager. + * @param referenceManifestRepository the repository for RIM. +// * @param referenceManifestManager the reference manifest manager. +// * @param referenceEventManager the reference event manager. +// * @param certificateService the certificate manager. */ @Autowired - public ReferenceManifestDetailsPageController( - final ReferenceManifestServiceImpl referenceManifestManager, - final ReferenceDigestValueServiceImpl referenceEventManager, - final CertificateService certificateService) { + public ReferenceManifestDetailsPageController(final ReferenceManifestRepository referenceManifestRepository +// final ReferenceManifestServiceImpl referenceManifestManager, +// final ReferenceDigestValueServiceImpl referenceEventManager, +// final CertificateServiceImpl certificateService + ) { super(Page.RIM_DETAILS); - this.referenceManifestManager = referenceManifestManager; - this.referenceEventManager = referenceEventManager; - this.certificateService = certificateService; + this.referenceManifestRepository = referenceManifestRepository; +// this.referenceManifestManager = referenceManifestManager; +// this.referenceEventManager = referenceEventManager; +// this.certificateService = certificateService; } /** @@ -103,8 +106,10 @@ public class ReferenceManifestDetailsPageController extends PageController getRimDetailInfo(final UUID uuid, - final ReferenceManifestService referenceManifestManager, - final ReferenceDigestValueService referenceEventManager, - final CertificateService certificateManager) + final ReferenceManifestServiceImpl referenceManifestManager, + final ReferenceDigestValueServiceImpl referenceEventManager, + final CertificateServiceImpl certificateService) throws IOException, CertificateException, NoSuchAlgorithmException { HashMap data = new HashMap<>(); @@ -151,7 +156,7 @@ public class ReferenceManifestDetailsPageController extends PageController getBaseRimInfo( final BaseReferenceManifest baseRim, - final ReferenceManifestService referenceManifestManager, - final CertificateService certificateManager) + final ReferenceManifestServiceImpl referenceManifestManager, + final CertificateServiceImpl certificateService) throws IOException, CertificateException, NoSuchAlgorithmException { HashMap data = new HashMap<>(); @@ -292,13 +297,13 @@ public class ReferenceManifestDetailsPageController extends PageController certificates = - CertificateAuthorityCredential.select(certificateManager) + CertificateAuthorityCredential.select(certificateService) .getCertificates(); //Report invalid signature unless RIM_VALIDATOR validates it and cert path is valid data.put("signatureValid", false); for (CertificateAuthorityCredential cert : certificates) { SupplyChainValidationServiceImpl scvsImpl = - new SupplyChainValidationServiceImpl(certificateManager); + new SupplyChainValidationServiceImpl(certificateService); KeyStore keystore = scvsImpl.getCaChain(cert); if (RIM_VALIDATOR.validateXmlSignature(cert)) { try { @@ -339,7 +344,7 @@ public class ReferenceManifestDetailsPageController extends PageController getSupportRimInfo( final SupportReferenceManifest support, - final ReferenceManifestService referenceManifestManager) + final ReferenceManifestServiceImpl referenceManifestManager) throws IOException, CertificateException, NoSuchAlgorithmException { HashMap data = new HashMap<>(); EventLogMeasurements measurements = null; @@ -353,7 +358,7 @@ public class ReferenceManifestDetailsPageController extends PageController getMeasurementsRimInfo( final EventLogMeasurements measurements, - final ReferenceManifestService referenceManifestManager, - final ReferenceDigestValueService referenceEventManager) + final ReferenceManifestServiceImpl referenceManifestManager, + final ReferenceDigestValueServiceImpl referenceEventManager) throws IOException, CertificateException, NoSuchAlgorithmException { HashMap data = new HashMap<>(); LinkedList livelogEvents = new LinkedList<>(); @@ -543,7 +548,7 @@ public class ReferenceManifestDetailsPageController extends PageController { + private static final String LOG_FILE_PATTERN = "([^\\s]+(\\.(?i)(rimpcr|rimel|bin|log))$)"; + @Autowired(required = false) private EntityManager entityManager; - private final ReferenceManifestService referenceManifestManager; - private final ReferenceDigestValueService referenceEventManager; + private final ReferenceManifestRepository referenceManifestRepository; + private final ReferenceDigestValueRepository referenceDigestValueRepository; +// private final ReferenceManifestServiceImpl referenceManifestManager; +// private final ReferenceDigestValueServiceImpl referenceEventManager; /** * Constructor providing the Page's display and routing specification. * - * @param referenceManifestManager the reference manifest manager - * @param referenceEventManager this is the reference event manager + * @param referenceManifestRepository the reference manifest manager + * @param referenceDigestValueRepository this is the reference event manager */ @Autowired - public ReferenceManifestPageController( - final ReferenceManifestServiceImpl referenceManifestManager, - final ReferenceDigestValueServiceImpl referenceEventManager) { + public ReferenceManifestPageController(final ReferenceManifestRepository referenceManifestRepository, + final ReferenceDigestValueRepository referenceDigestValueRepository +// final ReferenceManifestServiceImpl referenceManifestManager, +// final ReferenceDigestValueServiceImpl referenceEventManager + ) { super(Page.REFERENCE_MANIFESTS); - this.referenceManifestManager = referenceManifestManager; - this.referenceEventManager = referenceEventManager; + this.referenceManifestRepository = referenceManifestRepository; + this.referenceDigestValueRepository = referenceDigestValueRepository; } /** @@ -111,10 +144,359 @@ public class ReferenceManifestPageController extends PageController records = OrderedListQueryDataTableAdapter.getOrderedList( ReferenceManifest.class, - referenceManifestManager, + null, input, orderColumnName, criteriaModifier); log.debug("Returning list of size: " + records.size()); return new DataTableResponse<>(records, input); } + + /** + * Upload and processes a reference manifest(s). + * + * @param files the files to process + * @param attr the redirection attributes + * @return the redirection view + * @throws URISyntaxException if malformed URI + * @throws Exception if malformed URI + */ + @RequestMapping(value = "/upload", method = RequestMethod.POST) + protected RedirectView upload( + @RequestParam("files") final MultipartFile[] files, + final RedirectAttributes attr) throws URISyntaxException, Exception { + Map model = new HashMap<>(); + PageMessages messages = new PageMessages(); + String fileName; + Pattern logPattern = Pattern.compile(LOG_FILE_PATTERN); + Matcher matcher; + boolean supportRIM = false; + List baseRims = new ArrayList<>(); + List supportRims = new ArrayList<>(); + + // loop through the files + for (MultipartFile file : files) { + fileName = file.getOriginalFilename(); + matcher = logPattern.matcher(fileName); + supportRIM = matcher.matches(); + + //Parse reference manifests + parseRIM(file, supportRIM, messages, baseRims, supportRims); + } + baseRims.stream().forEach((rim) -> { + log.info(String.format("Storing swidtag %s", rim.getFileName())); + storeManifest(messages, rim, false); + }); + supportRims.stream().forEach((rim) -> { + log.info(String.format("Storing event log %s", rim.getFileName())); + storeManifest(messages, rim, true); + }); + + // Prep a map to associated the swidtag payload hash to the swidtag. + // pass it in to update support rims that either were uploaded + // or already exist + // create a map of the supports rims in case an uploaded swidtag + // isn't one to one with the uploaded support rims. + Map updatedSupportRims + = updateSupportRimInfo(generatePayloadHashMap(baseRims)); + + // look for missing uploaded support rims +// for (SupportReferenceManifest support : supportRims) { +// if (!updatedSupportRims.containsKey(support.getHexDecHash())) { +// // Make sure we are getting the db version of the file +// updatedSupportRims.put(support.getHexDecHash(), +// SupportReferenceManifest +// .select(referenceManifestManager) +// .byHexDecHash(support.getHexDecHash()) +// .getRIM()); +// } +// } + + // pass in the updated support rims + // and either update or add the events + processTpmEvents(new ArrayList(updatedSupportRims.values())); + + //Add messages to the model + model.put(MESSAGES_ATTRIBUTE, messages); + + return redirectTo(Page.REFERENCE_MANIFESTS, + new NoPageParams(), model, attr); + } + + /** + * This method takes the parameter and looks for this information in the + * Database. + * + * @param id of the RIM + * @return the associated RIM from the DB + * @throws IllegalArgumentException + */ + private ReferenceManifest getRimFromDb(final String id) throws IllegalArgumentException { + UUID uuid = UUID.fromString(id); +// ReferenceManifest rim = BaseReferenceManifest.select(referenceManifestManager) +// .byEntityId(uuid).getRIM(); +// +// if (rim == null) { +// rim = SupportReferenceManifest.select(referenceManifestManager) +// .byEntityId(uuid).getRIM(); +// } +// +// if (rim == null) { +// rim = EventLogMeasurements.select(referenceManifestManager) +// .byEntityId(uuid).getRIM(); +// } + + return this.referenceManifestRepository.getReferenceById(uuid); + } + + /** + * Takes the rim files provided and returns a {@link ReferenceManifest} + * object. + * + * @param file the provide user file via browser. + * @param supportRIM matcher result + * @param messages the object that handles displaying information to the + * user. + * @param baseRims object to store multiple files + * @param supportRims object to store multiple files + * @return a single or collection of reference manifest files. + */ + private void parseRIM( + final MultipartFile file, final boolean supportRIM, + final PageMessages messages, final List baseRims, + final List supportRims) { + + byte[] fileBytes = new byte[0]; + String fileName = file.getOriginalFilename(); + + // build the manifest from the uploaded bytes + try { + fileBytes = file.getBytes(); + } catch (IOException e) { + final String failMessage + = String.format("Failed to read uploaded file (%s): ", fileName); + log.error(failMessage, e); + messages.addError(failMessage + e.getMessage()); + } + + try { + if (supportRIM) { + supportRims.add(new SupportReferenceManifest(fileName, fileBytes)); + } else { + baseRims.add(new BaseReferenceManifest(fileName, fileBytes)); + } + } catch (IOException ioEx) { + final String failMessage + = String.format("Failed to parse uploaded file (%s): ", fileName); + log.error(failMessage, ioEx); + messages.addError(failMessage + ioEx.getMessage()); + } + } + + /** + * Stores the {@link ReferenceManifest} objects. + * + * @param messages message object for user display of statuses + * @param referenceManifest the object to store + * @param supportRim boolean flag indicating if this is a support RIM + * process. + */ + private void storeManifest( + final PageMessages messages, + final ReferenceManifest referenceManifest, + final boolean supportRim) { + + ReferenceManifest existingManifest = null; + String fileName = referenceManifest.getFileName(); + MessageDigest digest = null; + String rimHash = ""; + try { + digest = MessageDigest.getInstance("SHA-256"); + } catch (NoSuchAlgorithmException noSaEx) { + log.error(noSaEx); + } + + // look for existing manifest in the database + try { + if (supportRim) { + if (digest != null) { + rimHash = Hex.encodeHexString( + digest.digest(referenceManifest.getRimBytes())); + } + existingManifest = referenceManifestRepository.findByHash(rimHash, ReferenceManifest.SUPPORT_RIM); +// SupportReferenceManifest +// .select(referenceManifestManager) +// .byHexDecHash(rimHash) +// .includeArchived() +// .getRIM(); + } else { + if (digest != null) { + rimHash = Base64.encodeBase64String( + digest.digest(referenceManifest.getRimBytes())); + } + existingManifest = referenceManifestRepository.findByHash(rimHash, ReferenceManifest.BASE_RIM); +// BaseReferenceManifest +// .select(referenceManifestManager).byBase64Hash(rimHash) +// .includeArchived() +// .getRIM(); + } + } catch (DBManagerException dbMEx) { + final String failMessage = String.format("Querying for existing certificate " + + "failed (%s): ", fileName); + messages.addError(failMessage + dbMEx.getMessage()); + log.error(failMessage, dbMEx); + } + + try { + // save the new certificate if no match is found + if (existingManifest == null) { + referenceManifestRepository.save(referenceManifest); + + final String successMsg = String.format("RIM successfully uploaded (%s): ", + fileName); + messages.addSuccess(successMsg); + log.info(successMsg); + } + } catch (DBManagerException dbmEx) { + final String failMessage = String.format("Storing RIM failed (%s): ", + fileName); + messages.addError(failMessage + dbmEx.getMessage()); + log.error(failMessage, dbmEx); + } + + try { + // if an identical RIM is archived, update the existing RIM to + // unarchive it and change the creation date + if (existingManifest != null && existingManifest.isArchived()) { + existingManifest.restore(); + existingManifest.resetCreateTime(); + referenceManifestRepository.save(existingManifest); + + final String successMsg + = String.format("Pre-existing RIM found and unarchived (%s): ", fileName); + messages.addSuccess(successMsg); + log.info(successMsg); + } + } catch (DBManagerException dbmEx) { + final String failMessage = String.format("Found an identical pre-existing RIM in the " + + "archive, but failed to unarchive it (%s): ", fileName); + messages.addError(failMessage + dbmEx.getMessage()); + log.error(failMessage, dbmEx); + } + } + + private Map generatePayloadHashMap( + final List uploadedBaseRims) { + BaseReferenceManifest dbBaseRim; + HashMap tempMap = new HashMap<>(); + for (BaseReferenceManifest base : uploadedBaseRims) { + // this is done to make sure we have the version with the UUID + dbBaseRim = (BaseReferenceManifest) referenceManifestRepository.findByHash(base.getBase64Hash(), ReferenceManifest.BASE_RIM); +// BaseReferenceManifest.select(referenceManifestManager) +// .byBase64Hash(base.getBase64Hash()).getRIM(); + if (dbBaseRim != null) { + for (SwidResource swid : dbBaseRim.parseResource()) { + tempMap.put(swid.getHashValue(), dbBaseRim); + } + } + } + + return tempMap; + } + + private Map updateSupportRimInfo( + final Map dbBaseRims) { + BaseReferenceManifest dbBaseRim; + SupportReferenceManifest supportRim; + Map updatedSupportRims = new HashMap<>(); + List hashValues = new LinkedList<>(dbBaseRims.keySet()); + for (String supportHash : hashValues) { + supportRim = (SupportReferenceManifest) referenceManifestRepository.findByHash(supportHash, ReferenceManifest.SUPPORT_RIM); +// SupportReferenceManifest.select(referenceManifestManager) +// .byHexDecHash(supportHash).getRIM(); + // I have to assume the baseRim is from the database + // Updating the id values, manufacturer, model + if (supportRim != null && !supportRim.isUpdated()) { + dbBaseRim = dbBaseRims.get(supportHash); + supportRim.setSwidTagVersion(dbBaseRim.getSwidTagVersion()); + supportRim.setPlatformManufacturer(dbBaseRim.getPlatformManufacturer()); + supportRim.setPlatformModel(dbBaseRim.getPlatformModel()); + supportRim.setTagId(dbBaseRim.getTagId()); + supportRim.setAssociatedRim(dbBaseRim.getId()); + supportRim.setUpdated(true); + referenceManifestRepository.save(supportRim); + updatedSupportRims.put(supportHash, supportRim); + } + } + + return updatedSupportRims; + } + + /** + * If the support rim is a supplemental or base, this method looks for the + * original oem base rim to associate with each event. + * @param supportRim assumed db object + * @return reference to the base rim + */ + private ReferenceManifest findBaseRim(final SupportReferenceManifest supportRim) { + if (supportRim != null && (supportRim.getId() != null + && !supportRim.getId().toString().equals(""))) { + List baseRims = this.referenceManifestRepository.getBaseByManufacturerModel(supportRim.getPlatformManufacturer(), supportRim.getPlatformModel()); +// Set baseRims = BaseReferenceManifest +// .select(referenceManifestManager) +// .byManufacturerModel(supportRim.getPlatformManufacturer(), +// supportRim.getPlatformModel()).getRIMs(); + + for (BaseReferenceManifest base : baseRims) { + if (base.isBase()) { + // there should be only one + return base; + } + } + } + return null; + } + + private void processTpmEvents(final List dbSupportRims) { + List tpmEvents; + TCGEventLog logProcessor = null; + ReferenceManifest baseRim; + + for (SupportReferenceManifest dbSupport : dbSupportRims) { + // So first we'll have to pull values based on support rim + // get by support rim id NEXT + + if (dbSupport.getPlatformManufacturer() != null) { + tpmEvents = referenceDigestValueRepository.getValuesBySupportRimId(dbSupport.getAssociatedRim()); + baseRim = findBaseRim(dbSupport); + if (tpmEvents.isEmpty()) { + ReferenceDigestValue rdv; + try { + logProcessor = new TCGEventLog(dbSupport.getRimBytes()); + for (TpmPcrEvent tpe : logProcessor.getEventList()) { + rdv = new ReferenceDigestValue(baseRim.getId(), + dbSupport.getId(), dbSupport.getPlatformManufacturer(), + dbSupport.getPlatformModel(), tpe.getPcrIndex(), + tpe.getEventDigestStr(), tpe.getEventTypeStr(), + false, false, true, tpe.getEventContent()); + + this.referenceDigestValueRepository.save(rdv); + } + } catch (CertificateException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + for (ReferenceDigestValue rdv : tpmEvents) { + if (!rdv.isUpdated()) { + rdv.updateInfo(dbSupport, baseRim.getId()); + this.referenceDigestValueRepository.save(rdv); + } + } + } + } + } + } } diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RestfulAttestationCertificateAuthority.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RestfulAttestationCertificateAuthority.java new file mode 100644 index 00000000..74213318 --- /dev/null +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RestfulAttestationCertificateAuthority.java @@ -0,0 +1,35 @@ +package hirs.attestationca.portal.page.controllers; + +/** + * Restful implementation of the {@link }. + * Exposes the ACA methods as REST endpoints. + */ +//@RestController +//@RequestMapping("/") +public class RestfulAttestationCertificateAuthority { +// private final ReferenceManifestRepository referenceManifestRepository; +// private final ReferenceDigestValueRepository referenceDigestValueRepository; +// +// @Autowired +// public RestfulAttestationCertificateAuthority( +// final ReferenceManifestRepository referenceManifestRepository, +// final ReferenceDigestValueRepository referenceDigestValueRepository) { +// +// this.referenceManifestRepository = referenceManifestRepository; +// this.referenceDigestValueRepository = referenceDigestValueRepository; +// +// } +// +// +// @ResponseBody +// @RequestMapping(value = "/upload-swidtag", method = RequestMethod.POST, consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE) +// public byte[] uploadSwidtag(@RequestBody final byte[] request) { +// return null; +// } +// +// @ResponseBody +// @RequestMapping(value = "/upload-rimel", method = RequestMethod.POST, consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE) +// public byte[] uploadRimel(@RequestBody final byte[] request) { +// return null; +// } +} diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java index a8f15e9f..55c73574 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java @@ -1,17 +1,14 @@ package hirs.attestationca.portal.page.controllers; +import hirs.attestationca.persist.entity.manager.ReferenceDigestValueRepository; import hirs.attestationca.persist.entity.userdefined.rim.ReferenceDigestValue; -import hirs.attestationca.persist.service.ReferenceDigestValueService; -import hirs.attestationca.persist.service.ReferenceDigestValueServiceImpl; -import hirs.attestationca.persist.service.ReferenceManifestService; -import hirs.attestationca.persist.service.ReferenceManifestServiceImpl; +import hirs.attestationca.portal.datatables.DataTableInput; import hirs.attestationca.portal.page.Page; import hirs.attestationca.portal.page.PageController; import hirs.attestationca.portal.page.params.NoPageParams; import jakarta.validation.Valid; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.jpa.datatables.mapping.DataTablesInput; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -30,21 +27,24 @@ import java.util.List; @RequestMapping("/rim-database") public class RimDatabasePageController extends PageController { - private final ReferenceManifestService referenceManifestManager; - private final ReferenceDigestValueService referenceEventManager; + private final ReferenceDigestValueRepository referenceDigestValueRepository; +// private final ReferenceManifestServiceImpl referenceManifestManager; +// private final ReferenceDigestValueServiceImpl referenceEventManager; /** * Constructor providing the Page's display and routing specification. * - * @param referenceManifestManager the ReferenceManifestManager object - * @param referenceEventManager the referenceEventManager object + * @param referenceDigestValueRepository the referenceDigestValueRepository object +// * @param referenceEventManager the referenceEventManager object */ @Autowired - public RimDatabasePageController(final ReferenceManifestServiceImpl referenceManifestManager, - final ReferenceDigestValueServiceImpl referenceEventManager) { + public RimDatabasePageController(final ReferenceDigestValueRepository referenceDigestValueRepository +// , final ReferenceManifestServiceImpl referenceManifestManager, +// final ReferenceDigestValueServiceImpl referenceEventManager + ) { super(Page.RIM_DATABASE); - this.referenceManifestManager = referenceManifestManager; - this.referenceEventManager = referenceEventManager; + this.referenceDigestValueRepository = referenceDigestValueRepository; +// this.referenceEventManager = referenceEventManager; } /** @@ -74,10 +74,10 @@ public class RimDatabasePageController extends PageController { produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) public List getTableData( - @Valid final DataTablesInput input) { + @Valid final DataTableInput input) { log.info("Handling request for summary list: " + input); - return this.referenceEventManager.fetchDigestValues(); + return this.referenceDigestValueRepository.listAll(); // String orderColumnName = input.getOrderColumnName(); diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/CertificateStringMapBuilder.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/CertificateStringMapBuilder.java index b5b84130..d2bca2cb 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/CertificateStringMapBuilder.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/CertificateStringMapBuilder.java @@ -56,11 +56,11 @@ public final class CertificateStringMapBuilder { * Returns the Certificate Authority information. * * @param uuid ID for the certificate. - * @param certificateServiceImpl the certificate manager for retrieving certs. + * @param certificateService the certificate manager for retrieving certs. * @return a hash map with the endorsement certificate information. */ public static HashMap getCertificateAuthorityInformation(final UUID uuid, - final CertificateServiceImpl certificateServiceImpl) { + final CertificateServiceImpl certificateService) { // CertificateAuthorityCredential certificate = // CertificateAuthorityCredential // .select(certificateManager) @@ -77,12 +77,12 @@ public final class CertificateStringMapBuilder { * Returns the Trust Chain credential information. * * @param certificate the certificate - * @param certificateServiceImpl the certificate manager for retrieving certs. + * @param certificateService the certificate manager for retrieving certs. * @return a hash map with the endorsement certificate information. */ public static HashMap getCertificateAuthorityInformation( final CertificateAuthorityCredential certificate, - final CertificateServiceImpl certificateServiceImpl) { + final CertificateServiceImpl certificateService) { // return getCertificateAuthorityInfoHelper(certificateManager, certificate, // "No cert provided for mapping"); return null; @@ -100,11 +100,11 @@ public final class CertificateStringMapBuilder { * Returns the endorsement credential information. * * @param uuid ID for the certificate. - * @param certificateServiceImpl the certificate manager for retrieving certs. + * @param certificateService the certificate manager for retrieving certs. * @return a hash map with the endorsement certificate information. */ public static HashMap getEndorsementInformation(final UUID uuid, - final CertificateServiceImpl certificateServiceImpl) { + final CertificateServiceImpl certificateService) { HashMap data = new HashMap<>(); return data; @@ -114,13 +114,13 @@ public final class CertificateStringMapBuilder { * Returns the Platform credential information. * * @param uuid ID for the certificate. - * @param certificateServiceImpl the certificate manager for retrieving certs. + * @param certificateService the certificate manager for retrieving certs. * @return a hash map with the endorsement certificate information. * @throws IOException when parsing the certificate * @throws IllegalArgumentException invalid argument on parsing the certificate */ public static HashMap getPlatformInformation(final UUID uuid, - final CertificateServiceImpl certificateServiceImpl) + final CertificateServiceImpl certificateService) throws IllegalArgumentException, IOException { HashMap data = new HashMap<>(); @@ -158,11 +158,11 @@ public final class CertificateStringMapBuilder { * Returns the Issued Attestation Certificate information. * * @param uuid ID for the certificate. - * @param certificateServiceImpl the certificate manager for retrieving certs. + * @param certificateService the certificate manager for retrieving certs. * @return a hash map with the endorsement certificate information. */ public static HashMap getIssuedInformation(final UUID uuid, - final CertificateServiceImpl certificateServiceImpl) { + final CertificateServiceImpl certificateService) { HashMap data = new HashMap<>(); return data; diff --git a/HIRS_AttestationCAPortal/src/main/resources/application.properties b/HIRS_AttestationCAPortal/src/main/resources/application.properties index 6da0b806..9a86a663 100644 --- a/HIRS_AttestationCAPortal/src/main/resources/application.properties +++ b/HIRS_AttestationCAPortal/src/main/resources/application.properties @@ -1,18 +1,22 @@ - server.error.path=/error +spring.http.multipart=true +spring.http.multipart.max-file-size=-1 spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.suffix=.jsp -logging.level.org.springframework=INFO +spring.servlet.multipart.max-file-size=1MB +spring.servlet.multipart.max-request-size=1MB +spring.servlet.multipart.enabled=true +spring.servlet.multipart.location=${java.io.tmpdir} + +logging.level.org.springframework=WARN spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=false +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.url=jdbc:mariadb://localhost:3306/hirs_db?autoReconnect=true&useSSL=false spring.datasource.username=hirs_db spring.datasource.password=hirs_db -jakarta.persistence.sharedCache.mode = UNSPECIFIED - -spring.datasource.driver-class-name=org.mariadb.jdbc.Driver -#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver +jakarta.persistence.sharedCache.mode=UNSPECIFIED server.tomcat.accesslog.enabled=true server.tomcat.accesslog.directory=logs diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/tags/page.tag b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/tags/page.tag index 2a614114..bacdde8e 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/tags/page.tag +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/tags/page.tag @@ -40,8 +40,8 @@ - - + + <%-- page-specific style --%> diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/web.xml b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/web.xml index 46d1ca44..2b213692 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/web.xml +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/web.xml @@ -10,10 +10,10 @@ - - log4j.configurationFile - classpath:log4j2-spring.xml - + + + +