From 7bfcbe2c63f0fed7b434de233f74c6b5b0c1b0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ce=C4=BEuch?= Date: Mon, 18 Nov 2024 14:00:08 +0100 Subject: [PATCH] Autogram core refactor (#11) * wip * add core submodule * working multi module setup * clean up run configuretions in idea * working docker image * update core commit * add tests to GH workflow * revert GH tests for now * update build * update envs and readme * update api description * fix examples in swagger * update core signature intact * Update .gitlab-ci.yml file * Update .gitlab-ci.yml file * Update .gitmodules * rm unnecessary build files * add deprecated /sign endpoint for avm-server --- .dockerignore | 7 + .gitlab-ci.yml | 2 + .gitmodules | 3 + .idea/compiler.xml | 7 +- .idea/encodings.xml | 7 - .idea/inspectionProfiles/Project_Default.xml | 8 - .idea/jarRepositories.xml | 20 - .idea/misc.xml | 5 +- .../Autogram_Service_Main.xml | 10 + .idea/uiDesigner.xml | 124 ---- .idea/vcs.xml | 6 - .project | 8 +- .run/Main.run.xml | 13 - .vscode/launch.json | 4 +- Dockerfile | 23 +- README.md | 28 +- core | 1 + pom.xml | 466 +----------- service/pom.xml | 411 +++++++++++ .../slovensko/autogram/service}/App.java | 58 +- .../autogram/service/AutogramService.java | 73 ++ .../DeprecatedSignedDocumentAPIResponder.java | 30 + .../slovensko/autogram/service}/Main.java | 4 +- .../slovensko/autogram/service/Server.java | 92 +++ .../dto/BuildSignatureRequestBody.java | 7 + .../service/dto/DataToSignRequestBody.java | 6 + .../dto/DeprecatedSignedDocumentResponse.java | 26 + .../endpoints/BuildSignatureEndpoint.java | 33 + .../service/endpoints/DataToSignEndpoint.java | 31 + .../endpoints/DeprecatedSignEndpoint.java | 33 + .../endpoints/VisualizationEndpoint.java | 34 + .../slovensko/autogram/service}/server.yml | 149 ++-- {src => service/src}/main/scripts/bin.xml | 0 .../java/digital/slovensko/avm/core/AVM.java | 82 --- .../slovensko/avm/core/AutogramMimeType.java | 60 -- .../avm/core/DataToSignStructure.java | 3 - .../core/DocumentVisualizationBuilder.java | 102 --- .../avm/core/SignatureValidator.java | 209 ------ .../slovensko/avm/core/SignedDocument.java | 22 - .../slovensko/avm/core/SigningJob.java | 158 ---- .../slovensko/avm/core/SigningParameters.java | 274 ------- .../slovensko/avm/core/ValidationReports.java | 25 - .../avm/core/dto/ReportsAndValidator.java | 7 - .../avm/core/eforms/EFormResources.java | 74 -- .../core/eforms/EFormResourcesBuilder.java | 108 --- .../slovensko/avm/core/eforms/EFormUtils.java | 503 ------------- .../avm/core/eforms/FsEFormResources.java | 183 ----- .../avm/core/eforms/OrsrEFormResources.java | 46 -- .../avm/core/eforms/UpvsEFormResources.java | 76 -- .../avm/core/eforms/dto/EFormAttributes.java | 63 -- .../core/eforms/dto/ManifestXsltEntry.java | 6 - .../avm/core/eforms/dto/XsltParams.java | 5 - .../avm/core/eforms/xdc/XDCBuilder.java | 199 ----- .../avm/core/eforms/xdc/XDCValidator.java | 105 --- .../avm/core/errors/AutogramException.java | 64 -- ...graphicSignatureVerificationException.java | 7 - .../errors/DataToSignMismatchException.java | 7 - .../errors/DocumentNotSignedYetException.java | 7 - .../avm/core/errors/EFormException.java | 11 - .../avm/core/errors/EmptyBodyException.java | 9 - .../EmptyDirectorySelectedException.java | 7 - .../errors/FailedVisualizationException.java | 12 - .../core/errors/MalformedBodyException.java | 13 - ...ltipleOriginalDocumentsFoundException.java | 8 - .../OriginalDocumentNotFoundException.java | 8 - .../core/errors/PDFAComplianceException.java | 7 - .../PDFSignatureLevelIsNotValidException.java | 11 - .../errors/RequestValidationException.java | 9 - .../errors/ResponseNetworkErrorException.java | 7 - .../errors/SigningParametersException.java | 11 - ...igningWithExpiredCertificateException.java | 7 - .../core/errors/TransformationException.java | 11 - .../TransformationParsingErrorException.java | 7 - .../TsaServerMisconfiguredException.java | 7 - .../core/errors/UnknownEformException.java | 7 - .../core/errors/UnrecognizedException.java | 7 - .../UnsupportedSignatureLevelException.java | 10 - .../core/errors/XMLValidationException.java | 11 - .../slovensko/avm/server/EndpointUtils.java | 47 -- .../digital/slovensko/avm/server/Server.java | 72 -- .../avm/server/dto/DataToSignRequestBody.java | 4 - .../slovensko/avm/server/dto/Document.java | 31 - .../avm/server/dto/DocumentResponse.java | 16 - .../avm/server/dto/ErrorResponse.java | 51 -- .../avm/server/dto/ErrorResponseBody.java | 13 - .../avm/server/dto/InfoResponse.java | 13 - .../server/dto/OriginalSignRequestBody.java | 93 --- .../server/dto/ServerSigningParameters.java | 328 --------- .../avm/server/dto/SignRequestBody.java | 6 - .../avm/server/dto/SignResponse.java | 4 - .../avm/server/dto/SignerRecord.java | 4 - .../avm/server/dto/ValidationResponse.java | 4 - .../server/dto/ValidationResponseBody.java | 166 ----- .../server/endpoints/DataToSignEndpoint.java | 43 -- .../endpoints/DocumentationEndpoint.java | 26 - .../avm/server/endpoints/InfoEndpoint.java | 24 - .../avm/server/endpoints/SignEndpoint.java | 44 -- .../endpoints/ValidateParametersEndpoint.java | 36 - .../server/endpoints/ValidationEndpoint.java | 52 -- .../endpoints/VisualizationEndpoint.java | 44 -- .../server/filters/AutogramCorsFilter.java | 59 -- .../avm/util/AsicContainerUtils.java | 104 --- .../digital/slovensko/avm/util/DSSUtils.java | 71 -- .../digital/slovensko/avm/util/PDFUtils.java | 25 - .../digital/slovensko/avm/util/XMLUtils.java | 40 - .../digital/slovensko/avm/build.properties | 73 -- .../avm/core/eforms/xmldatacontainer.xsd | 362 --------- .../slovensko/avm/core/lotlKeyStore.p12 | Bin 14982 -> 0 bytes .../avm/core/simple-report-bootstrap4.xslt | 685 ------------------ .../avm/core/simple-report-template.html | 19 - .../slovensko/avm/server/endpoints/index.html | 30 - src/main/scripts/package.sh | 46 -- src/main/scripts/resources/.keep | 0 113 files changed, 994 insertions(+), 5945 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitmodules delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/runConfigurations/Autogram_Service_Main.xml delete mode 100644 .idea/uiDesigner.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .run/Main.run.xml create mode 160000 core create mode 100644 service/pom.xml rename {src/main/java/digital/slovensko/avm/core => service/src/main/java/digital/slovensko/autogram/service}/App.java (62%) create mode 100644 service/src/main/java/digital/slovensko/autogram/service/AutogramService.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/DeprecatedSignedDocumentAPIResponder.java rename {src/main/java/digital/slovensko/avm => service/src/main/java/digital/slovensko/autogram/service}/Main.java (58%) create mode 100644 service/src/main/java/digital/slovensko/autogram/service/Server.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/dto/BuildSignatureRequestBody.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/dto/DataToSignRequestBody.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/dto/DeprecatedSignedDocumentResponse.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/endpoints/BuildSignatureEndpoint.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/endpoints/DataToSignEndpoint.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/endpoints/DeprecatedSignEndpoint.java create mode 100644 service/src/main/java/digital/slovensko/autogram/service/endpoints/VisualizationEndpoint.java rename {src/main/resources/digital/slovensko/avm/server/endpoints => service/src/main/resources/digital/slovensko/autogram/service}/server.yml (80%) rename {src => service/src}/main/scripts/bin.xml (100%) delete mode 100644 src/main/java/digital/slovensko/avm/core/AVM.java delete mode 100644 src/main/java/digital/slovensko/avm/core/AutogramMimeType.java delete mode 100644 src/main/java/digital/slovensko/avm/core/DataToSignStructure.java delete mode 100644 src/main/java/digital/slovensko/avm/core/DocumentVisualizationBuilder.java delete mode 100644 src/main/java/digital/slovensko/avm/core/SignatureValidator.java delete mode 100644 src/main/java/digital/slovensko/avm/core/SignedDocument.java delete mode 100644 src/main/java/digital/slovensko/avm/core/SigningJob.java delete mode 100644 src/main/java/digital/slovensko/avm/core/SigningParameters.java delete mode 100644 src/main/java/digital/slovensko/avm/core/ValidationReports.java delete mode 100644 src/main/java/digital/slovensko/avm/core/dto/ReportsAndValidator.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/EFormResources.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/EFormResourcesBuilder.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/EFormUtils.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/FsEFormResources.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/OrsrEFormResources.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/UpvsEFormResources.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/dto/EFormAttributes.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/dto/ManifestXsltEntry.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/dto/XsltParams.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/xdc/XDCBuilder.java delete mode 100644 src/main/java/digital/slovensko/avm/core/eforms/xdc/XDCValidator.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/AutogramException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/CryptographicSignatureVerificationException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/DataToSignMismatchException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/DocumentNotSignedYetException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/EFormException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/EmptyBodyException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/EmptyDirectorySelectedException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/FailedVisualizationException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/MalformedBodyException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/MultipleOriginalDocumentsFoundException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/OriginalDocumentNotFoundException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/PDFAComplianceException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/PDFSignatureLevelIsNotValidException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/RequestValidationException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/ResponseNetworkErrorException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/SigningParametersException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/SigningWithExpiredCertificateException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/TransformationException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/TransformationParsingErrorException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/TsaServerMisconfiguredException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/UnknownEformException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/UnrecognizedException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/UnsupportedSignatureLevelException.java delete mode 100644 src/main/java/digital/slovensko/avm/core/errors/XMLValidationException.java delete mode 100644 src/main/java/digital/slovensko/avm/server/EndpointUtils.java delete mode 100644 src/main/java/digital/slovensko/avm/server/Server.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/DataToSignRequestBody.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/Document.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/DocumentResponse.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/ErrorResponse.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/ErrorResponseBody.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/InfoResponse.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/OriginalSignRequestBody.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/ServerSigningParameters.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/SignRequestBody.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/SignResponse.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/SignerRecord.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/ValidationResponse.java delete mode 100644 src/main/java/digital/slovensko/avm/server/dto/ValidationResponseBody.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/DataToSignEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/DocumentationEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/InfoEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/SignEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/ValidateParametersEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/ValidationEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/endpoints/VisualizationEndpoint.java delete mode 100644 src/main/java/digital/slovensko/avm/server/filters/AutogramCorsFilter.java delete mode 100644 src/main/java/digital/slovensko/avm/util/AsicContainerUtils.java delete mode 100644 src/main/java/digital/slovensko/avm/util/DSSUtils.java delete mode 100644 src/main/java/digital/slovensko/avm/util/PDFUtils.java delete mode 100644 src/main/java/digital/slovensko/avm/util/XMLUtils.java delete mode 100644 src/main/resources/digital/slovensko/avm/build.properties delete mode 100644 src/main/resources/digital/slovensko/avm/core/eforms/xmldatacontainer.xsd delete mode 100644 src/main/resources/digital/slovensko/avm/core/lotlKeyStore.p12 delete mode 100644 src/main/resources/digital/slovensko/avm/core/simple-report-bootstrap4.xslt delete mode 100644 src/main/resources/digital/slovensko/avm/core/simple-report-template.html delete mode 100644 src/main/resources/digital/slovensko/avm/server/endpoints/index.html delete mode 100644 src/main/scripts/package.sh delete mode 100644 src/main/scripts/resources/.keep diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f17d63e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.mvn/wrapper/maven-wrapper.jar +.idea +.git +.github +.gitlab +.gitlab-ci.yml +.vscode diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7390642..818c43f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,8 @@ variables: DOCKER_BUILDKIT: 0 AUTO_DEVOPS_BUILD_CACHE: registry AUTO_DEPLOY_IMAGE_VERSION: 'v2.47.0' + GIT_SUBMODULE_STRATEGY: recursive + GIT_SUBMODULE_FORCE_HTTPS: "true" stages: - build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..57bee33 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "core"] + path = core + url = http://github.com/slovensko-digital/autogram-core.git diff --git a/.idea/compiler.xml b/.idea/compiler.xml index cec49c8..5dcb74d 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -6,14 +6,15 @@ - + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index aa00ffa..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index c5b0955..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 712ab9d..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 12627dd..d48cce2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,9 +5,10 @@ -