diff --git a/.gitignore b/.gitignore
index bce8da6..093b679 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,10 +10,12 @@
/sacerws-ejb/nbproject/
/nbactions.xml
/sacerws-ejb/nbproject/project.properties
-.idea/
+/**/.idea/
.project
/**/.classpath
/**/.project
/**/*.iml
/**/*.factorypath
-.vscode/
\ No newline at end of file
+.vscode/
+/**/xaDiskHome
+.idea/*
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 0000000..bf82ff0
Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..dc3affc
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d722ba1..8826142 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,162 @@
+## 5.2.0 (06-05-2024)
+
+### Bugfix: 3
+- [#32027](https://parermine.regione.emilia-romagna.it/issues/32027) Aggiornamento metadati: errore 666 se si tenta di aggiornare i Dati Specifici dei componenti
+- [#31821](https://parermine.regione.emilia-romagna.it/issues/31821) Correzione gestione data scadenza in caso di "certificato scaduto" (verifica firma eidas)
+- [#31285](https://parermine.regione.emilia-romagna.it/issues/31285) Correzione messaggio di errore di aggiornamento metadati
+
+### Novità: 2
+- [#31672](https://parermine.regione.emilia-romagna.it/issues/31672) Introduzione TAG "temporany" su bucket staging (con lifecycle)
+- [#29276](https://parermine.regione.emilia-romagna.it/issues/29276) Salvataggio diretto su OS di Aggiornamento metadati UD
+
+## 5.1.0 (04-04-2024)
+
+### Bugfix: 3
+- [#31300](https://parermine.regione.emilia-romagna.it/issues/31300) Aggiornamento metadati: errore 666 se si tenta di aggiornare i componenti
+- [#31297](https://parermine.regione.emilia-romagna.it/issues/31297) Risoluzione errore 666 per AggiuntaAllegatiSync in caso di mancanza tag opzionale Configurazione
+- [#29906](https://parermine.regione.emilia-romagna.it/issues/29906) Correzione della mancata gestione dell'errore per dati specifici che non coincidono con l'XSD
+
+## 5.0.0 (12-02-2024)
+
+### Novità: 1
+- [#30800](https://parermine.regione.emilia-romagna.it/issues/30800) Aggiornamento a Spring 5
+
+## 4.14.0 (29-01-2024)
+
+### Novità: 1
+- [#31011](https://parermine.regione.emilia-romagna.it/issues/31011) Aggiornamento libreria DSS 5.13
+
+## 4.13.0 (05-12-2023)
+
+### Bugfix: 1
+- [#30753](https://parermine.regione.emilia-romagna.it/issues/30753) Correzione su aggiornamento informazioni certification authority
+
+### Novità: 2
+- [#30849](https://parermine.regione.emilia-romagna.it/issues/30849) Creazione endpoint con informazioni sulla versione
+- [#30718](https://parermine.regione.emilia-romagna.it/issues/30718) Eliminazione gestione persistenza di oggetti "raw" (base64) presenti su report EIDAS/CRYPTO
+
+## 4.12.0 (22-11-2023)
+
+### Bugfix: 1
+- [#30887](https://parermine.regione.emilia-romagna.it/issues/30887) Correzione bug mancato salvataggio sessioni di versamento aggiunta documenti
+
+### Novità: 4
+- [#30155](https://parermine.regione.emilia-romagna.it/issues/30155) Miglioramento della rappresentazione degli esiti dei controlli di revoca del certificato
+- [#30037](https://parermine.regione.emilia-romagna.it/issues/30037) Gestione dell'errore: Rapporto versamento non disponibile
+- [#29958](https://parermine.regione.emilia-romagna.it/issues/29958) Utilizzo degli EJB nella parte di aggiornamento metadati
+- [#29613](https://parermine.regione.emilia-romagna.it/issues/29613) Rimozione della libreria esterna sacer-jpa
+
+## 4.11.1 (05-10-2023)
+
+### Bugfix: 1
+- [#30617](https://parermine.regione.emilia-romagna.it/issues/30617) Correzione configurazione per ripristino della versione 1.11.1 di Eidas
+
+## 4.11.0 (03-10-2023)
+
+### Novità: 4
+- [#30236](https://parermine.regione.emilia-romagna.it/issues/30236) Ripristino della versione 1.11.1 di Eidas
+- [#30089](https://parermine.regione.emilia-romagna.it/issues/30089) Revisione partizionamenti aggiornamento metadati: aggiunta gestione campi per partizionamento
+- [#29834](https://parermine.regione.emilia-romagna.it/issues/29834) Attività per la realizzazione della separazione delle sessioni: parte scrittura
+- [#28309](https://parermine.regione.emilia-romagna.it/issues/28309) Servizio aggiornamento metadati: possibilità di eliminare l'elemento DatiSpecifici
+
+## 4.10.1 (13-09-2023)
+
+### Bugfix: 1
+- [#30211](https://parermine.regione.emilia-romagna.it/issues/30211) Downgrade alla versione 1.10.0 di Eidas
+
+## 4.10.0 (16-08-2023)
+
+### Bugfix: 1
+- [#30052](https://parermine.regione.emilia-romagna.it/issues/30052) Correzione su regressione parsing del report di verifica firma EIDAS-DSS 5.12
+
+### Novità: 2
+- [#29881](https://parermine.regione.emilia-romagna.it/issues/29881) Aggiornamento alle versione 5.12 della libreria DSS
+- [#29827](https://parermine.regione.emilia-romagna.it/issues/29827) Introduzione di tag sui versamenti non andati a buon fine per la definizione di politiche di retention
+
+## 4.9.0 (03-08-2023)
+
+### Novità: 1
+- [#29661](https://parermine.regione.emilia-romagna.it/issues/29661) Aggiornamento librerie obsolete 2023
+
+## 4.8.0 (13-07-2023)
+
+### Bugfix: 1
+- [#29615](https://parermine.regione.emilia-romagna.it/issues/29615) Correzione errata valorizzazione del TipoRiferimentoTemporaleUsato in caso di verifica Crypto effettuata alla data di firma se il documento è privo di data di firma
+
+### Novità: 1
+- [#26423](https://parermine.regione.emilia-romagna.it/issues/26423) Servizio di Aggiornamento UD: aggiungere profilo normativo
+
+## 4.7.1 (15-06-2023)
+
+### Bugfix: 3
+- [#29761](https://parermine.regione.emilia-romagna.it/issues/29761) Correzione salvataggio evidenze di conservazione su versamento fascicolo 1.1 e 1.0
+- [#29645](https://parermine.regione.emilia-romagna.it/issues/29645) Correzione di un bug in fase di versamento
+- [#29457](https://parermine.regione.emilia-romagna.it/issues/29457) Correzione errore nella verifica delle autorizzazioni
+
+### Novità: 1
+- [#29091](https://parermine.regione.emilia-romagna.it/issues/29091) Verifica di conformità sull'attributo "Signature acceptance validation"
+
+## 4.7.0 (19-05-2023)
+
+### Novità: 3
+- [#29084](https://parermine.regione.emilia-romagna.it/issues/29084) Separazione su Object Storage le evidenze di conservazione andate a buon fine dalle altre
+- [#28970](https://parermine.regione.emilia-romagna.it/issues/28970) Gestione risposta Verifica Eidas se impostato a true UtilizzoDataFirmaPerRifTemp
+- [#28489](https://parermine.regione.emilia-romagna.it/issues/28489) Eliminazione del salvataggio dei certificati della CA e delle CRL in fase di verifica
+
+## 4.6.0 (08-05-2023)
+
+### Novità: 1
+- [#28542](https://parermine.regione.emilia-romagna.it/issues/28542) Creazione pacchetto unico per sacerws
+
+## 4.5.1.1 (04-05-2023)
+
+### Bugfix: 1
+- [#29500](https://parermine.regione.emilia-romagna.it/issues/29500) Correzione gestione upload multipart large data object con RestTemplate (invocazione microservizio di verifica firma)
+## 4.5.1 (05-04-2023)
+
+### Bugfix: 6
+- [#28747](https://parermine.regione.emilia-romagna.it/issues/28747) Gestione upload multipart large data object con RestTemplate (invocazione microservizio di verifica firma)
+- [#28571](https://parermine.regione.emilia-romagna.it/issues/28571) Correzione verifica-controllo hash componente versato
+- [#28565](https://parermine.regione.emilia-romagna.it/issues/28565) Correzione log errore in caso di problemi al salvataggio della sessione di versamento
+- [#28449](https://parermine.regione.emilia-romagna.it/issues/28449) Correzione JPQL su viste in fase di persistenza URN unità documentaria
+- [#28032](https://parermine.regione.emilia-romagna.it/issues/28032) Risoluzione errore 666 in caso di mancanza tag opzionale Configurazione
+- [#27471](https://parermine.regione.emilia-romagna.it/issues/27471) Mancato funzionamento parametro FL_OBBL_DATA
+
+## 4.5.0 (28-02-2023)
+
+### Novità: 1
+- [#25924](https://parermine.regione.emilia-romagna.it/issues/25924) Salvataggio diretto su object storage
+
+### Bugfix: 3
+- [#28094](https://parermine.regione.emilia-romagna.it/issues/28094) Correzione di conversione nel passaggio dei parametri per il salvataggio sincrono
+- [#28036](https://parermine.regione.emilia-romagna.it/issues/28036) Correzione su gestione caratteri non validi nelle risposte alle chiamate dei servizi
+- [#27463](https://parermine.regione.emilia-romagna.it/issues/27463) gestione caso in cui TSA non contenga un certificato corretto
+
+### Novità: 1
+- [#28005](https://parermine.regione.emilia-romagna.it/issues/28005) Implementazione versamento diretto su Object storage
+
+## 4.4.0 (23-11-2022)
+
+### Novità: 1
+- [#27534](https://parermine.regione.emilia-romagna.it/issues/27534) aggiornamento libreria dss 5.10
+
+## 4.2.1.2 (15-09-2022)
+
+### Bugfix: 2
+- [#27681](https://parermine.regione.emilia-romagna.it/issues/27681) Correzione persistenza date e timestamp con Hibernate e JPA 2.2
+- [#27629](https://parermine.regione.emilia-romagna.it/issues/27629) correzione dell'ERRORE FILESYS-003-00 su versamento DPI
+
+## 4.2.1.1 (09-09-2022)
+
+### Bugfix: 1
+- [#27617](https://parermine.regione.emilia-romagna.it/issues/27617) Correzione dell'errore Hibernate nel salvataggio di un documento
+
+## 3.2.1 (02-08-2022)
+
+### Bugfix: 1
+- [#27513](https://parermine.regione.emilia-romagna.it/issues/27513) Correzione problema di concorrenza nella creazione degli elenchi
+
## 3.2.0 (31-05-2022)
### Novità: 2
@@ -25,11 +183,42 @@
### Novità: 1
- [#26508](https://parermine.regione.emilia-romagna.it/issues/26508) Gestione nuove codifiche profili per versamento fascicolo
+## 4.1.4.1 (11-04-2022)
+
+### Bugfix: 1
+- [#27093](https://parermine.regione.emilia-romagna.it/issues/27093) Correzione problema di chiusura connessione
+## 4.1.4 (28-03-2022)
+
+### Bugfix: 3
+- [#26930](https://parermine.regione.emilia-romagna.it/issues/26930) Risoluzione del problema della mancata chiusura di connessioni al DB
+- [#26850](https://parermine.regione.emilia-romagna.it/issues/26850) Errore mancata gestione nel versamento di un fascicolo
+- [#26846](https://parermine.regione.emilia-romagna.it/issues/26846) Errore in caso di aggiornamento metadati con USERID errato
+
+### Novità: 1
+- [#26982](https://parermine.regione.emilia-romagna.it/issues/26982) aggiornamento versione hibernate con versione SACER WS 3.1.4
+
## 3.1.4 (24-03-2022)
### Bugfix: 1
- [#26746](https://parermine.regione.emilia-romagna.it/issues/26746) Errore nell'xsd di validazione della response
+## 4.1.3.2 (23-02-2022)
+
+### Bugfix: 2
+- [#26819](https://parermine.regione.emilia-romagna.it/issues/26819) Errore 666 in SACER WS TEST
+- [#26493](https://parermine.regione.emilia-romagna.it/issues/26493) Correzione errore 666P per disallineamento tra XSD e DB
+
+## 4.1.3.1 (18-02-2022)
+
+### Bugfix: 1
+- [#26804](https://parermine.regione.emilia-romagna.it/issues/26804) Errore 666p in SACER WS TEST
+
+## 4.1.3 (09-02-2022)
+
+### Novità: 2
+- [#26262](https://parermine.regione.emilia-romagna.it/issues/26262) Allineamento alla versione 3.1.3 (eclipselink)
+- [#21190](https://parermine.regione.emilia-romagna.it/issues/21190) Migrazione Hibernate
+
## 3.1.3 (31-01-2022)
### Novità: 1
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..be3f7b2
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/README.md b/README.md
index 1214737..56f1221 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,927 @@
-# SACER WS
+# SACERWS
-Progetto contenente tutti i web services esposti da sacer.
+Fonte template redazione documento: https://www.makeareadme.com/.
- Fornitore: Engineering
- Struttura_RER: PARER
-## Configurazioni per JBoss 6 EAP
+# Descrizione
-Vedere i seguenti documenti:
-- [Configurazioni generali](src/docs/JBoss6_configurazione_generale.md)
-- [Configurazioni specifiche di progetto](src/docs/JBoss6_configurazione_sacerws.md)
+SACERWS è il modulo del Sistema di Conservazione SACER che espone i web service REST di versamento dei Pacchetti di Versamento (detti anche SIP o PdV) nel sistema di conservazione SACER.
-#### TODO
+I SIP devono rispettare una determinata struttura dati e sono composti da due elementi:
-- Chiamata API per la gestione (quando si crea il tag git) di una relativa "documentazione" al fine di avere un report di tutte le relase (vedi menu laterale)
+- INDICE SIP: un documento XML che contiene i metadati descrittivi dell’entità da versare e i Parametri di versamento.
+- OGGETTO-DATI: una o più sequenze di bit (tipicamente in forma di file) da sottoporre a conservazione.
+
+
+# Installazione
+
+Requisiti minimi per installazione:
+
+- Sistema operativo : consigliato Linux server (in alternativa compatibilità con Windows server);
+- Java versione 8 (OpenJDK / Oracle);
+- JBoss 7 EAP;
+- Oracle DB (versione consigliata 19c).
+
+## Instalazione JDK
+
+Consigliata adozione della OpenJDK alla versione 8, guida all'installazione https://openjdk.org/install/.
+
+## Setup application server (Jboss 7)
+
+Richiesta l'esecuzione delle seguenti guide secondo l'ordine riportato di seguito:
+
+1. guida per la configurazione **base** di [guida 1](src/docs/JBoss7_configurazione_generale.md);
+2. guida con le configurazioni **specifiche** per il contesto applicativo **SACERWS** di [guida 2](src/docs/JBoss7_configurazione_sacerws.md).
+
+### Deploy su JBoss 7
+
+Di seguito le indicazioni per il rilascio su application server JBoss7:
+
+1. generazione dell'artifact attraverso tool maven, eseguire il seguente comando:
+
+ ```bash
+ mvn package
+ ```
+
+2. viene generato l'artifact .ear all'interno del modulo sacerws-ear/target (e.g. sacerws-5.2.0.ear)
+3. deploy dell'ear generato allo step 1 su JBoss 7 (vedi configurazione [setup JBoss7](#setup-application-server-jboss-7))
+
+
+## Predisposizione database
+
+L'applicazione utilizza come DBMS di riferimento Oracle DB (https://www.oracle.com/it/database/) alla versione, consigliata, **19c**. Per l'installazione e la configurazione fare riferimento alle guide ufficiali.
+
+Per la creazione del modello E-R consultare il seguente [README.md](https://github.com/RegioneER/parer-db-init/blob/master/README.md) (progetto di riferimento https://github.com/RegioneER/parer-db-init).
+
+
+## Configurazione bucket S3 Object Storage
+
+L'applicazione può essere integrata sulla base delle configurazioni impostate, vedi paragrafo [Setup application server (Jboss 7)](#setup-application-server-jboss-7), ad uno storage grid o object storage attraverso lo standard [AWS S3](https://aws.amazon.com/it/s3/).
+
+In questa sezione si vuole proporre un possibile scenario di configurazione dei bucket e, in particolar modo, di eventuali [lifecycle](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) legati ad alcuni bucket, essenziali per gestire in modo corretto ed opportuno il ciclo di vita degli oggetti all'interno di determinati bucket; su quest'ultimo aspetto, si sottolinea, che alcuni flussi applicativi/servizi prevedono la creazione di oggetto "temporanei" ossia la cui esistenza è prevista per un determinato periodo temporale dopo il quale possono essere eliminati dal bucket stesso.
+
+### Configurazione dei bucket
+
+Una possibile configurazione dei bucket, proposta, è la seguente:
+
+- aggiornamenti-metadati : oggetti prodotti dal servizio di Aggiornamento Metadati (vedi README.md progetto "sacerws");
+- aip : oggetti prodotti dai processi di creazione dell'AIP;
+- componenti : oggetti prodotti dai servizi di Versamento Unità Documentarie/Aggiunta documenti (vedi README.md progetto "sacerws");
+- indici-aip : oggetti prodotti dai processi di creazione degli indici AIP;
+- reportvf : oggetti prodotti dalla creazione di report verifica firma su documenti processati dai servizi di Versamento Unità Documentarie/Aggiunta documenti (vedi README.md progetto "sacerws");
+- sessioni-agg-md-err-ko : oggetti prodotti dal servizio di Aggiornamento Metadati (vedi README.md progetto "sacerws");
+- vrs-staging : oggetti prodotti dai servizi di Versamento Unità Documentarie/Aggiunta documenti (vedi README.md progetto "sacerws").
+
+I bucket possono essere creati con / senza versioning, alcuni dei bucket prevedono l'applicazione di lifecycle policy (consigliato), nello specifico:
+- vrs-staging;
+- sessioni-agg-md-err-ko.
+
+#### Lifecyle policy : casi d'uso
+
+Bucket : vrs-staging
+
+Esempio di lifecycle applicata (con filtri per tag)
+
+```json
+{
+ "Rules": [
+ {
+ "Expiration": {
+ "Days": 183
+ },
+ "ID": "default_no_tag",
+ "Filter": {
+ "Prefix": ""
+ },
+ "Status": "Enabled"
+ },
+ {
+ "Expiration": {
+ "Days": 92
+ },
+ "ID": "file_componente_uddoc",
+ "Filter": {
+ "And": {
+ "Prefix": "",
+ "Tags": [
+ {
+ "Key": "vrs-object-type",
+ "Value": "file_componente_uddoc"
+ }
+ ]
+ }
+ },
+ "Status": "Enabled"
+ },
+ {
+ "Expiration": {
+ "Days": 183
+ },
+ "ID": "xml_metadati_uddoc",
+ "Filter": {
+ "And": {
+ "Prefix": "",
+ "Tags": [
+ {
+ "Key": "vrs-object-type",
+ "Value": "xml_metadati_uddoc"
+ }
+ ]
+ }
+ },
+ "Status": "Enabled"
+ },
+ {
+ "Expiration": {
+ "Days": 30
+ },
+ "ID": "orphan_objects",
+ "Filter": {
+ "And": {
+ "Prefix": "",
+ "Tags": [
+ {
+ "Key": "orphan",
+ "Value": "true"
+ }
+ ]
+ }
+ },
+ "Status": "Enabled"
+ },
+ {
+ "Expiration": {
+ "Days": 2
+ },
+ "ID": "temporany_object",
+ "Filter": {
+ "And": {
+ "Prefix": "",
+ "Tags": [
+ {
+ "Key": "vrs-object-type",
+ "Value": "temporany"
+ }
+ ]
+ }
+ },
+ "Status": "Enabled"
+ }
+ ]
+}
```
-curl --request POST --header 'Content-Type: application/json' --header "Private-Token: " --data '{"name": "sacerws-2.1.1", "tag_name": "sacerws-2.1.1", "description": "Test"}' "https://gitlab.ente.regione.emr.it/api/v4/projects/733/releases"
-```
-Nota: 733 è l'ID del progetto / probabilmente su pipeline esiste una funzionalità apposita oppure si richiama l'API
+
+# Utilizzo
+
+A seconda del modello di SIP utilizzato e delle sue caratteristiche, il SIP potrebbe essere composto solo dall’Indice SIP.
+
+I SIP versati sono sottoposti a varie verifiche per essere accettati e presi in carico:
+- Verifiche formali
+- Verifiche semantiche
+- Verifiche sul formato dei file versati
+- Verifiche sulle firme digitali
+
+I servizi esposti sono i seguenti:
+
+- Versamento Unità documentarie (VersamentoSync): consente di versare in SACER un pacchetto di versamento contenente un’Unità documentaria;
+- Aggiunta Documento (AggiuntaAllegatiSync): consente di versare in SACER un pacchetto di versamento contenente un Documento da aggiungere a un’Unità documentaria già presente nel sistema;
+- Aggiornamento metadati Unità documentaria (AggiornamentoVersamentoSync): consente di versare in SACER un pacchetto di versamento contenente i metadati per aggiornare quelli di un’unità documentaria già presente nel sistema;
+- Versamento Unità documentarie Multimedia (VersamentoMultiMedia): è una variante del servizio Versamento Unità documentarie in cui gli oggetti-dati (file) non sono trasmessi nella chiamata REST ma preventivamente collocati su un’area di lavoro e referenziati nell’Indice SIP;
+- Versamento fascicolo (VersamentoFascicoloSync): consente di versare in SACER un pacchetto di versamento contenente un fascicolo.
+
+Tutti i dettagli sulla composizione dei SIP, le modalità di invocazione dei servizi e le verifiche effettuate al versamento sono nei documenti di specifiche tecniche pubblicate a questo indirizzo: Documentazione — ParER — Polo archivistico dell'Emilia-Romagna (regione.emilia-romagna.it)
+
+
+# Librerie utilizzate
+
+| GroupId | ArtifactId | Version | Type | Licenses |
+|---|---|---|---|---|
+|antlr|antlr|2.7.7.redhat-7|jar|BSD License|
+|ch.qos.logback|logback-classic|1.2.1|jar|Eclipse Public License - v 1.0, GNU Lesser General Public License|
+|com.codeborne|phantomjsdriver|1.4.4|jar|The BSD 2-Clause License|
+|com.fasterxml|classmate|1.5.1.redhat-00001|jar|Apache License, Version 2.0|
+|com.fasterxml.jackson.core|jackson-annotations|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.core|jackson-core|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.core|jackson-databind|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.datatype|jackson-datatype-jdk8|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.datatype|jackson-datatype-jsr310|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.jaxrs|jackson-jaxrs-base|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.jaxrs|jackson-jaxrs-json-provider|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.jackson.module|jackson-module-jaxb-annotations|2.12.7.redhat-00003|jar|The Apache Software License, Version 2.0|
+|com.fasterxml.woodstox|woodstox-core|6.4.0.redhat-00001|jar|The Apache License, Version 2.0|
+|com.github.ben-manes.caffeine|caffeine|2.8.8.redhat-00001|jar|Apache License, Version 2.0|
+|com.github.fge|json-patch|1.9.0.redhat-00002|jar|The Apache License, Version 2.0, Lesser General Public License, version 3 or greater|
+|com.google.code.gson|gson|2.8.9.redhat-00001|jar|Apache-2.0|
+|com.google.guava|failureaccess|1.0.1.redhat-00002|jar|Apache License, Version 2.0|
+|com.google.guava|guava|30.1.0.redhat-00001|jar|Apache License, Version 2.0|
+|com.google.inject|guice|4.2.1|no_aop|jar|The Apache Software License, Version 2.0|
+|com.h2database|h2|1.4.197.redhat-00004|jar|MPL 2.0, EPL 1.0|
+|com.sun.activation|jakarta.activation|1.2.2.redhat-00001|jar|EDL 1.0|
+|com.sun.istack|istack-commons-runtime|3.0.10.redhat-00001|jar|Eclipse Distribution License - v 1.0|
+|com.sun.mail|jakarta.mail|1.6.7.redhat-00001|jar|EPL 2.0, GPL2 w/ CPE, EDL 1.0|
+|com.beanutils|commons-beanutils|1.9.4|jar|Apache License, Version 2.0|
+|commons-cli|commons-cli|1.4|jar|Apache License, Version 2.0|
+|commons-codec|commons-codec|1.15|jar|Apache License, Version 2.0|
+|commons-fileupload|commons-fileupload|1.5|jar|Apache-2.0|
+|commons-io|commons-io|2.12.0|jar|Apache-2.0|
+|commons-jxpath|commons-jxpath|1.3|jar|The Apache Software License, Version 2.0|
+|commons-logging|commons-logging|1.2|jar|The Apache Software License, Version 2.0|
+|commons-net|commons-net|3.9.0|jar|Apache License, Version 2.0|
+|io.netty|netty-handler|4.1.86.Final-redhat-00001|jar|Apache License, Version 2.0|
+|io.netty|netty-transport-native-epoll|4.1.86.Final-redhat-00001|linux-x86_64|jar|Apache License, Version 2.0|
+|io.reactivex.rxjava3|rxjava|3.0.9.redhat-00001|jar|-|
+|io.undertow|undertow-core|2.2.24.SP1-redhat-00001|jar|Apache License Version 2.0|
+|it.engparer|idp-jaas-rdbms|0.0.9|jar|-|
+|it.engparer|parer-retry|2.1.0|jar|-|
+|it.engparer|sacer-xml|2.7.0|jar|-|
+|it.engparer|sacerws-ejb|4.12.0|-|ejb|-|
+|it.engparer|sacerws-jpa|4.12.0|jar|-|
+|it.engparer|sacerws-web|4.12.0|-|war|-|
+|it.engparer|spagofat-core|4.11.0|jar|-|
+|it.engparer|spagofat-middle|4.11.0|jar|-|
+|it.engparer|spagofat-paginator-ejb|4.11.0|-|ejb|-|
+|it.engparer|spagofat-paginator-gf|4.11.0|jar|-|
+|it.engparer|spagofat-si-client|4.11.0|jar|-|
+|it.engparer|spagofat-si-server|4.11.0|classes|jar|-|
+|it.engparer|spagofat-si-util|4.11.0|jar|-|
+|it.engparer|spagofat-sl-ejb|4.11.0|-|ejb|-|
+|it.engparer|spagofat-sl-jpa|4.11.0|jar|-|
+|it.engparer|spagofat-sl-slg|4.11.0|jar|-|
+|it.engparer|spagofat-sl-web|4.11.0|classes|jar|-|
+|it.engparer|spagofat-sl-web|4.11.0|-|war|-|
+|it.engparer|spagofat-timer-wrapper-common|4.11.0|jar|-|
+|it.engparer|spagofat-timer-wrapper-ejb|4.11.0|-|ejb|-|
+|it.engparer|verificafirma-crypto-beans|1.3.0|jar|-|
+|it.engparer|verificafirma-eidas-beans|1.7.0|jar|-|
+|jakarta.enterprise|jakarta.enterprise.cdi-api|2.0.2.redhat-00002|jar|Apache License 2.0|
+|jakarta.inject|jakarta.inject-api|1.0.3.redhat-00001|jar|The Apache Software License, Version 2.0|
+|jakarta.json|jakarta.json-api|1.1.6.redhat-00001|jar|Eclipse Public License 2.0, GNU General Public License, version 2 with the GNU Classpath Exception|
+|jakarta.json.bind|jakarta.json.bind-api|1.0.2.redhat-00001|jar|Eclipse Public License 2.0, GNU General Public License, version 2 with the GNU Classpath Exception|
+|jakarta.persistence|jakarta.persistence-api|2.2.3.redhat-00001|jar|Eclipse Public License v. 2.0, Eclipse Distribution License v. 1.0|
+|jakarta.security.enterprise|jakarta.security.enterprise-api|1.0.2.redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|jakarta.validation|jakarta.validation-api|2.0.2.redhat-00001|jar|Apache License 2.0|
+|javax.annotation|jsr250-api|1.0|jar|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0|
+|javax.inject|javax.inject|1|jar|The Apache Software License, Version 2.0|
+|javax.jws|jsr181-api|1.0.0.MR1-redhat-8|jar|CDDL+GPLv2|
+|javax.servlet|javax.servlet-api|4.0.1|jar|CDDL + GPLv2 with classpath exception|
+|joda-time|joda-time|2.12.5|jar|Apache License, Version 2.0|
+|net.bytebuddy|byte-buddy|1.11.12.redhat-00002|jar|Apache License, Version 2.0|
+|net.java.xadisk|xadisk|1.2.2.5|jar|-|
+|org.apache.commons|commons-collections4|4.4|jar|Apache License, Version 2.0|
+|org.apache.commons|commons-compress|1.23.0|jar|Apache-2.0|
+|org.apache.commons|commons-lang3|3.12.0|jar|Apache License, Version 2.0|
+|org.apache.commons|commons-text|1.10.0|jar|Apache License, Version 2.0|
+|org.apache.httpcomponents|httpclient|4.5.14|jar|Apache License, Version 2.0|
+|org.apache.httpcomponents|httpcore|4.4.16|jar|Apache License, Version 2.0|
+|org.apache.james|apache-mime4j-dom|0.8.9.redhat-00001|jar|Apache License, Version 2.0|
+|org.apache.james|apache-mime4j-storage|0.8.9.redhat-00001|jar|Apache License, Version 2.0|
+|org.apache.lucene|lucene-analyzers-common|5.5.5.redhat-2|jar|Apache 2|
+|org.apache.lucene|lucene-core|5.5.5.redhat-2|jar|Apache 2|
+|org.apache.lucene|lucene-facet|5.5.5.redhat-2|jar|Apache 2|
+|org.apache.lucene|lucene-misc|5.5.5.redhat-2|jar|Apache 2|
+|org.apache.lucene|lucene-queries|5.5.5.redhat-2|jar|Apache 2|
+|org.apache.lucene|lucene-queryparser|5.5.5.redhat-2|jar|Apache 2|
+|org.apache.maven|maven-artifact|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-builder-support|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-compat|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-core|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-embedder|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-model|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-model-builder|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-plugin-api|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-repository-metadata|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-resolver-provider|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-settings|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-settings-builder|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven|maven-slf4j-provider|3.6.3|jar|Apache License, Version 2.0|
+|org.apache.maven.resolver|maven-resolver-api|1.4.1|jar|Apache License, Version 2.0|
+|org.apache.maven.resolver|maven-resolver-connector-basic|1.4.1|jar|Apache License, Version 2.0|
+|org.apache.maven.resolver|maven-resolver-impl|1.4.1|jar|Apache License, Version 2.0|
+|org.apache.maven.resolver|maven-resolver-spi|1.4.1|jar|Apache License, Version 2.0|
+|org.apache.maven.resolver|maven-resolver-transport-wagon|1.4.1|jar|Apache License, Version 2.0|
+|org.apache.maven.resolver|maven-resolver-util|1.4.1|jar|Apache License, Version 2.0|
+|org.apache.maven.shared|maven-shared-utils|3.2.1|jar|Apache License, Version 2.0|
+|org.apache.maven.wagon|wagon-file|3.3.4|jar|Apache License, Version 2.0|
+|org.apache.maven.wagon|wagon-http|3.3.4|shaded|jar|Apache License, Version 2.0|
+|org.apache.maven.wagon|wagon-provider-api|3.3.4|jar|Apache License, Version 2.0|
+|org.apache.poi|poi|4.1.2|jar|Apache License, Version 2.0|
+|org.apache.santuario|xmlsec|2.2.3.redhat-00001|jar|Apache License, Version 2.0|
+|org.apache.taglibs|taglibs-standard-impl|1.2.6.RC1-redhat-1|jar|Apache License, Version 2.0|
+|org.apache.taglibs|taglibs-standard-spec|1.2.6.RC1-redhat-1|jar|Apache License, Version 2.0|
+|org.apache.xmlbeans|xmlbeans|3.1.0|jar|The Apache Software License, Version 2.0|
+|org.codehaus.jackson|jackson-core-asl|1.9.13.redhat-00007|jar|The Apache Software License, Version 2.0|
+|org.codehaus.jackson|jackson-jaxrs|1.9.13.redhat-00007|jar|The Apache Software License, Version 2.0, GNU Lesser General Public License (LGPL), Version 2.1|
+|org.codehaus.jackson|jackson-mapper-asl|1.9.13.redhat-00007|jar|The Apache Software License, Version 2.0|
+|org.codehaus.jackson|jackson-xc|1.9.13.redhat-00007|jar|The Apache Software License, Version 2.0, GNU Lesser General Public License (LGPL), Version 2.1|
+|org.codehaus.jettison|jettison|1.5.4|jar|Apache License, Version 2.0|
+|org.codehaus.plexus|plexus-classworlds|2.6.0|jar|Apache License, Version 2.0|
+|org.codehaus.plexus|plexus-component-annotations|2.1.0|jar|Apache License, Version 2.0|
+|org.codehaus.plexus|plexus-interpolation|1.25|jar|Apache License, Version 2.0|
+|org.codehaus.plexus|plexus-utils|3.2.1|jar|Apache License, Version 2.0|
+|org.codehaus.woodstox|stax2-api|4.2.1.redhat-00001|jar|The BSD License|
+|org.eclipse.sisu|org.eclipse.sisu.inject|0.3.4|jar|Eclipse Public License, Version 1.0|
+|org.eclipse.sisu|org.eclipse.sisu.plexus|0.3.4|jar|Eclipse Public License, Version 1.0|
+|org.fusesource.jansi|jansi|1.17.1|jar|The Apache Software License, Version 2.0|
+|org.glassfish.jaxb|jaxb-runtime|2.3.3.b02-redhat-00002|jar|Eclipse Distribution License - v 1.0|
+|org.glassfish.jaxb|txw2|2.3.3.b02-redhat-00002|jar|Eclipse Distribution License - v 1.0|
+|org.hibernate|hibernate-envers|5.3.29.Final-redhat-00001|jar|GNU Library General Public License v2.1 or later|
+|org.hibernate|hibernate-search-engine|5.10.13.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 or later|
+|org.hibernate|hibernate-search-orm|5.10.13.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 or later|
+|org.hibernate.common|hibernate-commons-annotations|5.0.5.Final-redhat-00002|jar|GNU Lesser General Public License v2.1 or later|
+|org.hibernate.validator|hibernate-validator-annotation-processor|6.0.23.Final-redhat-00001|jar|Apache License 2.0|
+|org.infinispan|infinispan-client-hotrod|11.0.17.Final-redhat-00001|jar|Apache License 2.0|
+|org.infinispan|infinispan-commons|11.0.17.Final-redhat-00001|jar|Apache License 2.0|
+|org.infinispan|infinispan-core|11.0.17.Final-redhat-00001|jar|Apache License 2.0|
+|org.infinispan|infinispan-directory-provider|10.1.8.Final-redhat-00001|jar|Apache License 2.0|
+|org.infinispan.protostream|protostream|4.3.5.Final-redhat-00001|jar|Apache License 2.0|
+|org.javassist|javassist|3.27.0.GA-redhat-00001|jar|MPL 1.1, LGPL 2.1, Apache License 2.0|
+|org.jboss|jandex|2.4.2.Final-redhat-00001|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.config|arquillian-config-api|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.config|arquillian-config-impl-base|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.config|arquillian-config-spi|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.container|arquillian-container-impl-base|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.container|arquillian-container-spi|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.container|arquillian-container-test-api|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.container|arquillian-container-test-impl-base|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.container|arquillian-container-test-spi|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.core|arquillian-core-api|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.core|arquillian-core-impl-base|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.core|arquillian-core-spi|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.extension|arquillian-drone-api|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-appium-extension|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-browserstack-extension|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-configuration|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-impl|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-saucelabs-extension|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-spi|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-webdriver|2.5.2|jar|Public Domain|
+|org.jboss.arquillian.extension|arquillian-drone-webdriver-depchain|2.5.2|-|pom|Public Domain|
+|org.jboss.arquillian.graphene|graphene-webdriver|2.3.2|-|pom|GNU Lesser General Public License, Version 2.1|
+|org.jboss.arquillian.junit|arquillian-junit-container|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.junit|arquillian-junit-core|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.junit|arquillian-junit-standalone|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.protocol|arquillian-protocol-jmx|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.protocol|arquillian-protocol-servlet|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.test|arquillian-test-api|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.test|arquillian-test-impl-base|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.test|arquillian-test-spi|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testenricher|arquillian-testenricher-cdi|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testenricher|arquillian-testenricher-ejb|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testenricher|arquillian-testenricher-initialcontext|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testenricher|arquillian-testenricher-resource|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testng|arquillian-testng-container|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testng|arquillian-testng-core|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.arquillian.testng|arquillian-testng-standalone|1.6.0.Final|jar|Apache License, Version 2.0|
+|org.jboss.eap|wildfly-clustering-api|7.4.11.GA-redhat-00002|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.eap|wildfly-clustering-service|7.4.11.GA-redhat-00002|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.eap|wildfly-clustering-singleton-api|7.4.11.GA-redhat-00002|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.eap|wildfly-ejb-client-bom|7.4.11.GA|-|pom|Apache License 2.0|
+|org.jboss.eap|wildfly-jaxws-client-bom|7.4.11.GA|-|pom|Apache License 2.0|
+|org.jboss.eap|wildfly-jms-client-bom|7.4.11.GA|-|pom|Apache License 2.0|
+|org.jboss.eap|wildfly-security-api|7.4.11.GA-redhat-00002|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.ejb3|jboss-ejb3-ext-api|2.3.0.Final-redhat-00001|jar|Public Domain|
+|org.jboss.logging|commons-logging-jboss-logging|1.0.0.Final-redhat-1|jar|Apache License 2.0|
+|org.jboss.logging|jboss-logging|3.4.1.Final-redhat-00001|jar|Apache License, version 2.0|
+|org.jboss.msc|jboss-msc|1.4.12.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 only|
+|org.jboss.narayana.xts|jbossxts|5.11.4.Final-redhat-00001|api|jar|LGPL 2.1|
+|org.jboss.resteasy|resteasy-atom-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-client|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-jackson-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-jackson2-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-jaxb-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-jaxrs|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-jettison-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-jsapi|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-json-p-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-multipart-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-spring|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.resteasy|resteasy-validator-provider|3.15.7.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.security|jboss-negotiation-common|3.0.6.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.security|jboss-negotiation-extras|3.0.6.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.security|jboss-negotiation-ntlm|3.0.6.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.security|jboss-negotiation-spnego|3.0.6.Final-redhat-00001|jar|GNU Lesser General Public License v2.1 or later|
+|org.jboss.security|jbossxacml|2.0.8.Final-redhat-8|jar|lgpl|
+|org.jboss.shrinkwrap|shrinkwrap-api|1.2.6|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap|shrinkwrap-api-nio2|1.2.6|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap|shrinkwrap-depchain|1.2.6|-|pom|Apache License, Version 2.0|
+|org.jboss.shrinkwrap|shrinkwrap-depchain-java7|1.2.6|-|pom|Apache License, Version 2.0|
+|org.jboss.shrinkwrap|shrinkwrap-impl-base|1.2.6|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap|shrinkwrap-impl-nio2|1.2.6|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap|shrinkwrap-spi|1.2.6|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-api-base|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-api-javaee|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-api-jboss|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-depchain|2.0.0|-|pom|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-gen|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-impl-base|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-impl-javaee|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-impl-jboss|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.descriptors|shrinkwrap-descriptors-spi|2.0.0|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-api|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-api-gradle-embedded-archive|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-api-maven|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-api-maven-archive|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-api-maven-embedded|3.1.4|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-depchain|2.2.7|-|pom|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-gradle-depchain|2.2.7|-|pom|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-impl-gradle-embedded-archive|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-impl-maven|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-impl-maven-archive|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-impl-maven-embedded|3.1.4|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-spi|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.shrinkwrap.resolver|shrinkwrap-resolver-spi-maven|2.2.7|jar|Apache License, Version 2.0|
+|org.jboss.spec|jboss-jakartaee-8.0|1.0.1.Final-redhat-00007|-|pom|GNU Lesser General Public License, Version 2.1|
+|org.jboss.spec.javax.annotation|jboss-annotations-api_1.3_spec|2.0.1.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.batch|jboss-batch-api_1.0_spec|2.0.0.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.spec.javax.ejb|jboss-ejb-api_3.2_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.el|jboss-el-api_3.0_spec|2.0.1.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE, Apache 2.0, LGPL 2.1 or later|
+|org.jboss.spec.javax.enterprise.concurrent|jboss-concurrency-api_1.0_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.faces|jboss-jsf-api_2.3_spec|3.0.0.SP07-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.interceptor|jboss-interceptors-api_1.2_spec|2.0.0.Final-redhat-00002|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.jms|jboss-jms-api_2.0_spec|2.0.0.Final-redhat-00001|jar|Eclipse Public License 2.0, GNU General Public License, version 2 with the GNU Classpath Exception|
+|org.jboss.spec.javax.management.j2ee|jboss-j2eemgmt-api_1.1_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.resource|jboss-connector-api_1.7_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.security.auth.message|jboss-jaspi-api_1.1_spec|2.0.1.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.security.jacc|jboss-jacc-api_1.5_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.servlet|jboss-servlet-api_4.0_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.servlet.jsp|jboss-jsp-api_2.3_spec|2.0.0.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.transaction|jboss-transaction-api_1.3_spec|2.0.0.Final-redhat-00005|jar|Eclipse Public License 2.0, GNU General Public License, Version 2 with the Classpath Exception|
+|org.jboss.spec.javax.websocket|jboss-websocket-api_1.1_spec|2.0.0.Final-redhat-00001|jar|Eclipse Public License 2.0, GNU General Public License, version 2 with the GNU Classpath Exception|
+|org.jboss.spec.javax.ws.rs|jboss-jaxrs-api_2.1_spec|2.0.1.Final-redhat-00001|jar|EPL 2.0, GPL2 w/ CPE|
+|org.jboss.spec.javax.xml.bind|jboss-jaxb-api_2.3_spec|2.0.1.Final-redhat-00001|jar|Eclipse Distribution License - v 1.0|
+|org.jboss.spec.javax.xml.soap|jboss-saaj-api_1.4_spec|1.0.2.Final-redhat-00002|jar|Eclipse Distribution License, Version 1.0|
+|org.jboss.spec.javax.xml.ws|jboss-jaxws-api_2.3_spec|2.0.0.Final-redhat-00001|jar|Eclipse Distribution License - v 1.0|
+|org.jboss.threads|jboss-threads|2.4.0.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.xnio|xnio-api|3.8.9.Final-redhat-00001|jar|Apache License 2.0|
+|org.jboss.xnio|xnio-nio|3.8.9.Final-redhat-00001|jar|Apache License 2.0|
+|org.jgroups|jgroups|4.2.15.Final-redhat-00001|jar|Apache License 2.0|
+|org.jsoup|jsoup|1.12.1|jar|The MIT License|
+|org.keycloak|keycloak-servlet-filter-adapter|21.1.1|jar|Apache License, Version 2.0|
+|org.owasp.esapi|esapi|2.2.0.0|jar|BSD, Creative Commons 3.0 BY-SA|
+|org.picketbox|picketbox|5.0.3.Final-redhat-00009|jar|GNU Lesser General Public License v2.1 only|
+|org.picketbox|picketbox-commons|1.0.0.final-redhat-5|jar|lgpl|
+|org.picketlink|picketlink-api|2.5.5.SP12-redhat-00012|jar|Apache License 2.0|
+|org.picketlink|picketlink-common|2.5.5.SP12-redhat-00012|jar|Apache License 2.0|
+|org.picketlink|picketlink-config|2.5.5.SP12-redhat-00012|jar|Apache License 2.0|
+|org.picketlink|picketlink-federation|2.5.5.SP12-redhat-00012|jar|Apache License, Version 2.0|
+|org.picketlink|picketlink-idm-api|2.5.5.SP12-redhat-00012|jar|Apache License 2.0|
+|org.picketlink|picketlink-idm-impl|2.5.5.SP12-redhat-00012|jar|Apache License 2.0|
+|org.picketlink|picketlink-impl|2.5.5.SP12-redhat-00012|jar|Apache License 2.0|
+|org.powermock|powermock-reflect|1.7.4|jar|The Apache Software License, Version 2.0|
+|org.reactivestreams|reactive-streams|1.0.3.redhat-00003|jar|-|
+|org.seleniumhq.selenium|htmlunit-driver|2.28|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|lift|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-api|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-chrome-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-edge-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-firefox-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-ie-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-java|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-leg-rc|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-opera-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-remote-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-safari-driver|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-server|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.seleniumhq.selenium|selenium-support|3.11.0|jar|The Apache Software License, Version 2.0|
+|org.slf4j|jcl-over-slf4j|2.0.7|jar|Apache License, Version 2.0|
+|org.slf4j|log4j-over-slf4j|2.0.7|jar|Apache Software Licenses|
+|org.slf4j|slf4j-api|2.0.7|jar|MIT License|
+|org.slf4j|slf4j-log4j12|2.0.7|jar|MIT License|
+|org.slf4j|slf4j-simple|1.7.29|jar|MIT License|
+|org.sonatype.plexus|plexus-cipher|1.7|jar|Apache Public License 2.0|
+|org.sonatype.plexus|plexus-sec-dispatcher|1.4|jar|Apache Public License 2.0|
+|org.springframework|spring-aop|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-context|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-context-support|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-core|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-jdbc|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-orm|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-test|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-tx|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-web|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework|spring-webmvc|4.3.30.RELEASE|jar|Apache License, Version 2.0|
+|org.springframework.security|spring-security-config|4.2.20.RELEASE|jar|The Apache Software License, Version 2.0|
+|org.springframework.security|spring-security-core|4.2.20.RELEASE|jar|The Apache Software License, Version 2.0|
+|org.springframework.security|spring-security-web|4.2.20.RELEASE|jar|The Apache Software License, Version 2.0|
+|org.springframework.security.extensions|spring-security-saml2-core|1.0.10.RELEASE|jar|The Apache Software License, Version 2.0|
+|org.testng|testng|6.11|jar|Apache 2.0|
+|org.webjars|font-awesome|6.4.0|jar|CC BY 3.0|
+|org.webjars|highlightjs|11.5.0|jar|BSD|
+|org.webjars|jquery|3.6.4|jar|MIT License|
+|org.webjars|jquery-ui|1.13.2|jar|MIT License|
+|org.webjars|jstree|3.3.8|jar|MIT License, GPL|
+|org.webjars|select2|4.0.13|jar|MIT|
+|org.webjars.bower|chosen|1.8.7|jar|MIT|
+|org.webjars.bowergithub.wcoder|highlightjs-line-numbers.js|2.7.0|jar|MIT|
+|org.webjars.npm|highlightjs-badgejs|0.0.5|jar|MIT|
+|org.wildfly.arquillian|wildfly-arquillian-common|3.0.1.Final|jar|Apache License Version 2.0|
+|org.wildfly.arquillian|wildfly-arquillian-container-managed|3.0.1.Final|jar|Apache License Version 2.0|
+|org.wildfly.arquillian|wildfly-arquillian-container-remote|3.0.1.Final|jar|Apache License Version 2.0|
+|org.wildfly.client|wildfly-client-config|1.0.1.Final-redhat-00001|jar|Apache License 2.0|
+|org.wildfly.common|wildfly-common|1.5.4.Final-redhat-00001|jar|Apache License 2.0|
+|org.wildfly.discovery|wildfly-discovery-client|1.2.1.Final-redhat-00001|jar|Apache License 2.0|
+|org.wildfly.security|wildfly-elytron|1.15.16.Final-redhat-00001|jar|Apache License 2.0|
+|software.amazon.awssdk|accessanalyzer|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|account|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|acm|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|acmpca|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|alexaforbusiness|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|amp|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|amplify|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|amplifybackend|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|amplifyuibuilder|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|annotations|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|apache-client|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|apigateway|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|apigatewaymanagementapi|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|apigatewayv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appconfig|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appconfigdata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appflow|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appintegrations|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|applicationautoscaling|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|applicationcostprofiler|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|applicationdiscovery|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|applicationinsights|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appmesh|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|apprunner|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appstream|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|appsync|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|arczonalshift|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|arns|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|athena|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|auditmanager|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|auth|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|autoscaling|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|autoscalingplans|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|aws-cbor-protocol|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|aws-core|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|aws-crt-client|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|aws-json-protocol|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|aws-query-protocol|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|aws-xml-protocol|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|backup|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|backupgateway|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|backupstorage|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|batch|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|billingconductor|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|braket|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|budgets|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|chime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|chimesdkidentity|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|chimesdkmediapipelines|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|chimesdkmeetings|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|chimesdkmessaging|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|chimesdkvoice|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cleanrooms|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloud9|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudcontrol|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|clouddirectory|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudformation|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudfront|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudhsm|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudhsmv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudsearch|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudsearchdomain|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudtrail|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudtraildata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudwatch|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudwatch-metric-publisher|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudwatchevents|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cloudwatchlogs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codeartifact|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codebuild|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codecatalyst|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codecommit|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codedeploy|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codegen|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codegen-lite|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codegen-lite-maven-plugin|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codegen-maven-plugin|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codeguruprofiler|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codegurureviewer|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codegurusecurity|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codepipeline|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codestar|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codestarconnections|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|codestarnotifications|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cognitoidentity|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cognitoidentityprovider|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|cognitosync|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|comprehend|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|comprehendmedical|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|computeoptimizer|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|config|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|connect|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|connectcampaigns|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|connectcases|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|connectcontactlens|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|connectparticipant|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|controltower|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|costandusagereport|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|costexplorer|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|customerprofiles|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|databasemigration|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|databrew|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|dataexchange|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|datapipeline|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|datasync|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|dax|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|detective|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|devicefarm|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|devopsguru|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|directconnect|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|directory|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|dlm|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|docdb|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|docdbelastic|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|drs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|dynamodb|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|dynamodb-enhanced|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ebs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ec2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ec2instanceconnect|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ecr|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ecrpublic|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ecs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|efs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|eks|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elasticache|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elasticbeanstalk|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elasticinference|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elasticloadbalancing|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elasticloadbalancingv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elasticsearch|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|elastictranscoder|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|emr|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|emrcontainers|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|emrserverless|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|eventbridge|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|evidently|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|finspace|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|finspacedata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|firehose|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|fis|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|fms|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|forecast|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|forecastquery|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|frauddetector|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|fsx|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|gamelift|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|gamesparks|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|glacier|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|globalaccelerator|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|glue|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|grafana|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|greengrass|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|greengrassv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|groundstation|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|guardduty|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|health|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|healthlake|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|honeycode|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|http-client-spi|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iam|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|identitystore|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|imagebuilder|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|imds|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|inspector|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|inspector2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|internetmonitor|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iot|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iot1clickdevices|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iot1clickprojects|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotanalytics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotdataplane|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotdeviceadvisor|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotevents|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ioteventsdata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotfleethub|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotfleetwise|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotjobsdataplane|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotroborunner|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotsecuretunneling|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotsitewise|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotthingsgraph|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iottwinmaker|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|iotwireless|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ivs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ivschat|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ivsrealtime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|json-utils|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kafka|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kafkaconnect|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kendra|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kendraranking|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|keyspaces|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesis|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisanalytics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisanalyticsv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisvideo|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisvideoarchivedmedia|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisvideomedia|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisvideosignaling|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kinesisvideowebrtcstorage|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|kms|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lakeformation|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lambda|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lexmodelbuilding|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lexmodelsv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lexruntime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lexruntimev2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|licensemanager|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|licensemanagerlinuxsubscriptions|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|licensemanagerusersubscriptions|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lightsail|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|location|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lookoutequipment|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lookoutmetrics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|lookoutvision|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|m2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|machinelearning|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|macie|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|macie2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|managedblockchain|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|marketplacecatalog|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|marketplacecommerceanalytics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|marketplaceentitlement|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|marketplacemetering|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediaconnect|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediaconvert|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|medialive|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediapackage|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediapackagev2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediapackagevod|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediastore|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediastoredata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mediatailor|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|memorydb|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|metrics-spi|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mgn|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|migrationhub|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|migrationhubconfig|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|migrationhuborchestrator|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|migrationhubrefactorspaces|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|migrationhubstrategy|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mobile|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mq|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mturk|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|mwaa|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|neptune|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|netty-nio-client|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|networkfirewall|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|networkmanager|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|nimble|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|oam|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|omics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|opensearch|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|opensearchserverless|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|opsworks|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|opsworkscm|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|organizations|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|osis|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|outposts|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|panorama|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|paymentcryptography|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|paymentcryptographydata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|personalize|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|personalizeevents|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|personalizeruntime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pi|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pinpoint|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pinpointemail|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pinpointsmsvoice|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pinpointsmsvoicev2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pipes|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|polly|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|pricing|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|privatenetworks|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|profiles|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|protocol-core|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|proton|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|qldb|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|qldbsession|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|quicksight|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ram|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|rbin|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|rds|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|rdsdata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|redshift|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|redshiftdata|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|redshiftserverless|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|regions|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|rekognition|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|resiliencehub|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|resourceexplorer2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|resourcegroups|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|resourcegroupstaggingapi|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|robomaker|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|rolesanywhere|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|route53|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|route53domains|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|route53recoverycluster|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|route53recoverycontrolconfig|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|route53recoveryreadiness|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|route53resolver|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|rum|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|s3|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|s3-transfer-manager|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|s3control|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|s3outposts|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemaker|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemakera2iruntime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemakeredge|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemakerfeaturestoreruntime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemakergeospatial|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemakermetrics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sagemakerruntime|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|savingsplans|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|scheduler|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|schemas|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sdk-core|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|secretsmanager|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|securityhub|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|securitylake|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|serverlessapplicationrepository|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|servicecatalog|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|servicecatalogappregistry|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|servicediscovery|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|servicequotas|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ses|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sesv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sfn|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|shield|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|signer|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|simspaceweaver|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sms|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|snowball|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|snowdevicemanagement|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sns|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sqs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ssm|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ssmcontacts|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ssmincidents|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ssmsap|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sso|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ssoadmin|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|ssooidc|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|storagegateway|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|sts|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|support|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|supportapp|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|swf|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|synthetics|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|textract|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|third-party-jackson-core|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|third-party-jackson-dataformat-cbor|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|timestreamquery|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|timestreamwrite|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|tnb|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|transcribe|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|transcribestreaming|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|transfer|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|translate|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|url-connection-client|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|utils|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|verifiedpermissions|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|voiceid|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|vpclattice|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|waf|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|wafv2|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|wellarchitected|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|wisdom|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|workdocs|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|worklink|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|workmail|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|workmailmessageflow|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|workspaces|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|workspacesweb|2.20.87|jar|Apache License, Version 2.0|
+|software.amazon.awssdk|xray|2.20.87|jar|Apache License, Version 2.0|
+|xalan|xalan|2.7.2|jar|The Apache Software License, Version 2.0|
+|xerces|xercesImpl|2.12.0|jar|The Apache Software License, Version 2.0|
+
+
+# Supporto
+
+Mantainer del progetto è [Engineering Ingegneria Informatica S.p.A.](https://www.eng.it/).
+
+# Contributi
+
+Se interessati a crontribuire alla crescita del progetto potete scrivere all'indirizzo email areasviluppoparer@regione.emilia-romagna.it.
+
+# Credits
+
+Progetto di proprietà di [Regione Emilia-Romagna](https://www.regione.emilia-romagna.it/) sviluppato a cura di [Engineering Ingegneria Informatica S.p.A.](https://www.eng.it/).
+
+# Licenza
+
+Questo progetto è rilasciato sotto licenza GNU Affero General Public License v3.0 or later ([LICENSE.txt](LICENSE.txt)).
+
+# Appendice
+
+## Documentazione aggiuntiva
+
+Alcuni riferimenti:
+
+- Documentazione: https://poloarchivistico.regione.emilia-romagna.it/documentazione
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 8741fbb..a3c669d 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,5 +1,10 @@
-## 3.2.0 (31-05-2022)
+## 5.2.0 (06-05-2024)
+
+### Bugfix: 3
+- [#32027](https://parermine.regione.emilia-romagna.it/issues/32027) Aggiornamento metadati: errore 666 se si tenta di aggiornare i Dati Specifici dei componenti
+- [#31821](https://parermine.regione.emilia-romagna.it/issues/31821) Correzione gestione data scadenza in caso di "certificato scaduto" (verifica firma eidas)
+- [#31285](https://parermine.regione.emilia-romagna.it/issues/31285) Correzione messaggio di errore di aggiornamento metadati
### Novità: 2
-- [#27249](https://parermine.regione.emilia-romagna.it/issues/27249) Aggiornamento libreria DSS 5.9
-- [#27048](https://parermine.regione.emilia-romagna.it/issues/27048) Ottimizzazione job di Creazione elenchi di versamento - Producer coda IN_ATTESA_SCHED
+- [#31672](https://parermine.regione.emilia-romagna.it/issues/31672) Introduzione TAG "temporany" su bucket staging (con lifecycle)
+- [#29276](https://parermine.regione.emilia-romagna.it/issues/29276) Salvataggio diretto su OS di Aggiornamento metadati UD
diff --git a/mvnw b/mvnw
new file mode 100755
index 0000000..b7f0646
--- /dev/null
+++ b/mvnw
@@ -0,0 +1,287 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.1.1
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME
+ else
+ JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ printf '%s' "$(cd "$basedir"; pwd)"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=$(find_maven_basedir "$(dirname $0)")
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
+ else
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $wrapperUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ QUIET="--quiet"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ QUIET=""
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
+ else
+ wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
+ fi
+ [ $? -eq 0 ] || rm -f "$wrapperJarPath"
+ elif command -v curl > /dev/null; then
+ QUIET="--silent"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ QUIET=""
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
+ else
+ curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L
+ fi
+ [ $? -eq 0 ] || rm -f "$wrapperJarPath"
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaSource=`cygpath --path --windows "$javaSource"`
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaSource" ]; then
+ if [ ! -e "$javaClass" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaSource")
+ fi
+ if [ -e "$javaClass" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
new file mode 100644
index 0000000..cba1f04
--- /dev/null
+++ b/mvnw.cmd
@@ -0,0 +1,187 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.1.1
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %WRAPPER_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/pom.xml b/pom.xml
index 069d479..225a91e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,31 +1,32 @@
4.0.0
- it.eng.parersacerws
- 3.3.0-SNAPSHOT
+ 5.2.1-SNAPSHOTpomsacerwsProgetto SACERWS
-
it.eng.parerparer-pom
- 3.0.17
+ 5.2.0UTF-8
-
- 1.5.1
+
- 2.2.17
+ 2.8.0
- 4.1.26
- 1.2.0
- 1.0.1
- 2.0.3
+ 5.12.0
+ 1.9.0
+ 1.3.0
+ 2.1.0
+ 0.0.9
+
+ 2.20.87
+ 1.2.2.5
-
+
github
@@ -42,18 +43,6 @@
-
- ${project.groupId}
- sacer-jpa-el
- ${sacer.jpamodule.version}
- weaved
-
-
- ${project.groupId}
- sacer-jpa-el
- ${sacer.jpamodule.version}
- sacer-vers
- ${project.groupId}sacerws-ejb
@@ -66,90 +55,36 @@
${project.version}war
+
+ ${project.groupId}
+ sacerws-jpa
+ ${project.version}
+ it.eng.parersacer-xml${sacer.xmlmodule.version}
-
it.eng.parerverificafirma-crypto-beans${verificafirma-crypto-beans.version}
-
it.eng.parerverificafirma-eidas-beans${verificafirma-eidas-beans.version}
-
-
- junit
- junit
- ${junit.version}
- test
-
-
- commons-codec
- commons-codec
- ${commons-codec.version}
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
-
- org.apache.commons
- commons-text
- ${commons-text.version}
- org.apache.commonscommons-compress${commons-compress.version}
-
- commons-fileupload
- commons-fileupload
- ${commons-fileupload.version}
-
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
- org.apache.httpcomponents
- httpclient
- ${httpclient.version}
- org.apache.httpcomponentshttpcore${httpcore.version}
-
- org.glassfish.main.persistence
- eclipselink-wrapper
- ${eclipselink-wrapper.version}
- pom
-
-
-
- org.jboss.bom.eap
- jboss-javaee-6.0-with-tools
- 6.4.0.GA
- pom
- import
-
-
- org.jboss.spec
- jboss-javaee-6.0
- pom
- ${jboss-javaee-6.0.version}
- xerces
@@ -160,12 +95,7 @@
xalanxalan${xalan.version}
-
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson-databind.version}
-
+
it.eng.parerparer-retry
@@ -176,13 +106,13 @@
it.eng.pareridp-jaas-rdbms
- 0.0.9
+ ${idp-jaas-rdbms.version}
-
- com.amazonaws
- aws-java-sdk-bom
- ${aws-java-sdk-bom.version}
+
+ software.amazon.awssdk
+ bom
+ ${software.amazon.awssdk.version}pomimport
@@ -195,60 +125,58 @@
import
-
- com.sun.xml.bind
- jaxb-core
- 2.3.0
- provided
-
-
- com.sun.xml.bind
- jaxb-impl
- 2.3.0
- provided
-
-
- javax.xml.bind
- jaxb-api
- 2.3.0
- provided
-
-
- javax.xml.soap
- javax.xml.soap-api
- 1.4.0
- provided
-
-
- com.sun.activation
- javax.activation
- 1.2.0
- provided
-
-
- javax.annotation
- javax.annotation-api
- 1.3.2
- provided
-
-
- javax.activation
- javax.activation-api
- 1.2.0
- provided
-
+
+ com.sun.xml.bind
+ jaxb-core
+ ${jaxb.version}
+ provided
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ ${jaxb.version}
+ provided
+
+
+ javax.xml.bind
+ jaxb-api
+ ${jaxb.version}
+ provided
+
+
+ javax.xml.soap
+ javax.xml.soap-api
+ ${javax.xml.soap-api.version}
+ provided
+
+
+ com.sun.activation
+ javax.activation
+ ${javax.activation.version}
+ provided
+
+
+ javax.activation
+ javax.activation-api
+ ${javax.activation.version}
+ provided
+
+
+ javax.annotation
+ javax.annotation-api
+ ${javax.annotation-api.version}
+ provided
+
+
+
+ net.java.xadisk
+ xadisk
+ ${xadisk.version}
+
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
-
- true
-
- org.apache.maven.pluginsmaven-compiler-plugin
@@ -283,11 +211,20 @@
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ sacerws-ejbsacerws-web
+ sacerws-jpasacerws-ear
diff --git a/sacerws-ear/pom.xml b/sacerws-ear/pom.xml
index 658b36c..f43a091 100644
--- a/sacerws-ear/pom.xml
+++ b/sacerws-ear/pom.xml
@@ -4,11 +4,10 @@
sacerwsit.eng.parer
- 3.3.0-SNAPSHOT
+ 5.2.1-SNAPSHOT
- it.eng.parer
- sacerws-ear
+ sacerws-earearsacerws-earEAR
@@ -19,7 +18,7 @@
${project.groupId}
- sacerws-ejb
+ sacerws-ejbejb
@@ -36,28 +35,28 @@
-
+
${project.groupId}
- sacerws-web
- war
+ sacerws-web
+ war
-
+
commons-fileupload
- commons-fileupload
-
+ commons-fileupload
+
it.eng.parer
- spagofat-core
+ spagofat-coreit.eng.parer
- spagofat-middle
+ spagofat-middle
@@ -70,44 +69,41 @@
-
${project.groupId}
- sacer-jpa-el
- sacer-vers
+ sacerws-jpa
-
-
+
sacerws-${project.version}
-
+ org.apache.maven.pluginsmaven-ear-plugin
- ${build.env}
-
+ ${build.env}
+ ${project.groupId}
- sacerws-ejb
+ sacerws-ejb
-
+ ${project.groupId}
- sacerws-web
- /sacerws
+ sacerws-web
+ /sacerws
-
-
+
+ Sacerws @application.xml_env@${project.version}${maven.build.timestamp}SACERWS
-
+
6
- lib
- true
+ lib
+ true
diff --git a/sacerws-ear/src/main/application/META-INF/jboss-deployment-structure.xml b/sacerws-ear/src/main/application/META-INF/jboss-deployment-structure.xml
index f555294..dafe4a1 100644
--- a/sacerws-ear/src/main/application/META-INF/jboss-deployment-structure.xml
+++ b/sacerws-ear/src/main/application/META-INF/jboss-deployment-structure.xml
@@ -2,16 +2,7 @@
-
-
-
-
-
-
-
+
+
+ 127.0.0.1
+
+
+
+
+
+ /home/mbertuzzi/projects/jbosseap
+ /usr/lib/jvm/java-1.8.0-openjdk-amd64
+
+ true
+
+
+
+
diff --git a/sacerws-ejb/nbactions.xml b/sacerws-ejb/nbactions.xml
new file mode 100644
index 0000000..f86d0d1
--- /dev/null
+++ b/sacerws-ejb/nbactions.xml
@@ -0,0 +1,32 @@
+
+
+
+ test.single
+
+ *
+
+
+ test-compile
+ test
+
+
+ ${packageClassName}
+
+
+
+ debug.test.single
+
+ *
+
+
+ test-compile
+ test
+
+
+ ${packageClassName}
+ once
+ -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}
+ true
+
+
+
diff --git a/sacerws-ejb/pom.xml b/sacerws-ejb/pom.xml
index f1541db..2eda84d 100644
--- a/sacerws-ejb/pom.xml
+++ b/sacerws-ejb/pom.xml
@@ -3,10 +3,9 @@
sacerwsit.eng.parer
- 3.3.0-SNAPSHOT
+ 5.2.1-SNAPSHOT
- it.eng.parersacerws-ejbejbsacerws-ejb
@@ -14,6 +13,17 @@
UTF-8
+
+
+
+ org.jboss.arquillian
+ arquillian-bom
+ 1.4.0.Final
+ import
+ pom
+
+
+
@@ -26,29 +36,59 @@
junittest
-
+
+ org.apache.openejb
+ tomee-embedded
+ 1.7.5
+ test
+
+
+ org.apache.openejb
+ openejb-junit
+ 4.7.5
+ test
+
+
+ org.hamcrest
+ hamcrest-all
+ 1.3
+ test
+
+
+ com.oracle
+ ojdbc16
+ 11.2.0.3.0
+ test
+ it.eng.parerverificafirma-crypto-beans
+
+ ${project.groupId}
+ sacerws-jpa
+
+
+ it.eng.parer
+ spagofat-sl-jpa
+
+
+ it.eng.parerparer-retry
-
org.jboss.spec
- jboss-javaee-6.0
+ jboss-jakartaee-8.0pomprovided
-
it.eng.parerspagofat-coreprovided
-
it.eng.parerspagofat-middle
@@ -60,19 +100,6 @@
-
-
- ${project.groupId}
- sacer-jpa-el
- sacer-vers
-
-
- it.eng.parer
- spagofat-sl-jpa
-
-
-
-
${project.groupId}sacer-xml
@@ -103,16 +130,9 @@
org.apache.commonscommons-text
-
- org.glassfish.main.persistence
- eclipselink-wrapper
- pom
- provided
- net.java.xadiskxadisk
- 1.2.2.5provided
@@ -120,53 +140,6 @@
httpmime${httpmime.version}
-
- org.apache.xmlgraphics
- fop
- ${fop.version}
-
-
- org.apache.avalon.framework
- avalon-framework-api
-
-
- org.apache.avalon.framework
- avalon-framework-impl
-
-
- xalan
- xalan
-
-
- xml-apis
- xml-apis
-
-
- serializer
- xalan
-
-
- xml-apis-ext
- xml-apis
-
-
-
-
- avalon-framework
- avalon-framework-api
- 4.2.0
-
-
- avalon-framework
- avalon-framework-impl
- 4.2.0
-
-
-
-
-
-
-
it.eng.parerverificafirma-eidas-beans
@@ -185,7 +158,12 @@
-
it.eng.parer
@@ -199,18 +177,41 @@
org.apache.httpcomponentshttpcore
-
- org.slf4j
- slf4j-simple
- test
- ${slf4j.version}
-
-
- com.amazonaws
- aws-java-sdk-s3
+ org.slf4j
+ slf4j-simple
+ test
+ ${slf4j.version}
+
+
+ software.amazon.awssdk
+ s3
+
+
+ software.amazon.awssdk
+ apache-client
+
+
+ org.dom4j
+ dom4j
-
+
+ org.jboss.arquillian.junit
+ arquillian-junit-container
+ test
+
+
+ org.jboss.as
+ jboss-as-arquillian-container-managed
+ 7.1.1.Final
+ test
+
+
+ org.jboss.arquillian.protocol
+ arquillian-protocol-servlet
+ test
+
+
@@ -221,7 +222,6 @@
3.1
-
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/ConnectionException.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/ConnectionException.java
new file mode 100644
index 0000000..5068ed5
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/ConnectionException.java
@@ -0,0 +1,26 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.exception;
+
+public class ConnectionException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public ConnectionException(String message, Exception e) {
+ super(message, e);
+ }
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParamApplicNotFoundException.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParamApplicNotFoundException.java
index 2be4842..12bbbb9 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParamApplicNotFoundException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParamApplicNotFoundException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerAbstractError.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerAbstractError.java
index 55fa652..746a275 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerAbstractError.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerAbstractError.java
@@ -1,6 +1,21 @@
-package it.eng.parer.exception;
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
-import java.io.Serializable;
+package it.eng.parer.exception;
/**
* La classe astratta EMFAbstractError dev'essere estesa da tutte quelle classi che rappresentano un errore
@@ -12,7 +27,8 @@
*
* Verifica EMFErrorHandler
*/
-public abstract class ParerAbstractError extends Exception implements Serializable {
+public abstract class ParerAbstractError extends Exception {
+ private static final long serialVersionUID = 1L;
public static final String ABSTRACT_ERROR_ELEMENT = "ABSTRACT_ERROR";
public static final String ERROR_SEVERITY = "SEVERITY";
public static final String ERROR_DESCRIPTION = "DESCRIPTION";
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorCategory.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorCategory.java
index 1cff5b3..d9de540 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorCategory.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorCategory.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.exception;
public class ParerErrorCategory {
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorSeverity.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorSeverity.java
index 907a6f3..f34ff24 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorSeverity.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerErrorSeverity.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.exception;
/**
@@ -27,4 +44,4 @@ public static boolean isSeverityValid(String severity) {
public static final String WARNING = "WARNING";
public static final String ERROR = "ERROR";
public static final String BLOCKING = "BLOCKING";
-} // public class EMFErrorSeverity
\ No newline at end of file
+} // public class EMFErrorSeverity
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerNoResultException.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerNoResultException.java
index 742bc3f..54e2f31 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerNoResultException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/ParerNoResultException.java
@@ -1,15 +1,31 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.exception;
-import java.io.Serializable;
import java.text.MessageFormat;
import java.util.List;
-import java.util.ResourceBundle;
import java.util.Locale;
import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,7 +34,7 @@
*
* @author Agati_D
*/
-public class ParerNoResultException extends ParerAbstractError implements Serializable {
+public class ParerNoResultException extends ParerAbstractError {
private static final long serialVersionUID = 1L;
public static final String USER_ERROR_ELEMENT = "USER_ERROR";
@@ -28,7 +44,7 @@ public class ParerNoResultException extends ParerAbstractError implements Serial
private final transient Logger logger = LoggerFactory.getLogger(this.getClass());
private ResourceBundle _bundle = ResourceBundle.getBundle("it.eng.parer.exception.errors", Locale.ITALIAN);
- public ParerNoResultException(String severity, String code, List params) {
+ public ParerNoResultException(String severity, String code, List> params) {
super();
init(severity, code, params);
}
@@ -47,7 +63,7 @@ public ParerNoResultException() {
* Questo metodo ha il compito di inizializzare lo stato dell'oggetto, viene invocato da tutti i costruttori di
* ParerUserError.
*/
- private void init(String severity, String code, List params) {
+ private void init(String severity, String code, List> params) {
logger.debug("ParerNoResultException::init: invocato");
setSeverity(severity);
logger.debug("ParerNoResultException::init: severity [{}]", getSeverity());
@@ -72,7 +88,7 @@ public String getCategory() {
return ParerErrorCategory.USER_ERROR;
}
- private String getText(String code, List params) {
+ private String getText(String code, List> params) {
if (code == null)
return "";
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsException.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsException.java
index a7ecf7d..34e1130 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsRuntimeException.java b/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsRuntimeException.java
index 2d19d75..e568391 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsRuntimeException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/exception/SacerWsRuntimeException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/CryptoRestConfiguratorHelper.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/CryptoRestConfiguratorHelper.java
index 1a5c34d..c93e9ea 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/CryptoRestConfiguratorHelper.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/CryptoRestConfiguratorHelper.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.crypto.helper;
import java.util.LinkedList;
@@ -54,7 +71,7 @@ public class CryptoRestConfiguratorHelper implements RestConfiguratorHelper {
private Long getLongParameter(final String name) {
Long paramValue = null;
try {
- final String longParameterString = configurationHelper.getParamApplicValue(name);
+ final String longParameterString = configurationHelper.getValoreParamApplicByApplic(name);
paramValue = Long.parseLong(longParameterString);
} catch (ParamApplicNotFoundException | NumberFormatException ignore) {
@@ -66,7 +83,7 @@ private Long getLongParameter(final String name) {
private Integer getIntParameter(final String name) {
Integer paramValue = null;
try {
- final String intParameterString = configurationHelper.getParamApplicValue(name);
+ final String intParameterString = configurationHelper.getValoreParamApplicByApplic(name);
paramValue = Integer.parseInt(intParameterString);
} catch (ParamApplicNotFoundException | NumberFormatException ignore) {
@@ -79,7 +96,7 @@ private Integer getIntParameter(final String name) {
private Boolean getBooleanParameter(final String name) {
Boolean paramValue = true;
try {
- final String boolParameterString = configurationHelper.getParamApplicValue(name);
+ final String boolParameterString = configurationHelper.getValoreParamApplicByApplic(name);
paramValue = Boolean.parseBoolean(boolParameterString);
} catch (ParamApplicNotFoundException ignore) {
@@ -132,7 +149,7 @@ public Boolean isCompositePolicyOptimisticParam() {
@Override
public List endPoints() {
final List endPointCL = new LinkedList<>();
- final String endPointsString = configurationHelper.getParamApplicValue(CRYPTO_ENDPOINT);
+ final String endPointsString = configurationHelper.getValoreParamApplicByApplic(CRYPTO_ENDPOINT);
Pattern.compile(ENDPOINT_SEPARATOR).splitAsStream(endPointsString).map(String::trim).forEach(endpoint -> {
endPointCL.add(endpoint);
});
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/EidasRestConfiguratorHelper.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/EidasRestConfiguratorHelper.java
index 07ed957..0b97b63 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/EidasRestConfiguratorHelper.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/EidasRestConfiguratorHelper.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.crypto.helper;
import it.eng.parer.exception.ParamApplicNotFoundException;
@@ -53,7 +70,7 @@ public class EidasRestConfiguratorHelper implements RestConfiguratorHelper {
private Long getLongParameter(final String name) {
Long paramValue = null;
try {
- final String longParameterString = configurationHelper.getParamApplicValue(name);
+ final String longParameterString = configurationHelper.getValoreParamApplicByApplic(name);
paramValue = Long.parseLong(longParameterString);
} catch (ParamApplicNotFoundException | NumberFormatException ignore) {
@@ -66,7 +83,7 @@ private Long getLongParameter(final String name) {
private Integer getIntParameter(final String name) {
Integer paramValue = null;
try {
- final String intParameterString = configurationHelper.getParamApplicValue(name);
+ final String intParameterString = configurationHelper.getValoreParamApplicByApplic(name);
paramValue = Integer.parseInt(intParameterString);
} catch (ParamApplicNotFoundException | NumberFormatException ignore) {
@@ -79,7 +96,7 @@ private Integer getIntParameter(final String name) {
private Boolean getBooleanParameter(final String name) {
Boolean paramValue = true;
try {
- final String boolParameterString = configurationHelper.getParamApplicValue(name);
+ final String boolParameterString = configurationHelper.getValoreParamApplicByApplic(name);
paramValue = Boolean.parseBoolean(boolParameterString);
} catch (ParamApplicNotFoundException ignore) {
@@ -132,7 +149,7 @@ public Boolean isCompositePolicyOptimisticParam() {
*/
@Override
public List endPoints() {
- final String endPointsString = configurationHelper.getParamApplicValue(EIDAS_ENDPOINT);
+ final String endPointsString = configurationHelper.getValoreParamApplicByApplic(EIDAS_ENDPOINT);
return Pattern.compile(ENDPOINT_SEPARATOR).splitAsStream(endPointsString).map(String::trim)
.collect(Collectors.toCollection(LinkedList::new));
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/VerificaFirmeSyncHelper.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/VerificaFirmeSyncHelper.java
deleted file mode 100644
index 57296f1..0000000
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/helper/VerificaFirmeSyncHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package it.eng.parer.firma.crypto.helper;
-
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper per il WS di verifica firme sync
- *
- * @author Snidero_L
- */
-@Stateless
-public class VerificaFirmeSyncHelper {
-
- Logger log = LoggerFactory.getLogger(VerificaFirmeSyncHelper.class);
-
- @PersistenceContext(unitName = "ParerJPA")
- private EntityManager em;
-
- /**
- * Effettua i controlli sull'utente del WS SOAP VerificaFirmeSync. TODO: da implementare appena c'è l'utente.
- *
- * @param userName
- * nome utente
- * @param password
- * password
- *
- * @return autorizzato o meno
- */
- public boolean checkAuthorization(String userName, String password) {
- return true;
- }
-}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/CryptoInvoker.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/CryptoInvoker.java
index 75b758e..08a9f81 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/CryptoInvoker.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/CryptoInvoker.java
@@ -1,9 +1,30 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.crypto.verifica;
import java.io.File;
-import java.util.Date;
+import java.net.URI;
+import java.time.ZonedDateTime;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
@@ -11,12 +32,21 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import it.eng.parer.crypto.model.verifica.CryptoAroCompDoc;
+import it.eng.parer.crypto.model.verifica.input.CryptoDataToValidateBody;
+import it.eng.parer.crypto.model.verifica.input.CryptoDataToValidateDataUri;
import it.eng.parer.crypto.model.verifica.input.CryptoDataToValidateMetadata;
import it.eng.parer.crypto.model.verifica.input.CryptoDataToValidateMetadataFile;
import it.eng.parer.crypto.model.verifica.input.CryptoProfiloVerifica;
@@ -33,21 +63,9 @@
import it.eng.parer.firma.xml.VerificaFirmaWrapper;
import it.eng.parer.retry.ParerRetryConfiguration;
import it.eng.parer.retry.RestRetryInterceptor;
-import it.eng.parer.util.ejb.help.ConfigurationHelper;
import it.eng.parer.ws.utils.ParametroApplDB.ParametroApplFl;
import it.eng.parer.ws.versamento.dto.AbsVersamentoExt;
import it.eng.parer.ws.versamento.dto.ComponenteVers;
-import java.net.URI;
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.stream.Collectors;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestClientException;
/**
*
@@ -59,10 +77,7 @@ public class CryptoInvoker implements IVerificaFirmaInvoker {
private static final Logger LOG = LoggerFactory.getLogger(CryptoInvoker.class.getName());
- @EJB
- protected ConfigurationHelper configurationHelper;
-
- private static final String FIRMA_API_PATH = "/v2/report-verifica";
+ private static final String FIRMA_API_PATH = "/api/report-verifica";
@EJB
protected CryptoRestConfiguratorHelper restInvoker;
@@ -150,6 +165,33 @@ private CryptoAroCompDoc verificaCrypto(File contenuto, List marcheDetache
return componente;
}
+ private CryptoAroCompDoc verificaCrypto(CryptoDataToValidateDataUri data, CryptoDataToValidateMetadata metadata)
+ throws VerificaFirmaConnectionException, VerificaFirmaGenericInvokeException {
+
+ RestTemplate restTemplate = buildRestTemplateWithRetry();
+
+ String preferredUrl = restInvoker.preferredEndpoint();
+ String urlCrypto = preferredUrl + FIRMA_API_PATH;
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+
+ CryptoDataToValidateBody body = new CryptoDataToValidateBody();
+ body.setData(data);
+ body.setMetadata(metadata);
+
+ HttpEntity entity = new HttpEntity<>(body, headers);
+ CryptoAroCompDoc componente = null;
+ try {
+ componente = restTemplate.postForObject(urlCrypto, entity, CryptoAroCompDoc.class);
+ } catch (RestClientException rce) {
+ throw new VerificaFirmaConnectionException(rce, CdServizioVerificaCompDoc.CRYPTO.name(), urlCrypto);
+ } catch (Exception ex) {
+ throw new VerificaFirmaGenericInvokeException(ex, CdServizioVerificaCompDoc.CRYPTO.name(), urlCrypto);
+ }
+ return componente;
+ }
+
/**
* Verifica delle firme utilizzando la cryptolibrary.
*
@@ -185,14 +227,62 @@ public VerificaFirmaWrapper verificaAndWrapIt(ComponenteVers componenteVers,
throws VerificaFirmaWrapperResNotFoundException, VerificaFirmaConnectionException,
VerificaFirmaWrapperGenericException, VerificaFirmaGenericInvokeException {
- // Verifico il componente
+ // Preparo i metadati
+ CryptoDataToValidateMetadata metadata = buildMetadata(componenteVers, sottoComponentiFirma,
+ sottoComponentiMarca, controlliAbilitati, dataDiRiferimento, verificaAllaDataDiFirma, uuid);
+
+ final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
+ CryptoAroCompDoc output;
+ if (isComponenteSuObjectStorage(componenteVers)) {
+
+ CryptoDataToValidateDataUri data = buildDataUri(componenteVers, sottoComponentiFirma, sottoComponentiMarca);
+ output = verificaCrypto(data, metadata);
+
+ } else {
+
+ // File firme detached (o null)
+ List sottoComponentiMarcaFile = compilaFileDetached(sottoComponentiMarca);
+ // File marche detached (o null)
+ List sottoComponentiFirmaFile = compilaFileDetached(sottoComponentiFirma);
+
+ output = verificaCrypto(componenteVers.getRifFileBinario().getFileSuDisco(), sottoComponentiMarcaFile,
+ sottoComponentiFirmaFile, metadata);
+
+ }
+
+ CryptoWrapperResultStrategy strategy = new CryptoWrapperResultStrategy();
+ return strategy.buildVFWrapper(output, hasFirmeDetached);
+ }
+
+ /**
+ * ATTENZIONE a questo livello ho bisogno di capire se il componente di cui devo effettaure la
+ * verifica sia su file system oppure sull'object storage. Questo metodo ha proprio lo scopo di individuare questo
+ * caso ma, per ora, non ho trovato un modo migliore per capire dove sia l'oggetto. Non è scorretto ma forse non è
+ * molto robusto perché valuta solamente il componente principale.
+ *
+ *
+ * @param componenteVers
+ * componente versato
+ *
+ * @return true se il riferimento al file del componente è sull'object storage.
+ */
+ private boolean isComponenteSuObjectStorage(ComponenteVers componenteVers) {
+ return componenteVers.getRifFileBinario().getObjectStorageResource() != null;
+ }
+
+ private CryptoDataToValidateMetadata buildMetadata(ComponenteVers componenteVers,
+ List sottoComponentiFirma, List sottoComponentiMarca,
+ Map controlliAbilitati, ZonedDateTime dataDiRiferimento, boolean verificaAllaDataDiFirma,
+ String uuid) {
// Configurazione profilo di verificaCrypto custom per la struttura.
CryptoProfiloVerifica profiloVerifica = new CryptoProfiloVerifica()
.setControlloCrittograficoAbilitato(
controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS))
.setControlloCatenaTrustAbilitato(controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS))
.setControlloCertificatoAbilitato(controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS))
- .setControlloCrlAbilitato(controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS));
+ .setControlloCrlAbilitato(controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS))
+ .setIncludeCertificateAndRevocationValues(
+ controlliAbilitati.get(ParametroApplFl.FL_CRYPTO_INCLUDI_FILEBASE64));
CryptoDataToValidateMetadata metadata = new CryptoDataToValidateMetadata();
metadata.setUuid(uuid);
@@ -201,9 +291,14 @@ public VerificaFirmaWrapper verificaAndWrapIt(ComponenteVers componenteVers,
if (verificaAllaDataDiFirma) {
metadata.setTipologiaDataRiferimento(TipologiaDataRiferimento.verificaAllaDataDiFirma());
} else {
- if (dataDiRiferimento != null) {
+ boolean isDataDiRiferimentoOnCompVers = !Objects
+ .isNull(componenteVers.withAcdEntity().getTmRifTempVers());/* data di rif. su xml */
+ if (isDataDiRiferimentoOnCompVers) {
metadata.setTipologiaDataRiferimento(TipologiaDataRiferimento
.verificaAllaDataSpecifica(dataDiRiferimento.toInstant().toEpochMilli()));
+ } else {
+ metadata.setTipologiaDataRiferimento(
+ TipologiaDataRiferimento.verificaDataVersamento(dataDiRiferimento.toInstant().toEpochMilli()));
}
}
// Metadati componente principale
@@ -216,21 +311,20 @@ public VerificaFirmaWrapper verificaAndWrapIt(ComponenteVers componenteVers,
List metadatiFirmeDetached = compilaMetadatiElementiDetached(
sottoComponentiFirma);
metadata.setSottoComponentiFirma(metadatiFirmeDetached);
+ return metadata;
+ }
- // File firme detached (o null)
- List sottoComponentiMarcaFile = compilaFileDetached(sottoComponentiMarca);
- // File marche detached (o null)
- List sottoComponentiFirmaFile = compilaFileDetached(sottoComponentiFirma);
-
- final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
-
- CryptoAroCompDoc output = verificaCrypto(componenteVers.getRifFileBinario().getFileSuDisco(),
- sottoComponentiMarcaFile, sottoComponentiFirmaFile, metadata);
+ private CryptoDataToValidateDataUri buildDataUri(ComponenteVers componenteVers,
+ List sottoComponentiFirma, List sottoComponentiMarca) {
+ CryptoDataToValidateDataUri data = new CryptoDataToValidateDataUri();
- CryptoWrapperResultStrategy strategy = new CryptoWrapperResultStrategy(versamento);
- VerificaFirmaWrapper wrapper = strategy.buildVFWrapper(output, dataDiRiferimento, hasFirmeDetached);
+ data.setContenuto(componenteVers.getRifFileBinario().getObjectStorageResource().getPresignedURL());
+ List marche = compilaURIDetached(sottoComponentiMarca);
+ List firme = compilaURIDetached(sottoComponentiFirma);
+ data.setMarche(marche);
+ data.setFirme(firme);
- return wrapper;
+ return data;
}
private List compilaMetadatiElementiDetached(
@@ -252,6 +346,16 @@ private List compilaFileDetached(List componenteDetached)
return elementiDetached;
}
+ private List compilaURIDetached(List componenteDetached) {
+ List elementiDetached = null;
+ if (componenteDetached != null) {
+ elementiDetached = componenteDetached.stream()
+ .map(m -> m.getRifFileBinario().getObjectStorageResource().getPresignedURL())
+ .collect(Collectors.toCollection(ArrayList::new));
+ }
+ return elementiDetached;
+ }
+
/**
* Crea il client per le chiamate rest relativo a questo bean
*
@@ -274,7 +378,7 @@ private RestTemplate buildRestTemplateWithRetry() {
template.setErrorHandler(new CryptoErrorHandler());
List endpoints = restInvoker.endPoints();
- List endpointsURI = endpoints.stream().map(e -> URI.create(e)).collect(Collectors.toList());
+ List endpointsURI = endpoints.stream().map(URI::create).collect(Collectors.toList());
ParerRetryConfiguration retryClient = restInvoker.retryClient();
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerFormatiEnums.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerFormatiEnums.java
index 447e238..edcd897 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerFormatiEnums.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerFormatiEnums.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerificaFirmeSyncHandler.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerificaFirmeSyncHandler.java
deleted file mode 100644
index d8bd14b..0000000
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/crypto/verifica/VerificaFirmeSyncHandler.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package it.eng.parer.firma.crypto.verifica;
-
-import it.eng.parer.firma.crypto.helper.VerificaFirmeSyncHelper;
-import it.eng.spagoLite.security.auth.AuthenticationHandlerConstants;
-import static it.eng.spagoLite.security.auth.AuthenticationHandlerConstants.QNAME_WSSE_HEADER;
-import static it.eng.spagoLite.security.auth.AuthenticationHandlerConstants.WSSE_XSD_URI;
-import java.util.HashSet;
-import java.util.Set;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPFault;
-import javax.xml.ws.ProtocolException;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-import javax.xml.ws.soap.SOAPFaultException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Handler per il WS SOAP di Verifica Firme Sync
- */
-@Stateless
-public class VerificaFirmeSyncHandler implements SOAPHandler {
-
- private static final Logger log = LoggerFactory.getLogger(VerificaFirmeSyncHandler.class);
-
- @EJB
- private VerificaFirmeSyncHelper helper;
-
- @Override
- public boolean handleMessage(SOAPMessageContext msgCtx) {
- Boolean outbound = (Boolean) msgCtx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- String ipAddress = "NON_CALCOLATO";
- if (!outbound) {
- Object tmpRequest = msgCtx.get(MessageContext.SERVLET_REQUEST);
- if (tmpRequest != null && tmpRequest instanceof HttpServletRequest) {
- ipAddress = ((HttpServletRequest) tmpRequest).getHeader("X-FORWARDED-FOR");
- if (ipAddress == null || ipAddress.isEmpty()) {
- ipAddress = ((HttpServletRequest) tmpRequest).getRemoteAddr();
- }
- }
- log.debug("VerificaFirmeSyncHandler attivato. Client IP Address: " + ipAddress);
-
- try {
- NodeList usernameEl = (NodeList) msgCtx.getMessage().getSOAPHeader()
- .getElementsByTagNameNS(WSSE_XSD_URI, "Username");
- NodeList passwordEl = (NodeList) msgCtx.getMessage().getSOAPHeader()
- .getElementsByTagNameNS(WSSE_XSD_URI, "Password");
- Node userNode = null;
- Node passNode = null;
- if (usernameEl != null && passwordEl != null && (userNode = usernameEl.item(0)) != null
- && (passNode = passwordEl.item(0)) != null) {
- String username = userNode.getFirstChild().getNodeValue();
- String password = passNode.getFirstChild().getNodeValue();
-
- boolean authorized = helper.checkAuthorization(username, password);
-
- if (!authorized) {
- try {
- SOAPFactory fac = SOAPFactory.newInstance();
- SOAPFault sfault = fac.createFault();
- sfault.setFaultCode("ERR_USER");
- sfault.setFaultString("Utente mancante o non autorizzato per invocare il servizio");
- throw new SOAPFaultException(sfault);
- } catch (SOAPException e1) {
- log.error("Errore durante la creazione dell'eccezione SOAP", e1);
- throw new ProtocolException(e1);
- }
- }
- msgCtx.put(AuthenticationHandlerConstants.AUTHN_STAUTS, java.lang.Boolean.TRUE);
- msgCtx.put(AuthenticationHandlerConstants.USER, username);
- msgCtx.put(AuthenticationHandlerConstants.PWD, password);
- } else {
- throw new ProtocolException("Username e password sono obbligatorie");
- }
-
- } catch (DOMException | SOAPException e) {
- throw new ProtocolException(e);
- }
- msgCtx.setScope(AuthenticationHandlerConstants.AUTHN_STAUTS, MessageContext.Scope.APPLICATION);
- msgCtx.setScope(AuthenticationHandlerConstants.USER, MessageContext.Scope.APPLICATION);
- msgCtx.setScope(AuthenticationHandlerConstants.PWD, MessageContext.Scope.APPLICATION);
- }
- return true;
- }
-
- @Override
- public boolean handleFault(SOAPMessageContext context) {
- return true;
- }
-
- @Override
- public void close(MessageContext context) {
- }
-
- @Override
- public Set getHeaders() {
- HashSet headers = new HashSet();
- headers.add(QNAME_WSSE_HEADER);
- return headers;
- }
-
-}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/CompDocMock.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/CompDocMock.java
index 52a7204..858ff28 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/CompDocMock.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/CompDocMock.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.dto;
import java.math.BigDecimal;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoComponente.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoComponente.java
index 7b4aa1e..94057df 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoComponente.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoComponente.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -32,7 +49,7 @@ public class StatoComponente {
public boolean ctrlFirmeCatenaNegativo = false;
public boolean ctrlFirmeCertificatoWarning = false;
public boolean ctrlFirmeCertificatoErrore = false;
- public boolean ctrlFirmeCertificatoScad = false;
+ public boolean ctrlFirmeCertificatoScadRev = false;
public boolean ctrlFirmeCertificatoNoValid = false;
public boolean ctrlFirmeCertificatoErrato = false;
public boolean ctrlFirmeCRLWarning = false;
@@ -81,7 +98,7 @@ public void reset() {
ctrlFirmeCertificatoWarning = false;
ctrlFirmeCertificatoErrore = false;
- ctrlFirmeCertificatoScad = false;
+ ctrlFirmeCertificatoScadRev = false;
ctrlFirmeCertificatoNoValid = false;
ctrlFirmeCertificatoErrato = false;
@@ -126,7 +143,7 @@ public int hashCode() {
result = prime * result + (ctrlFirmeCertificatoErrato ? 1231 : 1237);
result = prime * result + (ctrlFirmeCertificatoErrore ? 1231 : 1237);
result = prime * result + (ctrlFirmeCertificatoNoValid ? 1231 : 1237);
- result = prime * result + (ctrlFirmeCertificatoScad ? 1231 : 1237);
+ result = prime * result + (ctrlFirmeCertificatoScadRev ? 1231 : 1237);
result = prime * result + (ctrlFirmeCertificatoWarning ? 1231 : 1237);
result = prime * result + (ctrlFirmeCrittErrore ? 1231 : 1237);
result = prime * result + (ctrlFirmeCrittNegativo ? 1231 : 1237);
@@ -192,7 +209,7 @@ public boolean equals(Object obj) {
return false;
if (ctrlFirmeCertificatoNoValid != other.ctrlFirmeCertificatoNoValid)
return false;
- if (ctrlFirmeCertificatoScad != other.ctrlFirmeCertificatoScad)
+ if (ctrlFirmeCertificatoScadRev != other.ctrlFirmeCertificatoScadRev)
return false;
if (ctrlFirmeCertificatoWarning != other.ctrlFirmeCertificatoWarning)
return false;
@@ -223,4 +240,4 @@ public boolean equals(Object obj) {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoDocumento.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoDocumento.java
index a08e4dd..b801cab 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoDocumento.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/StatoDocumento.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -63,4 +80,4 @@ public boolean equals(Object obj) {
return false;
return true;
}
-}
\ No newline at end of file
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaInput.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaInput.java
index 9012b65..cceefd1 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaInput.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaInput.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.dto.input;
import java.io.Serializable;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaRule.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaRule.java
index 164fecd..d74357f 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaRule.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/dto/input/InvokeVerificaRule.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -52,7 +69,9 @@ private static Map defaultAbilitazioni() {
.of(new Object[][] { { ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS, true },
{ ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS, true },
{ ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS, true },
- { ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS, true } })
+ { ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS, true },
+ { ParametroApplFl.FL_EIDAS_INCLUDI_FILEBASE64, true },
+ { ParametroApplFl.FL_CRYPTO_INCLUDI_FILEBASE64, true } })
.collect(Collectors.toMap(data -> (String) data[0], data -> (Boolean) data[1]));
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/EidasInvoker.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/EidasInvoker.java
index 50ca6fb..1c56f24 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/EidasInvoker.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/EidasInvoker.java
@@ -1,9 +1,28 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.ejb;
import java.io.File;
import java.net.URI;
+import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.stream.Collectors;
import javax.ejb.EJB;
@@ -25,9 +44,9 @@
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
-import it.eng.parer.eidas.model.EidasMetadataToValidate;
+import it.eng.parer.eidas.model.EidasDataToValidateMetadata;
import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
-import it.eng.parer.eidas.model.EsitoValidazioneEidas;
+import it.eng.parer.eidas.model.EidasValidationResponse;
import it.eng.parer.entity.constraint.DecServizioVerificaCompDoc.CdServizioVerificaCompDoc;
import it.eng.parer.firma.crypto.helper.EidasRestConfiguratorHelper;
import it.eng.parer.firma.exception.VerificaFirmaConnectionException;
@@ -40,11 +59,9 @@
import it.eng.parer.firma.xml.VerificaFirmaWrapper;
import it.eng.parer.retry.ParerRetryConfiguration;
import it.eng.parer.retry.RestRetryInterceptor;
-import it.eng.parer.util.ejb.help.ConfigurationHelper;
import it.eng.parer.ws.ejb.XmlVersCache;
import it.eng.parer.ws.versamento.dto.AbsVersamentoExt;
import it.eng.parer.ws.versamento.dto.ComponenteVers;
-import java.time.ZonedDateTime;
/**
* Oggetto di business per verificare la firma secondo il Regolamento (UE) N. 910/2014 del Parlamento europero e del
@@ -58,16 +75,13 @@ public class EidasInvoker implements IVerificaFirmaInvoker {
private static final Logger LOG = LoggerFactory.getLogger(EidasInvoker.class.getName());
- @EJB
- protected ConfigurationHelper configurationHelper;
-
@EJB
protected XmlVersCache xmlVersCache;
@EJB
protected EidasRestConfiguratorHelper restInvoker;
- private static final String FIRMA_API_PATH = "/v2/report-verifica";
+ private static final String FIRMA_API_PATH = "/api/report-verifica";
/**
* Si collega all'endpoint contenente l'health check per il servizio.
@@ -105,8 +119,8 @@ public boolean isUp(String url) {
* @throws VerificaFirmaGenericInvokeException
* eccezione in caso di risposta errata
*/
- private EsitoValidazioneEidas verificaEidasMultipart(EidasMetadataToValidate metadata, File signed, File original)
- throws VerificaFirmaConnectionException, VerificaFirmaGenericInvokeException {
+ private EidasValidationResponse verificaEidasMultipart(EidasDataToValidateMetadata metadata, File signed,
+ File original) throws VerificaFirmaConnectionException, VerificaFirmaGenericInvokeException {
RestTemplate restTemplate = buildRestTemplateWithRetry();
@@ -140,7 +154,46 @@ private EsitoValidazioneEidas verificaEidasMultipart(EidasMetadataToValidate met
} catch (Exception ex) {
throw new VerificaFirmaGenericInvokeException(ex, CdServizioVerificaCompDoc.EIDAS.name(), urlEidas);
}
- return new EsitoValidazioneEidas(resp);
+ return new EidasValidationResponse(resp);
+
+ }
+
+ /**
+ * Invocazione al WS REST di EIDAS con chiamata JSON.
+ *
+ * @param dto
+ * dto associati alla verifica
+ *
+ * @return modello contenente l'esito della verifica.
+ *
+ * @throws VerificaFirmaConnectionException
+ * eccezione in caso di mancata risposta
+ * @throws VerificaFirmaGenericInvokeException
+ * eccezione in caso di risposta errata
+ */
+ private EidasValidationResponse verificaEidasJson(EidasDataToValidateMetadata dto)
+ throws VerificaFirmaConnectionException, VerificaFirmaGenericInvokeException {
+
+ RestTemplate restTemplate = buildRestTemplateWithRetry();
+
+ String preferredUrl = restInvoker.preferredEndpoint();
+ String urlEidas = preferredUrl + FIRMA_API_PATH;
+ LOG.debug("post per {}", urlEidas);
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+
+ HttpEntity entity = new HttpEntity<>(dto, headers);
+
+ EidasWSReportsDTOTree resp = null;
+ try {
+ resp = restTemplate.postForObject(urlEidas, entity, EidasWSReportsDTOTree.class);
+ } catch (RestClientException rce) {
+ throw new VerificaFirmaConnectionException(rce, CdServizioVerificaCompDoc.EIDAS.name(), urlEidas);
+ } catch (Exception ex) {
+ throw new VerificaFirmaGenericInvokeException(ex, CdServizioVerificaCompDoc.EIDAS.name(), urlEidas);
+ }
+ return new EidasValidationResponse(resp);
}
@@ -152,25 +205,36 @@ public VerificaFirmaWrapper verificaAndWrapIt(ComponenteVers componenteVers,
throws VerificaFirmaWrapperResNotFoundException, VerificaFirmaConnectionException,
VerificaFirmaWrapperGenericException, VerificaFirmaGenericInvokeException {
- EidasMetadataToValidate metadata = EidasUtils.buildEidasMetadata(componenteVers, sottoComponentiFirma,
- controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento, uuid);
+ EidasValidationResponse esito = null;
- final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
- File signed = null;
- File original = null;
- //
- if (!hasFirmeDetached) {
- signed = componenteVers.getRifFileBinario().getFileSuDisco();
+ // create metadata
+ EidasDataToValidateMetadata dto = EidasUtils.buildDataToValidateMetadataFromCompVers(componenteVers,
+ sottoComponentiFirma, controlliAbilitati, dataDiRiferimento, uuid);
+
+ // file from o.s.
+ if (isComponenteSuObjectStorage(componenteVers)) {
+ // call
+ esito = verificaEidasJson(dto);
} else {
- signed = sottoComponentiFirma.get(0).getRifFileBinario().getFileSuDisco();
- original = componenteVers.getRifFileBinario().getFileSuDisco();
+ // file from multipart
+ final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
+ File signed = null;
+ File original = null;
+ //
+ if (!hasFirmeDetached) {
+ signed = componenteVers.getRifFileBinario().getFileSuDisco();
+ } else {
+ signed = sottoComponentiFirma.get(0).getRifFileBinario().getFileSuDisco();
+ original = componenteVers.getRifFileBinario().getFileSuDisco();
+ }
+ // call
+ esito = verificaEidasMultipart(dto, signed, original);
}
-
- EsitoValidazioneEidas esito = verificaEidasMultipart(metadata, signed, original);
- EidasWrapperResultStrategy strategy = new EidasWrapperResultStrategy(verificaAllaDataDiFirma,
- controlliAbilitati, versamento);
- VerificaFirmaWrapper wrapper = strategy.buildVFWrapper(esito, dataDiRiferimento,
- CollectionUtils.isNotEmpty(sottoComponentiFirma));
+ //
+ EidasWrapperResultStrategy strategy = new EidasWrapperResultStrategy(controlliAbilitati,
+ !Objects.isNull(componenteVers.withAcdEntity().getTmRifTempVers()), dataDiRiferimento,
+ versamento.getModificatoriWSCalc());
+ VerificaFirmaWrapper wrapper = strategy.buildVFWrapper(esito, CollectionUtils.isNotEmpty(sottoComponentiFirma));
/*
* Nota : nella prima versione dei report al fine di non appesanitre l'xml persistito era stata introdotto una
* gestione "skinny" del report ossia, una copia dell'oggetto "ripulito" da alcune parti. Nella seconda versione
@@ -206,7 +270,7 @@ private RestTemplate buildRestTemplateWithRetry() {
template.setErrorHandler(new EidasErrorHandler());
List endpoints = restInvoker.endPoints();
- List endpointsURI = endpoints.stream().map(e -> URI.create(e)).collect(Collectors.toList());
+ List endpointsURI = endpoints.stream().map(URI::create).collect(Collectors.toList());
ParerRetryConfiguration retryClient = restInvoker.retryClient();
@@ -215,4 +279,20 @@ private RestTemplate buildRestTemplateWithRetry() {
return template;
}
+ /**
+ * ATTENZIONE a questo livello ho bisogno di capire se il componente di cui devo effettaure la
+ * verifica sia su file system oppure sull'object storage. Questo metodo ha proprio lo scopo di individuare questo
+ * caso ma, per ora, non ho trovato un modo migliore per capire dove sia l'oggetto. Non è scorretto ma forse non è
+ * molto robusto perché valuta solamente il componente principale.
+ *
+ *
+ * @param componenteVers
+ * componente versato
+ *
+ * @return true se il riferimento al file del componente è sull'object storage.
+ */
+ private boolean isComponenteSuObjectStorage(ComponenteVers componenteVers) {
+ return componenteVers.getRifFileBinario().getObjectStorageResource() != null;
+ }
+
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/FirmeFormatiVers.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/FirmeFormatiVers.java
index ee95330..f68c0ae 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/FirmeFormatiVers.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/FirmeFormatiVers.java
@@ -1,6 +1,24 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.ejb;
import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -45,7 +63,8 @@
import it.eng.parer.ws.versamento.dto.AbsVersamentoExt;
import it.eng.parer.ws.versamento.dto.ComponenteVers;
import it.eng.parer.ws.versamento.ejb.ControlliPerFirme;
-import it.eng.parer.ws.versamento.utils.DocumentoVersVFirmeHash;
+import it.eng.parer.ws.versamento.ejb.DocumentoVersVFirmeHash;
+
import java.time.ZonedDateTime;
/**
@@ -107,34 +126,44 @@ public RispostaControlli verifica(ComponenteVers componenteVers, List
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/IVerificaFirmaInvoker.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/IVerificaFirmaInvoker.java
index 346f581..bc5fef9 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/IVerificaFirmaInvoker.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/IVerificaFirmaInvoker.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.ejb;
import java.util.List;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/SalvataggioFirmaManager.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/SalvataggioFirmaManager.java
index 5a2d465..762a0e0 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/SalvataggioFirmaManager.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/SalvataggioFirmaManager.java
@@ -1,7 +1,20 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
*/
+
package it.eng.parer.firma.ejb;
import java.io.IOException;
@@ -11,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import javax.ejb.EJB;
@@ -18,17 +32,13 @@
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+import javax.persistence.TypedQuery;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.amazonaws.services.s3.model.PutObjectResult;
-
-import it.eng.parer.crypto.model.CryptoEnums.EsitoControllo;
-import it.eng.parer.crypto.model.CryptoEnums.TipoControlli;
-import it.eng.parer.crypto.model.CryptoEnums.TipoControlliMarca;
import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
import it.eng.parer.entity.AroBustaCrittog;
import it.eng.parer.entity.AroCompDoc;
@@ -40,7 +50,7 @@
import it.eng.parer.entity.AroMarcaComp;
import it.eng.parer.entity.AroUsoCertifCaContrComp;
import it.eng.parer.entity.AroUsoCertifCaContrMarca;
-import it.eng.parer.entity.AroVerifFirmaDtVer;
+import it.eng.parer.entity.DecBackend;
import it.eng.parer.entity.DecFormatoFileStandard;
import it.eng.parer.entity.DecReportServizioVerificaCompDoc;
import it.eng.parer.entity.DecServizioVerificaCompDoc;
@@ -48,7 +58,6 @@
import it.eng.parer.entity.FirCertifFirmatario;
import it.eng.parer.entity.FirCertifOcsp;
import it.eng.parer.entity.FirCrl;
-import it.eng.parer.entity.FirFilePerFirma;
import it.eng.parer.entity.FirOcsp;
import it.eng.parer.entity.FirReport;
import it.eng.parer.entity.FirUrlDistribCrl;
@@ -59,7 +68,7 @@
import it.eng.parer.entity.constraint.DecServizioVerificaCompDoc.CdServizioVerificaCompDoc;
import it.eng.parer.entity.constraint.FiUrnReport.TiUrnReport;
import it.eng.parer.firma.exception.VerificaFirmaException;
-import it.eng.parer.firma.util.VerificaFirmaEnums;
+import it.eng.parer.firma.util.VerificaFirmaEnums.SacerIndication;
import it.eng.parer.firma.xml.VFCertifCaType;
import it.eng.parer.firma.xml.VFCertifFirmatarioType;
import it.eng.parer.firma.xml.VFContrFirmaCompType;
@@ -80,10 +89,14 @@
import it.eng.parer.ws.utils.MessaggiWSBundle;
import it.eng.parer.ws.utils.MessaggiWSFormat;
import it.eng.parer.ws.utils.XmlDateUtility;
+import it.eng.parer.ws.versamento.dto.BackendStorage;
import it.eng.parer.ws.versamento.dto.FileBinario;
+import it.eng.parer.ws.versamento.dto.ObjectStorageResource;
import it.eng.parer.ws.versamento.dto.StrutturaVersamento;
import it.eng.parer.ws.versamento.ejb.ControlliPerFirme;
+import it.eng.parer.ws.versamento.ejb.ObjectStorageService;
import it.eng.parer.ws.versamento.ejb.oracleBlb.WriteCompBlbOracle;
+import it.eng.parer.ws.versamento.exceptions.ObjectStorageException;
/**
* Parser (base) per la gestione del result wrapper post verifica documento firmato
@@ -110,7 +123,7 @@ public class SalvataggioFirmaManager {
private VerificaFirmaReportHelper verificaFirmaReportHelper;
@EJB
- private VerificaFirmaReportAwsClient verificaFirmaReportAwsClient;
+ private ObjectStorageService objectStorageService;
@EJB
private WriteCompBlbOracle writeCompBlbOracle;
@@ -147,19 +160,17 @@ public boolean salvaBustaCrittografica(RispostaControlli risposta, String idComp
|| busta.getMarcaComps().stream().filter(m -> m.getId().equals(idCompVers)).count() != 0) {
// create AroBustaCrittog componente
- AroBustaCrittog tmpBustaCrittogComp = buildAroBustaCrittog(tmpTabCDComponente, busta.getPgBusta(),
- busta.getAdditionalInfo().getIdFormatoFileStandard());
+ AroBustaCrittog tmpBustaCrittogComp = buildAroBustaCrittog(tmpTabCDComponente, busta);
// create AroBustaCrittog sotto componente
AroBustaCrittog tmpBustaCrittogSottoComp = null;
if (tmpTabCDSottoComp != null) {
// create empty list
if (tmpTabCDSottoComp.getAroBustaCrittogs() == null) {
- tmpTabCDSottoComp.setAroBustaCrittogs(new ArrayList());
+ tmpTabCDSottoComp.setAroBustaCrittogs(new ArrayList<>());
}
- tmpBustaCrittogSottoComp = buildAroBustaCrittog(tmpTabCDSottoComp, busta.getPgBusta(),
- busta.getAdditionalInfo().getIdFormatoFileStandard());
+ tmpBustaCrittogSottoComp = buildAroBustaCrittog(tmpTabCDSottoComp, busta);
}
@@ -169,8 +180,8 @@ public boolean salvaBustaCrittografica(RispostaControlli risposta, String idComp
//
for (VFFirmaCompType firmaCompType : firmaCompById) {
// FIRMA
- AroFirmaComp tmpFirmaComp = this.buildAroFirmaComp(wrapper, busta, firmaCompType,
- tmpTabCDComponente, tmpBustaCrittogComp, tmpBustaCrittogSottoComp, null);
+ AroFirmaComp tmpFirmaComp = buildAroFirmaComp(wrapper, busta, firmaCompType, tmpTabCDComponente,
+ tmpBustaCrittogComp, tmpBustaCrittogSottoComp, null);
// MARCHE
buildAroMarcaCompFromFirma(idCompVers, wrapper, busta, firmaCompType, tmpTabCDComponente,
@@ -207,16 +218,17 @@ public boolean salvaBustaCrittografica(RispostaControlli risposta, String idComp
// flush
entityManager.flush();
} catch (VerificaFirmaException ex) {
- LOG.error("Errore durante il popolamento della busta");
+ LOG.error("Errore durante il popolamento della busta", ex);
risposta.setrBoolean(false);
risposta.setCodErr(ex.getCodiceErrore());
risposta.setDsErr(ex.getDescrizioneErrore());
result = false;
} catch (Exception ex) {
- LOG.error("Errore durante il popolamento della busta");
+ LOG.error("Errore generico durante il popolamento della busta", ex);
risposta.setrBoolean(false);
risposta.setCodErr(MessaggiWSBundle.ERR_666P);
- risposta.setDsErr("Errore generico durante il popolamento della busta " + ExceptionUtils.getMessage(ex));
+ risposta.setDsErr(
+ "Errore generico durante il popolamento della busta " + ExceptionUtils.getRootCauseMessage(ex));
result = false;
}
@@ -234,11 +246,13 @@ public boolean salvaBustaCrittografica(RispostaControlli risposta, String idComp
* oggetto standard con dati di versamento
* @param tmpAroCompDoc
* componente
+ * @param nomeWs
+ * nome del servizio che invoca il salvataggio del report
*
* @return true/false con risultato dell'operazione
*/
public boolean salvaReportVerificaCompDoc(RispostaControlli risposta, VerificaFirmaWrapper wrapper,
- StrutturaVersamento strutV, AroCompDoc tmpAroCompDoc) {
+ StrutturaVersamento strutV, AroCompDoc tmpAroCompDoc, String nomeWs) {
boolean result = true;
try {
@@ -256,7 +270,7 @@ public boolean salvaReportVerificaCompDoc(RispostaControlli risposta, VerificaFi
if (StringUtils.isNotBlank(strutV.getGenerazioneRerortVerificaFirma())
&& !strutV.getGenerazioneRerortVerificaFirma().equalsIgnoreCase(GenReportVerificaFirma.OFF.name())
&& wrapper.getAdditionalInfo().getReportContent() != null) {
- buildFirReport(tmpAroCompDoc, wrapper, strutV);
+ buildFirReport(tmpAroCompDoc, wrapper, strutV, nomeWs);
}
// flush
entityManager.flush();
@@ -308,31 +322,29 @@ private void buildAroMarcaCompFromFirma(String idCompVers, VerificaFirmaWrapper
}
}
- private AroBustaCrittog buildAroBustaCrittog(AroCompDoc tmpAroCompDoc, BigDecimal pgBusta,
- long idFormatoFileStandard) {
- // FIXME FIXME FIXME PLEASE
- if (tmpAroCompDoc.getAroBustaCrittogs() != null && !tmpAroCompDoc.getAroBustaCrittogs().isEmpty()) {
- for (AroBustaCrittog aroBustaCrittog : tmpAroCompDoc.getAroBustaCrittogs()) {
- if (aroBustaCrittog.getPgBustaCrittog().equals(pgBusta)) {
- return aroBustaCrittog;
- }
-
+ private AroBustaCrittog buildAroBustaCrittog(AroCompDoc tmpAroCompDoc, VFBusta busta) {
+ // restituisci AroBustaCrittog se già presente
+ if (tmpAroCompDoc.getAroBustaCrittogs() != null) {
+ Optional findedBustaCrittog = tmpAroCompDoc.getAroBustaCrittogs().stream()
+ .filter(b -> b.getPgBustaCrittog().compareTo(busta.getPgBusta()) == 0).findFirst();
+ if (findedBustaCrittog.isPresent()) {
+ return findedBustaCrittog.get();
}
}
-
+ // create new entity
AroBustaCrittog tmpBustaCrittog = new AroBustaCrittog();
tmpBustaCrittog.setAroCompDoc(tmpAroCompDoc);
- tmpBustaCrittog.setAroFirmaComps(new ArrayList());
- tmpBustaCrittog.setAroMarcaComps(new ArrayList());
- tmpBustaCrittog.setPgBustaCrittog(pgBusta);
+ tmpBustaCrittog.setAroFirmaComps(new ArrayList<>());
+ tmpBustaCrittog.setAroMarcaComps(new ArrayList<>());
+ tmpBustaCrittog.setPgBustaCrittog(busta.getPgBusta());
tmpBustaCrittog.setIdStrut(tmpAroCompDoc.getIdStrut());
- // FIXME: questo è brutto
- if (idFormatoFileStandard > 0L) {
+ if (busta.getAdditionalInfo() != null && busta.getAdditionalInfo().getIdFormatoFileStandard() != null) {
// additional info (ottenute in precedenza -> vedi check formati)
- tmpBustaCrittog
- .setDecFormatoFileStandard(entityManager.find(DecFormatoFileStandard.class, idFormatoFileStandard));
+ tmpBustaCrittog.setDecFormatoFileStandard(entityManager.find(DecFormatoFileStandard.class,
+ busta.getAdditionalInfo().getIdFormatoFileStandard().longValue()));
}
+
tmpAroCompDoc.getAroBustaCrittogs().add(tmpBustaCrittog);
return tmpBustaCrittog;
@@ -388,10 +400,53 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
// FIRMA
AroFirmaComp tmpFirmaComp = new AroFirmaComp();
- tmpFirmaComp.setAroContrFirmaComps(new ArrayList());
- tmpFirmaComp.setAroControfirmaFirmaFiglios(new ArrayList());
- tmpFirmaComp.setAroControfirmaFirmaPadres(new ArrayList());
- tmpFirmaComp.setAroVerifFirmaDtVers(new ArrayList());
+ tmpFirmaComp.setAroContrFirmaComps(new ArrayList<>());
+ tmpFirmaComp.setAroControfirmaFirmaFiglios(new ArrayList<>());
+ tmpFirmaComp.setAroControfirmaFirmaPadres(new ArrayList<>());
+ tmpFirmaComp.setAroVerifFirmaDtVers(new ArrayList<>());
+ // Aggiungo la firma al componente e viceversa
+ tmpFirmaComp.setAroCompDoc(tmpTabCDComponente);
+ // Setto id struttura
+ tmpFirmaComp.setIdStrut(tmpTabCDComponente.getIdStrut());
+ tmpTabCDComponente.getAroFirmaComps().add(tmpFirmaComp);
+ tmpFirmaComp.setCdFirmatario(firmaCompType.getCdFirmatario());
+ tmpFirmaComp.setNmCognomeFirmatario(firmaCompType.getNmCognomeFirmatario());
+ tmpFirmaComp.setNmFirmatario(firmaCompType.getNmFirmatario());
+ tmpFirmaComp.setDlDnFirmatario(firmaCompType.getDlDnFirmatario());
+ tmpFirmaComp.setBlFirmaBase64(firmaCompType.getDsFirmaBase64());
+ tmpFirmaComp.setDsAlgoFirma(firmaCompType.getDsAlgoFirma());
+ tmpFirmaComp.setTiFormatoFirma(firmaCompType.getTiFormatoFirma());
+ tmpFirmaComp.setTiFirma(firmaCompType.getTiFirma().name());
+
+ tmpFirmaComp.setFirCertifFirmatario(tmpCertifFirmatario);
+ //
+ if (firmaCompType.getDtFirma() != null) {
+ tmpFirmaComp.setDtFirma(XmlDateUtility.xmlGregorianCalendarToDate(firmaCompType.getDtFirma()));
+ }
+ if (firmaCompType.getTmRifTempUsato() != null) {
+ tmpFirmaComp
+ .setTmRifTempUsato(XmlDateUtility.xmlGregorianCalendarToDate(firmaCompType.getTmRifTempUsato()));
+ }
+ //
+ tmpFirmaComp.setTiRifTempUsato(firmaCompType.getTipoRiferimentoTemporaleUsato());
+
+ tmpFirmaComp.setTiEsitoContrConforme(firmaCompType.getTiEsitoContrConforme());
+ tmpFirmaComp.setDsMsgEsitoContrConforme(firmaCompType.getDsMsgEsitoContrConforme());
+ //
+ tmpFirmaComp.setTiEsitoVerifFirma(firmaCompType.getTiEsitoVerifFirma());
+ tmpFirmaComp.setDsMsgEsitoVerifFirma(firmaCompType.getDsMsgEsitoVerifFirma());
+
+ tmpFirmaComp.setPgFirma(firmaCompType.getPgFirma());
+ tmpFirmaComp.setPgBusta(busta.getPgBusta());
+
+ boolean isDetachedSignature = wrapper.getAdditionalInfo().isIsDetached();
+ if (isDetachedSignature) {
+ tmpBustaCrittogSottoComp.getAroFirmaComps().add(tmpFirmaComp);
+ tmpFirmaComp.setAroBustaCrittog(tmpBustaCrittogSottoComp);
+ } else {
+ tmpBustaCrittogComp.getAroFirmaComps().add(tmpFirmaComp);
+ tmpFirmaComp.setAroBustaCrittog(tmpBustaCrittogComp);
+ }
// Creo una mappa di CONTR_FIRMA_COMP identificati dalla costante enumerata in
// VFTipoControlloType
@@ -406,10 +461,9 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
controllo.setTiContr(VFTipoControlloType.CRITTOGRAFICO.name());
controllo.setTiEsitoContrFirma(vfControllo.getTiEsitoContrFirma());
controllo.setDsMsgEsitoContrFirma(vfControllo.getDsMsgEsitoContrFirma());
-
- tmpFirmaComp.getAroContrFirmaComps().add(controllo);
// persist
entityManager.persist(controllo);
+ tmpFirmaComp.getAroContrFirmaComps().add(controllo);
}
// CONTROLLI FIRMA - CRITTOGRAFICO ABILITATO
{
@@ -419,10 +473,9 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
controllo.setTiContr(VFTipoControlloType.CRITTOGRAFICO_ABILITATO.name());
controllo.setTiEsitoContrFirma(vfControllo.getTiEsitoContrFirma());
controllo.setDsMsgEsitoContrFirma(vfControllo.getDsMsgEsitoContrFirma());
-
- tmpFirmaComp.getAroContrFirmaComps().add(controllo);
// persist
entityManager.persist(controllo);
+ tmpFirmaComp.getAroContrFirmaComps().add(controllo);
}
// CONTROLLI FIRMA - CATENA TRUSTED
{
@@ -437,8 +490,6 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
AroUsoCertifCaContrComp usoCertifCatena = new AroUsoCertifCaContrComp();
usoCertifCatena.setPgCertifCa(BigDecimal.ONE);
- usoCertifCatena.setAroContrFirmaComp(controllo);
-
// CA
usoCertifCatena.setFirCertifCa(caUso);
// CRL (se presente)
@@ -447,12 +498,12 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
usoCertifCatena.setFirOcsp(ocspUso);
//
usoCerifiCaContrComp.add(usoCertifCatena);
+ // persist
+ entityManager.persist(controllo);
+ usoCertifCatena.setAroContrFirmaComp(controllo);
entityManager.persist(usoCertifCatena);
controllo.setAroUsoCertifCaContrComps(usoCerifiCaContrComp);
-
tmpFirmaComp.getAroContrFirmaComps().add(controllo);
- // persist
- entityManager.persist(controllo);
}
// CONTROLLI FIRMA - CATENA TRUSTED ABILITATO
{
@@ -462,10 +513,9 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
controllo.setTiContr(VFTipoControlloType.CATENA_TRUSTED_ABILITATO.name());
controllo.setTiEsitoContrFirma(vfControllo.getTiEsitoContrFirma());
controllo.setDsMsgEsitoContrFirma(vfControllo.getDsMsgEsitoContrFirma());
-
- tmpFirmaComp.getAroContrFirmaComps().add(controllo);
// persist
entityManager.persist(controllo);
+ tmpFirmaComp.getAroContrFirmaComps().add(controllo);
}
// CONTROLLI FIRMA - CRL
{
@@ -476,9 +526,9 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
controllo.setTiEsitoContrFirma(vfControllo.getTiEsitoContrFirma());
controllo.setDsMsgEsitoContrFirma(vfControllo.getDsMsgEsitoContrFirma());
controllo.setFirCrl(crlContr);
- tmpFirmaComp.getAroContrFirmaComps().add(controllo);
// persist
entityManager.persist(controllo);
+ tmpFirmaComp.getAroContrFirmaComps().add(controllo);
}
// CONTROLLI FIRMA - OCSP
{
@@ -504,7 +554,6 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
//
usoCerifiCaContrComp.add(usoCertifOcsp);
- entityManager.persist(usoCertifOcsp);
//
controllo.setAroUsoCertifCaContrComps(usoCerifiCaContrComp);
}
@@ -521,61 +570,17 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
controllo.setTiContr(VFTipoControlloType.CERTIFICATO.name());
controllo.setTiEsitoContrFirma(vfControllo.getTiEsitoContrFirma());
controllo.setDsMsgEsitoContrFirma(vfControllo.getDsMsgEsitoContrFirma());
-
- tmpFirmaComp.getAroContrFirmaComps().add(controllo);
// persist
entityManager.persist(controllo);
+ tmpFirmaComp.getAroContrFirmaComps().add(controllo);
}
//
- tmpFirmaComp.setCdFirmatario(firmaCompType.getCdFirmatario());
- tmpFirmaComp.setNmCognomeFirmatario(firmaCompType.getNmCognomeFirmatario());
- tmpFirmaComp.setNmFirmatario(firmaCompType.getNmFirmatario());
- tmpFirmaComp.setDlDnFirmatario(firmaCompType.getDlDnFirmatario());
- tmpFirmaComp.setBlFirmaBase64(firmaCompType.getDsFirmaBase64());
- tmpFirmaComp.setDsAlgoFirma(firmaCompType.getDsAlgoFirma());
- tmpFirmaComp.setTiFormatoFirma(firmaCompType.getTiFormatoFirma());
- tmpFirmaComp.setTiFirma(firmaCompType.getTiFirma().name());
-
- tmpFirmaComp.setFirCertifFirmatario(tmpCertifFirmatario);
- //
- if (firmaCompType.getDtFirma() != null) {
- tmpFirmaComp.setDtFirma(XmlDateUtility.xmlGregorianCalendarToDate(firmaCompType.getDtFirma()));
- }
- if (firmaCompType.getTmRifTempUsato() != null) {
- tmpFirmaComp
- .setTmRifTempUsato(XmlDateUtility.xmlGregorianCalendarToDate(firmaCompType.getTmRifTempUsato()));
- }
- //
- tmpFirmaComp.setTiRifTempUsato(firmaCompType.getTipoRiferimentoTemporaleUsato());
-
- tmpFirmaComp.setTiEsitoContrConforme(firmaCompType.getTiEsitoContrConforme());
- tmpFirmaComp.setDsMsgEsitoContrConforme(firmaCompType.getDsMsgEsitoContrConforme());
- //
- tmpFirmaComp.setTiEsitoVerifFirma(firmaCompType.getTiEsitoVerifFirma());
- tmpFirmaComp.setDsMsgEsitoVerifFirma(firmaCompType.getDsMsgEsitoVerifFirma());
- tmpFirmaComp.setPgFirma(firmaCompType.getPgFirma());
- tmpFirmaComp.setPgBusta(busta.getPgBusta());
-
- boolean isDetachedSignature = wrapper.getAdditionalInfo().isIsDetached();
- if (isDetachedSignature) {
- tmpBustaCrittogSottoComp.getAroFirmaComps().add(tmpFirmaComp);
- tmpFirmaComp.setAroBustaCrittog(tmpBustaCrittogSottoComp);
- } else {
- tmpBustaCrittogComp.getAroFirmaComps().add(tmpFirmaComp);
- tmpFirmaComp.setAroBustaCrittog(tmpBustaCrittogComp);
- }
- // Aggiungo la firma al componente e viceversa
- tmpFirmaComp.setAroCompDoc(tmpTabCDComponente);
- // Setto id struttura
- tmpFirmaComp.setIdStrut(tmpTabCDComponente.getIdStrut());
- tmpTabCDComponente.getAroFirmaComps().add(tmpFirmaComp);
/*
* Esitono eccezioni gestibili per questi casi (quelle per cui RispostaControlli#rBoolean dovrebbe valore false?
* Nel caso utilizzare VerificaFirmaException
*/
-
//
if (tmpFirmaCompPadre != null) {
AroControfirmaFirma tmpControfirmaFirma = new AroControfirmaFirma();
@@ -587,7 +592,6 @@ private AroFirmaComp buildAroFirmaComp(VerificaFirmaWrapper wrapper, VFBusta bus
// persist
entityManager.persist(tmpControfirmaFirma);
}
-
return tmpFirmaComp;
}
@@ -610,7 +614,30 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
throws VerificaFirmaException {
//
AroMarcaComp tmpMarcaComp = new AroMarcaComp();
- tmpMarcaComp.setAroContrMarcaComps(new ArrayList());
+ tmpMarcaComp.setAroContrMarcaComps(new ArrayList<>());
+
+ tmpMarcaComp.setDsMarcaBase64(marcaCompType.getDsMarcaBase64());
+ tmpMarcaComp.setDsAlgoMarca(marcaCompType.getDsAlgoMarca());
+ tmpMarcaComp.setTmMarcaTemp(XmlDateUtility.xmlGregorianCalendarToDate(marcaCompType.getTmMarcaTemp()));
+ tmpMarcaComp.setTiFormatoMarca(marcaCompType.getTiFormatoMarca());
+ tmpMarcaComp.setDtScadMarca(XmlDateUtility.xmlGregorianCalendarToDate(marcaCompType.getDtScadMarca()));
+
+ tmpMarcaComp.setTiEsitoVerifMarca(marcaCompType.getTiEsitoVerifMarca());
+ tmpMarcaComp.setDsMsgEsitoVerifMarca(marcaCompType.getDsMsgEsitoVerifMarca());
+
+ tmpMarcaComp.setTiEsitoContrConforme(marcaCompType.getTiEsitoContrConforme());
+ tmpMarcaComp.setDsMsgEsitoContrConforme(marcaCompType.getDsMsgEsitoContrConforme());
+
+ tmpMarcaComp.setPgBusta(busta.getPgBusta());
+ tmpMarcaComp.setPgMarca(marcaCompType.getPgMarca());
+
+ if (isDetached) {
+ tmpBustaCrittogSottoComp.getAroMarcaComps().add(tmpMarcaComp);
+ tmpMarcaComp.setAroBustaCrittog(tmpBustaCrittogSottoComp);
+ } else {
+ tmpBustaCrittogComp.getAroMarcaComps().add(tmpMarcaComp);
+ tmpMarcaComp.setAroBustaCrittog(tmpBustaCrittogComp);
+ }
// Creo una mappa di CONTR_MARCA_COMP identificati dalla costante enumerata in
// VFTipoControlloType
@@ -618,8 +645,7 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
.collect(Collectors.toMap(VFContrMarcaCompType::getTiContr, t -> t));
// TOFIX : corretto ?!
- if (!marcaCompType.getTiEsitoContrConforme()
- .equals(VerificaFirmaEnums.EsitoControllo.FORMATO_NON_CONOSCIUTO.name())) {
+ if (!marcaCompType.getTiEsitoContrConforme().equals(SacerIndication.FORMATO_NON_CONOSCIUTO.name())) {
VFCertifCaType certifTsaType = marcaCompType.getCertifTsa();
// CERTIFICATO TSA + BLOB
@@ -646,7 +672,6 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
controllo.setTiContr(VFTipoControlloType.CRITTOGRAFICO.name());
controllo.setTiEsitoContrMarca(vfControllo.getTiEsitoContrMarca());
controllo.setDsMsgEsitoContrMarca(vfControllo.getDsMsgEsitoContrMarca());
- entityManager.persist(controllo);
}
// CONTROLLI MARCA - CATENA_TRUSTED CertificateAssociation &&
@@ -654,7 +679,7 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
{
VFContrMarcaCompType vfControllo = controlliMarca.get(VFTipoControlloType.CATENA_TRUSTED);
AroContrMarcaComp controllo = new AroContrMarcaComp();
- controllo.setAroUsoCertifCaContrMarcas(new ArrayList());
+ controllo.setAroUsoCertifCaContrMarcas(new ArrayList<>());
controllo.setAroMarcaComp(tmpMarcaComp);
tmpMarcaComp.getAroContrMarcaComps().add(controllo);
controllo.setTiContr(VFTipoControlloType.CATENA_TRUSTED.name());
@@ -675,13 +700,7 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
usoCertifCatena.setFirOcsp(ocspTsa);
//
usoCerifiCaContrComp.add(usoCertifCatena);
- // persist
- entityManager.persist(usoCertifCatena);
controllo.getAroUsoCertifCaContrMarcas().add(usoCertifCatena);
-
- // persist
- entityManager.persist(controllo);
-
}
// CONTROLLI MARCA - CERTIFICATO CertificateExpiration
@@ -693,7 +712,6 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
controllo.setTiContr(VFTipoControlloType.CERTIFICATO.name());
controllo.setTiEsitoContrMarca(vfControllo.getTiEsitoContrMarca());
controllo.setDsMsgEsitoContrMarca(vfControllo.getDsMsgEsitoContrMarca());
- entityManager.persist(controllo);
}
// CONTROLLI MARCA - CRL CertificateRevocation
@@ -706,7 +724,6 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
controllo.setFirCrl(crlTsa);
controllo.setTiEsitoContrMarca(vfControllo.getTiEsitoContrMarca());
controllo.setDsMsgEsitoContrMarca(vfControllo.getDsMsgEsitoContrMarca());
- entityManager.persist(controllo);
}
// CONTROLLI MARCA - OCSP CertificateRevocation
@@ -714,7 +731,6 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
VFContrMarcaCompType vfControllo = controlliMarca.get(VFTipoControlloType.OCSP);
AroContrMarcaComp controllo = new AroContrMarcaComp();
controllo.setAroMarcaComp(tmpMarcaComp);
- tmpMarcaComp.getAroContrMarcaComps().add(controllo);
controllo.setTiContr(VFTipoControlloType.OCSP.name());
controllo.setFirOcsp(ocspTsa);
controllo.setTiEsitoContrMarca(vfControllo.getTiEsitoContrMarca());
@@ -734,14 +750,11 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
//
usoCerifiCaContrComp.add(usoCertifOcsp);
- entityManager.persist(usoCertifOcsp);
- //
+
controllo.setAroUsoCertifCaContrMarcas(usoCerifiCaContrComp);
}
//
tmpMarcaComp.getAroContrMarcaComps().add(controllo);
- // persist
- entityManager.persist(controllo);
}
tmpMarcaComp.setFirCertifCa(certificatoTsa);
@@ -749,30 +762,6 @@ private AroMarcaComp buildAroMarcaComp(VFBusta busta, VFMarcaCompType marcaCompT
// } // crl
}
- tmpMarcaComp.setDsMarcaBase64(marcaCompType.getDsMarcaBase64());
- tmpMarcaComp.setDsAlgoMarca(marcaCompType.getDsAlgoMarca());
- tmpMarcaComp.setTmMarcaTemp(XmlDateUtility.xmlGregorianCalendarToDate(marcaCompType.getTmMarcaTemp()));
- tmpMarcaComp.setTiFormatoMarca(marcaCompType.getTiFormatoMarca());
- tmpMarcaComp.setDtScadMarca(XmlDateUtility.xmlGregorianCalendarToDate(marcaCompType.getDtScadMarca()));
-
- tmpMarcaComp.setTiEsitoVerifMarca(marcaCompType.getTiEsitoVerifMarca());
- tmpMarcaComp.setDsMsgEsitoVerifMarca(marcaCompType.getDsMsgEsitoVerifMarca());
-
- tmpMarcaComp.setTiEsitoContrConforme(marcaCompType.getTiEsitoContrConforme());
- tmpMarcaComp.setDsMsgEsitoContrConforme(marcaCompType.getDsMsgEsitoContrConforme());
-
- tmpMarcaComp.setPgBusta(busta.getPgBusta());
- tmpMarcaComp.setPgMarca(marcaCompType.getPgMarca());
-
- if (isDetached) {
- tmpBustaCrittogSottoComp.getAroMarcaComps().add(tmpMarcaComp);
- tmpMarcaComp.setAroBustaCrittog(tmpBustaCrittogSottoComp);
- } else {
- tmpBustaCrittogComp.getAroMarcaComps().add(tmpMarcaComp);
- tmpMarcaComp.setAroBustaCrittog(tmpBustaCrittogComp);
- }
- // Aggiungo la marca al componente e viceversa
-
tmpMarcaComp.setAroCompDoc(tmpTabCDComponente);
tmpTabCDComponente.getAroMarcaComps().add(tmpMarcaComp);
@@ -803,18 +792,13 @@ private FirCertifCa buildFirCertifCa(VFCertifCaType certifCaType) throws Verific
certifCaType.getDlDnIssuerCertifCa());
}
- // FIX MAC 26836, compilo il subject mancante e correggo il subject keyId:
- if (tmpCertificatoCa != null) {
- correggiInformazioniCA(tmpCertificatoCa, certifCaType);
- }
-
// not found
if (tmpCertificatoCa == null) {
tmpCertificatoCa = new FirCertifCa();
- tmpCertificatoCa.setFirUrlDistribCrls(new ArrayList());
- tmpCertificatoCa.setFirUrlDistribOcsps(new ArrayList());
- tmpCertificatoCa.setFirCertifFirmatarios(new ArrayList());
- tmpCertificatoCa.setFirCrls(new ArrayList());
+ tmpCertificatoCa.setFirUrlDistribCrls(new ArrayList<>());
+ tmpCertificatoCa.setFirUrlDistribOcsps(new ArrayList<>());
+ tmpCertificatoCa.setFirCertifFirmatarios(new ArrayList<>());
+ tmpCertificatoCa.setFirCrls(new ArrayList<>());
tmpCertificatoCa.setNiSerialCertifCa(certifCaType.getNiSerialCertifCa());
tmpCertificatoCa.setDsSubjectKeyId(certifCaType.getDsSubjectKeyId());
@@ -845,24 +829,33 @@ private FirCertifCa buildFirCertifCa(VFCertifCaType certifCaType) throws Verific
tmpCertificatoCa.getFirUrlDistribOcsps().add(firUrl);
idx++;
}
-
- // se il file non presente -> non lo si persiste
- if (certifCaType.getFilePerFirma() != null) {
- FirFilePerFirma blobCertCa = new FirFilePerFirma();
- blobCertCa.setTiFilePerFirma(certifCaType.getFilePerFirma().getTiFilePerFirma().name());
- blobCertCa.setBlFilePerFirma(certifCaType.getFilePerFirma().getBlFilePerFirma());
- blobCertCa.setFirCertifCa(tmpCertificatoCa);
- tmpCertificatoCa.setFirFilePerFirma(blobCertCa);
- } else {
- LOG.warn("File per firma non presente per CA serial {} Issuer {} Subject {}",
- tmpCertificatoCa.getNiSerialCertifCa(), tmpCertificatoCa.getDlDnIssuerCertifCa(),
- tmpCertificatoCa.getDlDnSubjectCertifCa());
- }
-
- // persist
- entityManager.persist(tmpCertificatoCa);
} else {
- // pregresso URL OCSP
+ /*
+ * assumo che la CA trovata sul DB non sia correttamente censita; se ci sono differenze aggiorno con le
+ * informazioni prevenienti dalla verifica delle firme.
+ *
+ */
+ if (tmpCertificatoCa.getDlDnSubjectCertifCa() == null
+ || !tmpCertificatoCa.getDlDnSubjectCertifCa().equals(certifCaType.getDlDnSubjectCertifCa())) {
+ tmpCertificatoCa.setDlDnSubjectCertifCa(certifCaType.getDlDnSubjectCertifCa());
+ }
+ boolean isSubjectKeyIdEsistenteNullOrNonValorizzato = tmpCertificatoCa.getDsSubjectKeyId() == null
+ || tmpCertificatoCa.getDsSubjectKeyId().equals("NON_VALORIZZATO");
+ boolean isSubjectKeyIdNuovoNotNullAndValorizzato = certifCaType.getDsSubjectKeyId() != null
+ && !certifCaType.getDsSubjectKeyId().equals("NON_VALORIZZATO");
+ if (isSubjectKeyIdEsistenteNullOrNonValorizzato && isSubjectKeyIdNuovoNotNullAndValorizzato) {
+ tmpCertificatoCa.setDsSubjectKeyId(certifCaType.getDsSubjectKeyId());
+ }
+ /*
+ * aggiornamento di inizio e fine validità del certificato della CA con quelle recepite dalla verifica
+ */
+ tmpCertificatoCa
+ .setDtIniValCertifCa(XmlDateUtility.xmlGregorianCalendarToDate(certifCaType.getDtIniValCertifCa()));
+ tmpCertificatoCa
+ .setDtFinValCertifCa(XmlDateUtility.xmlGregorianCalendarToDate(certifCaType.getDtFinValCertifCa()));
+ /*
+ * gestione del pregresso URL OCSP (qualora non presenti per la CA presente in anagrafica)
+ */
if (tmpCertificatoCa.getFirUrlDistribOcsps().isEmpty()) {
// urls ocsp
int idx = 1;
@@ -878,6 +871,8 @@ private FirCertifCa buildFirCertifCa(VFCertifCaType certifCaType) throws Verific
}
}
}
+ // persist
+ entityManager.persist(tmpCertificatoCa);
/*
* Esitono eccezioni gestibili per questi casi (quelle per cui RispostaControlli#rBoolean dovrebbe valore false?
* Nel caso utilizzare VerificaFirmaException
@@ -885,52 +880,6 @@ private FirCertifCa buildFirCertifCa(VFCertifCaType certifCaType) throws Verific
return tmpCertificatoCa;
}
- /**
- * Assumo che la CA trovata sul DB non sia correttamente censita; se ci sono differenze aggiorno con le informazioni
- * prevenienti dalla verifica delle firme.
- *
- * @param tmpCertificatoCa,
- * entity esistente
- * @param certifCaType,
- * oggetto che identifica la CA proveniente dalla verifica firme
- */
- private void correggiInformazioniCA(FirCertifCa tmpCertificatoCa, VFCertifCaType certifCaType) {
- boolean pleasePersist = false;
- // Controllo su DL_DN_SUBJECT
- if (tmpCertificatoCa.getDlDnSubjectCertifCa() == null
- || !tmpCertificatoCa.getDlDnSubjectCertifCa().equals(certifCaType.getDlDnSubjectCertifCa())) {
- tmpCertificatoCa.setDlDnSubjectCertifCa(certifCaType.getDlDnSubjectCertifCa());
- pleasePersist = true;
- }
- boolean isSubjectKeyIdEsistenteNullOrNonValorizzato = tmpCertificatoCa.getDsSubjectKeyId() == null
- || tmpCertificatoCa.getDsSubjectKeyId().equals("NON_VALORIZZATO");
- boolean isSubjectKeyIdNuovoNotNullAndValorizzato = certifCaType.getDsSubjectKeyId() != null
- && !certifCaType.getDsSubjectKeyId().equals("NON_VALORIZZATO");
- // Controllo su SUBJECT_KEY_ID
- if (isSubjectKeyIdEsistenteNullOrNonValorizzato && isSubjectKeyIdNuovoNotNullAndValorizzato) {
- tmpCertificatoCa.setDsSubjectKeyId(certifCaType.getDsSubjectKeyId());
- pleasePersist = true;
- }
- // controllo su DT_INI_VAL
- if (!tmpCertificatoCa.getDtIniValCertifCa()
- .equals(XmlDateUtility.xmlGregorianCalendarToDate(certifCaType.getDtIniValCertifCa()))) {
- tmpCertificatoCa
- .setDtIniValCertifCa(XmlDateUtility.xmlGregorianCalendarToDate(certifCaType.getDtIniValCertifCa()));
- pleasePersist = true;
- }
- // controllo su DT_FIN_VAL
- if (!tmpCertificatoCa.getDtFinValCertifCa()
- .equals(XmlDateUtility.xmlGregorianCalendarToDate(certifCaType.getDtFinValCertifCa()))) {
- tmpCertificatoCa
- .setDtFinValCertifCa(XmlDateUtility.xmlGregorianCalendarToDate(certifCaType.getDtIniValCertifCa()));
- pleasePersist = true;
- }
-
- if (pleasePersist) {
- entityManager.persist(tmpCertificatoCa);
- }
- }
-
private FirCrl buildFirCrl(VFCrlType crl) throws VerificaFirmaException {
FirCrl tmpFirCrl = null;
@@ -956,17 +905,6 @@ private FirCrl buildFirCrl(VFCrlType crl) throws VerificaFirmaException {
// add on list parent
tmpCertifCa.getFirCrls().add(tmpFirCrl);
- // se il file non presente -> non lo si persiste
- if (crl.getFilePerFirma() != null) {
- FirFilePerFirma tmpFilePerFirma = new FirFilePerFirma();
- tmpFilePerFirma.setTiFilePerFirma(crl.getFilePerFirma().getTiFilePerFirma().name());// TipoFileEnum.CRL.name()
- tmpFilePerFirma.setBlFilePerFirma(crl.getFilePerFirma().getBlFilePerFirma());
- tmpFilePerFirma.setFirCrl(tmpFirCrl);
- tmpFirCrl.setFirFilePerFirma(tmpFilePerFirma);
- } else {
- LOG.warn("File per firma non presente per CRL serial {}", tmpFirCrl.getNiSerialCrl());
- }
-
// persist
entityManager.persist(tmpFirCrl);
}
@@ -1008,18 +946,6 @@ private FirOcsp buildFirOcspWithCertif(VFOcspType ocsp) throws VerificaFirmaExce
// add on list parent
tmpCertifCa.getFirCertifOcsps().add(tmpFirCertifOcsp);
- // se il file non presente -> non lo si persiste
- if (ocsp.getCertifOcsp().getFilePerFirma() != null) {
- FirFilePerFirma tmpFilePerFirma = new FirFilePerFirma();
- tmpFilePerFirma.setTiFilePerFirma(ocsp.getCertifOcsp().getFilePerFirma().getTiFilePerFirma().name());// TipoFileEnum.CERTIF_OCSP.name()
- tmpFilePerFirma.setBlFilePerFirma(ocsp.getCertifOcsp().getFilePerFirma().getBlFilePerFirma());
- tmpFilePerFirma.setFirCertifOcsp(tmpFirCertifOcsp);
- tmpFirCertifOcsp.setFirFilePerFirma(tmpFilePerFirma);
- } else {
- LOG.warn("File per firma non presente per OCSP serial {} issuer {}",
- tmpFirCertifOcsp.getNiSerialCertifOcsp(), tmpFirCertifOcsp.getDlDnSubjectCertifOcsp());
- }
-
// persist
entityManager.persist(tmpFirCertifOcsp);
}
@@ -1044,12 +970,6 @@ private FirOcsp buildFirOcspWithCertif(VFOcspType ocsp) throws VerificaFirmaExce
// add parent
tmpFirCertifOcsp.getFirOcsps().add(tmpFirOcsp);
- FirFilePerFirma tmpFilePerFirma = new FirFilePerFirma();
- tmpFilePerFirma.setTiFilePerFirma(ocsp.getFilePerFirma().getTiFilePerFirma().name());// TipoFileEnum.OCSP.name()
- tmpFilePerFirma.setBlFilePerFirma(ocsp.getFilePerFirma().getBlFilePerFirma());
- tmpFilePerFirma.setFirOcsp(tmpFirOcsp);
- tmpFirOcsp.setFirFilePerFirma(tmpFilePerFirma);
-
// persist
entityManager.persist(tmpFirOcsp);
}
@@ -1099,23 +1019,9 @@ private FirCertifFirmatario buildFirCertifFirmatario(FirCertifCa tmpFirCertifCa,
//
firCertifFirmatario.setFirCertifCa(tmpFirCertifCa);
- tmpFirCertifCa.setFirCertifFirmatarios(new ArrayList());
+ tmpFirCertifCa.setFirCertifFirmatarios(new ArrayList<>());
tmpFirCertifCa.getFirCertifFirmatarios().add(firCertifFirmatario);
- // se il file non presente -> non lo si persiste
- if (certifFirmatarioType.getFilePerFirma() != null) {
- FirFilePerFirma blobCertFirmatario = new FirFilePerFirma();
- blobCertFirmatario
- .setTiFilePerFirma(certifFirmatarioType.getFilePerFirma().getTiFilePerFirma().name());// TipoFileEnum.CERTIF_FIRMATARIO.name()
- blobCertFirmatario.setBlFilePerFirma(certifFirmatarioType.getFilePerFirma().getBlFilePerFirma());
- blobCertFirmatario.setFirCertifFirmatario(firCertifFirmatario);
- //
- firCertifFirmatario.setFirFilePerFirma(blobCertFirmatario);
- } else {
- LOG.warn("File per firma non presente per Firmatario serial {}",
- firCertifFirmatario.getNiSerialCertifFirmatario());
- }
-
// persist
entityManager.persist(firCertifFirmatario);
@@ -1131,7 +1037,7 @@ private FirCertifFirmatario buildFirCertifFirmatario(FirCertifCa tmpFirCertifCa,
}
private void buildFirReport(AroCompDoc tmpVerificaAroCompDoc, VerificaFirmaWrapper wrapper,
- StrutturaVersamento strutV) throws VerificaFirmaException {
+ StrutturaVersamento strutV, String nomeWs) throws VerificaFirmaException {
// servizio verifica firma determinato in precedenza
DecServizioVerificaCompDoc servizioFirma = tmpVerificaAroCompDoc.getDecServizioVerificaCompDoc();
@@ -1203,37 +1109,34 @@ private void buildFirReport(AroCompDoc tmpVerificaAroCompDoc, VerificaFirmaWrapp
// URN
buildFirUrnReport(tmpFirReport, compUrnOrig, compUrnNorm);
- // persist
- entityManager.persist(tmpFirReport);
-
- // aws
- Map awsPutReportZipResult = verificaFirmaReportAwsClient
- .sendReportZipToObjStorage(tmpVerificaAroCompDoc.getIdCompDoc(), tmpFirReport.getIdFirReport(),
- strutV, servizioFirma, tmpFirReport.getFirUrnReports(), reportZip);
- if (awsPutReportZipResult != null) {
- tmpFirReport.setNmBucket(verificaFirmaReportAwsClient.getBucketName());
- tmpFirReport.setCdKeyFile((String) awsPutReportZipResult.keySet().toArray()[0]);
- } else {
- LOG.warn("SalvataggioFirmaManager.buildFirRepor persistenza report verifica firma su BLOB");
- // force insert before update
- entityManager.flush();
- // procedo alla memorizzazione del file sul blob, via JDBC
- WriteCompBlbOracle.DatiAccessori datiAccessori = new WriteCompBlbOracle().new DatiAccessori();
- datiAccessori.setTabellaBlob(WriteCompBlbOracle.TabellaBlob.FIR_REPORT);
- datiAccessori.setIdPadre(tmpFirReport.getIdFirReport());
- //
- FileBinario fileB = new FileBinario();
- fileB.setFileSuDisco(reportZip.toFile());
- RispostaControlli tmpControlli = writeCompBlbOracle.aggiornaStreamSuBlobComp(datiAccessori, fileB);
- if (!tmpControlli.isrBoolean()) {
- throw new VerificaFirmaException(tmpControlli.getCodErr(), tmpControlli.getDsErr());
+ BackendStorage backendVerificaFirme = objectStorageService
+ .lookupBackendByServiceName(strutV.getIdTipologiaUnitaDocumentaria(), nomeWs);
+ if (backendVerificaFirme.isObjectStorage()) {
+
+ ObjectStorageResource savedReport = objectStorageService.createResourceInRerportvf(
+ backendVerificaFirme.getBackendName(), tmpVerificaAroCompDoc.getIdCompDoc(),
+ tmpFirReport.getIdFirReport(), strutV, servizioFirma, tmpFirReport.getFirUrnReports(),
+ reportZip);
+ if (savedReport == null) {
+ // Caso 1: il salvataggio su object storage non è andato a buon fine
+ saveReportFallback(tmpFirReport, reportZip);
+ } else {
+ tmpFirReport.setNmBucket(savedReport.getBucket());
+ tmpFirReport.setCdKeyFile(savedReport.getKey());
+ buildDecBackend(tmpFirReport, backendVerificaFirme.getBackendName());
+
+ // persist
+ entityManager.persist(tmpFirReport);
}
+ } else {
+ // Caso 2: il backend è Database
+ saveReportFallback(tmpFirReport, reportZip);
}
// flush
entityManager.flush();
}
- } /* try */ catch (IOException ex) {
+ } /* try */ catch (IOException | ObjectStorageException ex) {
throw new VerificaFirmaException(MessaggiWSBundle.ERR_666,
MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"SalvataggioFirmaManager.buildFirReport errore generico durante elaborazione file report"
@@ -1251,6 +1154,40 @@ private void buildFirReport(AroCompDoc tmpVerificaAroCompDoc, VerificaFirmaWrapp
}
}
+ /**
+ * Effettua il salvataggio del report su DB. Questo può accadere in due casi:
+ *
+ *
C'è stato un errore sul salvataggio su Object Storage
+ *
Il backend configurato per il salvataggio dei report è il Database
Buffer per la lettura da blob. Il valore è stato preso da {@link BufferedInputStream#DEFAULT_BUFFER_SIZE}.
- *
Hint per la scelta della dimensione del buffer:
{@code SELECT AVG(DBMS_LOB.GETLENGTH
- * ("BL_CONTEN_COMP")) as "Media byte di un documento" FROM aro_contenuto_comp WHERE rownum < 1000000 }
- * Il risultato della dimensione media di un blob (per 1M di blob inseriti) è
- * 253337,3456413456413456413456413456413456 byte.
- */
- private static final int BUFFER = 8192;
-
- private String bucketName;
-
- /**
- * Inizializzazione del client S3. L'indirizzo corretto dovrebbe essere
- * https://s3.storagegrid.ente.regione.emr.it:8082
- */
- @PostConstruct
- private void init() {
- // address
- String storageAddress = configHelper.getParamApplicValue(ParametroApplDB.OBJECT_STORAGE_ADDR);
- // aws credentials
- final String reportvfAccessKeyId = configHelper.getParamApplicValue(ParametroApplDB.REPORTVF_S3_ACCESS_KEY_ID);
- final String reportvfSecretKeyId = configHelper.getParamApplicValue(ParametroApplDB.REPORTVF_S3_SECRET_KEY);
- // recupero le system properties
- final String accessKeyId = System.getProperty(reportvfAccessKeyId);
- final String secretKey = System.getProperty(reportvfSecretKeyId);
- // create basic credentials
- BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKeyId, secretKey);
-
- LOG.info("Sto per effettuare il collegamento all'endpoint S3 [{}]", storageAddress);
- awsClient = AmazonS3Client.builder()
- .withEndpointConfiguration(
- new AwsClientBuilder.EndpointConfiguration(storageAddress, Regions.US_EAST_1.name()))
- .withCredentials(new AWSStaticCredentialsProvider(awsCreds)).withPathStyleAccessEnabled(Boolean.TRUE)
- .build();
-
- // bucket
- bucketName = configHelper.getParamApplicValue(ParametroApplDB.BUCKET_REPORT_VERIFICAFIRMA);
- }
-
- /**
- * Invio report verifica firma (zip archive)
- *
- * @param idCompDoc
- * id componente
- * @param idFirReport
- * id report
- * @param strutV
- * wrapper dati versamento
- * @param servizioFirma
- * servizio verifica firma
- * @param firUrnReports
- * URN generati
- * @param reportZip
- * report verifia firma (zip archive)
- *
- * @return mappa immutabile (single element) con risultato chiamata e chiave file calcolato
- */
- public Map sendReportZipToObjStorage(long idCompDoc, long idFirReport,
- StrutturaVersamento strutV, DecServizioVerificaCompDoc servizioFirma, List firUrnReports,
- Path reportZip) {
- try {
- // calculate key
- final String cdKeyFile = MessaggiWSFormat.formattaComponenteCdKeyFile(strutV.getVersatoreNonverificato(),
- strutV.getChiaveNonVerificata(), idCompDoc, Optional.of(idFirReport),
- AwsFormatter.COMP_REPORTVF_CD_KEY_FILE_FMT);
-
- // 1. generate metadata
- ObjectMetadata metadata = new ObjectMetadata();
- metadata.addUserMetadata("cd-service", servizioFirma.getCdServizio().toString());
- metadata.addUserMetadata("nm-version", servizioFirma.getNmVersione());
- metadata.addUserMetadata("creation-date", format(strutV.getDataVersamento()));
- metadata.setContentType("Content-Type: application/zip; charset=UTF-8");
- metadata.setContentLength(reportZip.toFile().length());
-
- // 2. generate tags
- List tags = new ArrayList<>();
- // Opzionale
- tags.add(new Tag("urn-originale",
- firUrnReports.stream().filter(r -> r.getTiUrn().equals(TiUrnReport.ORIGINALE))
- .collect(Collectors.toList()).get(0).getDsUrn()));
- tags.add(new Tag("urn-normalizzato",
- firUrnReports.stream().filter(r -> r.getTiUrn().equals(TiUrnReport.NORMALIZZATO))
- .collect(Collectors.toList()).get(0).getDsUrn()));
-
- PutObjectResult result = putObjectAsStream(cdKeyFile, metadata, Optional.of(new ObjectTagging(tags)),
- reportZip.toFile());
- // immutable map
- return Collections.singletonMap(cdKeyFile, result);
- } catch (SacerWsException ex) {
- LOG.error("VerificaFirmaReportAwsClient.sendReportZipToObjStorage errore su invio report ad object storage",
- ex);
- return null;
- }
- }
-
- /**
- *
- * Send report file
- *
- * @param key
- * chiave file
- * @param metadata
- * metadati (se esistono)
- * @param tags
- * tag (se esistono)
- * @param reportVerificaFirma
- * file report
- *
- * @return object result from AWS
- *
- * @throws SacerWsException
- * eccezione generica
- */
- private PutObjectResult putObjectAsStream(String key, ObjectMetadata metadata, Optional tags,
- File reportVerificaFirma) throws SacerWsException {
- try {
- // 1. create request (base)
- PutObjectRequest req = new PutObjectRequest(bucketName, key,
- new BufferedInputStream(new FileInputStream(reportVerificaFirma), BUFFER), metadata);
- // 1.b check tags
- if (tags.isPresent()) {
- req.withTagging(tags.get());
- }
- // 2. put object
- return awsClient.putObject(req);
- } catch (AmazonClientException | FileNotFoundException ex) {
- throw new SacerWsException("AWS: Errore generico su invio file, bucketname " + bucketName + " key " + key,
- ex, SacerWsErrorCategory.INTERNAL_ERROR);
- }
- }
-
- /**
- * Nome bucket (da configurazione database)
- *
- * @return nome bucket
- */
- public String getBucketName() {
- return bucketName;
- }
-
- /*
- * Client Shutdown
- */
- @PreDestroy
- private void destroy() {
- LOG.info("Shutdown endpoint S3...");
- if (awsClient != null) {
- awsClient.shutdown();
- }
- }
-
-}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaReportHelper.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaReportHelper.java
index 775a9ff..630cc4a 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaReportHelper.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaReportHelper.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -397,6 +414,7 @@ private ZipArchiveEntry filterZipEntry(ZipArchiveEntry entry) {
return entry;
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
private void marshalReport(Object response, BufferedOutputStream bwriter, boolean prettyPrint)
throws JAXBException {
JAXBContext jc = JAXBContext.newInstance(response.getClass());
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaWrapperManager.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaWrapperManager.java
index 00ef872..782270b 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaWrapperManager.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/ejb/VerificaFirmaWrapperManager.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.ejb;
import java.math.BigInteger;
@@ -7,7 +24,6 @@
import javax.ejb.Stateless;
import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -114,19 +130,18 @@ private VerificaFirmaWrapper invokeEidas(InvokeVerificaInput in, AbsVersamentoEx
try {
wrapper = eidasInvoker.verificaAndWrapIt(in.getComponenteVers(), in.getSottoComponentiFirma(),
in.getSottoComponentiMarca(), in.getAbilitazioni(), in.getDataDiRiferimento(),
- in.isVerificaAllaDataDiFirma(), in.getUuid(), versamento);
+ Boolean.FALSE/* default */, in.getUuid(), versamento);
} catch (VerificaFirmaConnectionException ex) {
/* Errore su invocazione (GRAVE) */
LOG.error("Errore invocazione servizio verifica firma {}", ex.getCdService(), ex);
/* Si passa ad invocazione CRYPTO..... */
} catch (VerificaFirmaGenericInvokeException epex) {
/* Errore restituito da endpoint (gestito) */
- LOG.debug("Risposta con errore restituito da verifica firma {} {}", epex.getCdService(),
- ExceptionUtils.getRootCauseMessage(epex), epex);
+ LOG.debug("Risposta con errore restituito da verifica firma {}", epex.getCdService(), epex);
/* Si passa ad invocazione CRYPTO..... */
} catch (VerificaFirmaWrapperResNotFoundException | VerificaFirmaWrapperGenericException wrapex) {
- /* Errore restituito da endpoint o su wrapping della risposta (GRAVE) */
- LOG.error("Errore wrapping risultato ottenuto da verifica firma EIDAS", wrapex);
+ /* Errore restituito da endpoint o su wrapping della risposta */
+ LOG.warn("Errore generico", wrapex);
/* Si passa ad invocazione CRYPTO..... */
}
return wrapper;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/IVerificaFirmaInvokeException.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/IVerificaFirmaInvokeException.java
index b7a799c..b19c56b 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/IVerificaFirmaInvokeException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/IVerificaFirmaInvokeException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/**
*
*/
@@ -7,4 +24,6 @@ public interface IVerificaFirmaInvokeException {
String getCdService();
-}
\ No newline at end of file
+ String getUrl();
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaConnectionException.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaConnectionException.java
index 1bd67cb..4bb1a55 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaConnectionException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaConnectionException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -46,15 +63,11 @@ public String getCdService() {
return cdService;
}
+ @Override
public String getUrl() {
return url;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#getLocalizedMessage()
- */
@Override
public String getMessage() {
return "Servizio di verifica firma " + getCdService() + " non attivo o non raggiungibile ( " + getUrl() + ")";
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaException.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaException.java
index 05c4f6d..2699ed9 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaGenericInvokeException.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaGenericInvokeException.java
index d9ae61c..566af6c 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaGenericInvokeException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaGenericInvokeException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -48,15 +65,11 @@ public String getCdService() {
return cdService;
}
+ @Override
public String getUrl() {
return url;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#getLocalizedMessage()
- */
@Override
public String getMessage() {
return "Servizio di verifica firma " + getCdService() + " errore generico su gestione risposta da endpoint "
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperGenericException.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperGenericException.java
index 9e963f2..595d7d6 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperGenericException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperGenericException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -38,15 +55,11 @@ public VerificaFirmaWrapper getVerificaFirmaWrapper() {
return wrapper;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#getLocalizedMessage()
- */
@Override
public String getMessage() {
- return "Versione servizio v." + wrapper.getServiceVersion() + " libreria "
- + wrapper.getAdditionalInfo().getServiceCode() + " v. " + wrapper.getLibraryVersion();
+ return "Servizio di verifica firma " + wrapper.getAdditionalInfo().getServiceCode() + " [versione="
+ + wrapper.getServiceVersion() + ", libreria=" + wrapper.getLibraryVersion()
+ + "] errore durante elaborazione report verifica " + super.getMessage();
}
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperResNotFoundException.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperResNotFoundException.java
index c55fe6d..5248cec 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperResNotFoundException.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/exception/VerificaFirmaWrapperResNotFoundException.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -10,9 +27,6 @@
*/
public class VerificaFirmaWrapperResNotFoundException extends Exception {
- /**
- *
- */
private static final long serialVersionUID = 8471637049988191811L;
private final String wichOne;
@@ -21,11 +35,14 @@ public VerificaFirmaWrapperResNotFoundException(String message, String wichOne)
this.wichOne = wichOne;
}
- /**
- * @return the wichOne
- */
public String getWichOne() {
return wichOne;
}
+ @Override
+ public String getMessage() {
+ return "Servizio di verifica firma " + wichOne
+ + " report verifica mancante, non possibile estrarre il risultato per elaborazione successiva.";
+ }
+
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/CryptoWrapperResultStrategy.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/CryptoWrapperResultStrategy.java
index 215c59e..25c3e87 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/CryptoWrapperResultStrategy.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/CryptoWrapperResultStrategy.java
@@ -1,13 +1,33 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.strategy;
import static it.eng.parer.ws.utils.XmlDateUtility.dateToXMLGregorianCalendar;
import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
-import java.util.List;
+import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,10 +43,9 @@
import it.eng.parer.crypto.model.verifica.CryptoFirCertifCa;
import it.eng.parer.crypto.model.verifica.CryptoFirCertifFirmatario;
import it.eng.parer.crypto.model.verifica.CryptoFirCrl;
-import it.eng.parer.crypto.model.verifica.CryptoFirFilePerFirma;
import it.eng.parer.crypto.model.verifica.CryptoFirUrlDistribCrl;
import it.eng.parer.entity.constraint.DecServizioVerificaCompDoc.CdServizioVerificaCompDoc;
-import it.eng.parer.firma.util.VerificaFirmaEnums;
+import it.eng.parer.firma.util.VerificaFirmaEnums.SacerIndication;
import it.eng.parer.firma.xml.VFAdditionalInfoFirmaCompType;
import it.eng.parer.firma.xml.VFAdditionalInfoMarcaCompType;
import it.eng.parer.firma.xml.VFCertifCaType;
@@ -34,30 +53,20 @@
import it.eng.parer.firma.xml.VFContrFirmaCompType;
import it.eng.parer.firma.xml.VFContrMarcaCompType;
import it.eng.parer.firma.xml.VFCrlType;
-import it.eng.parer.firma.xml.VFFilePerFirmaType;
import it.eng.parer.firma.xml.VFFirmaCompType;
import it.eng.parer.firma.xml.VFMarcaCompType;
import it.eng.parer.firma.xml.VFTipoControlloType;
-import it.eng.parer.firma.xml.VFTipoFileType;
import it.eng.parer.firma.xml.VFTipoFirmaType;
import it.eng.parer.firma.xml.VFUrlDistribCrlType;
import it.eng.parer.firma.xml.VerificaFirmaWrapper;
import it.eng.parer.firma.xml.VerificaFirmaWrapper.VFBusta;
-import it.eng.parer.ws.versamento.dto.AbsVersamentoExt;
-
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.Objects;
-import java.util.stream.Collectors;
public class CryptoWrapperResultStrategy implements IVerificaFirmaWrapperResultStrategy {
private final Logger LOG = LoggerFactory.getLogger(CryptoWrapperResultStrategy.class);
- private AbsVersamentoExt versamento;
-
- public CryptoWrapperResultStrategy(AbsVersamentoExt versamento) {
- this.versamento = versamento;
+ public CryptoWrapperResultStrategy() {
+ super();
}
@Override
@@ -66,7 +75,7 @@ public String getCode() {
}
@Override
- public void fromVerificaOutOnWrapper(CryptoAroCompDoc result, VerificaFirmaWrapper wrapper, ZonedDateTime dtRef) {
+ public void fromVerificaOutOnWrapper(CryptoAroCompDoc result, VerificaFirmaWrapper wrapper) {
// Inizio e fine validazione
wrapper.setStartDate(dateToXMLGregorianCalendar(result.getInizioValidazione()));
@@ -333,8 +342,8 @@ private VFFirmaCompType buildFirma(CryptoAroFirmaComp cryptoFirma) {
// Aggiungo il controllo OCSP (con esito NON_NECESSARIO)
VFContrFirmaCompType contrFirmaCompOCSP = new VFContrFirmaCompType();
contrFirmaCompOCSP.setTiContr(VFTipoControlloType.OCSP);
- contrFirmaCompOCSP.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrFirmaCompOCSP.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.message());
+ contrFirmaCompOCSP.setTiEsitoContrFirma(SacerIndication.NON_NECESSARIO.name());
+ contrFirmaCompOCSP.setDsMsgEsitoContrFirma(SacerIndication.NON_NECESSARIO.message());
firma.getContrFirmaComps().add(contrFirmaCompOCSP);
firma.setDlDnFirmatario(cryptoFirma.getDlDnFirmatario());
@@ -448,8 +457,8 @@ private VFMarcaCompType buildMarca(CryptoAroMarcaComp cryptoMarca) {
// Aggiungo il controllo OCSP (con esito NON_NECESSARIO)
VFContrMarcaCompType contrMarcaCompOCSP = new VFContrMarcaCompType();
contrMarcaCompOCSP.setTiContr(VFTipoControlloType.OCSP);
- contrMarcaCompOCSP.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrMarcaCompOCSP.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.message());
+ contrMarcaCompOCSP.setTiEsitoContrMarca(SacerIndication.NON_NECESSARIO.name());
+ contrMarcaCompOCSP.setDsMsgEsitoContrMarca(SacerIndication.NON_NECESSARIO.message());
marca.getContrMarcaComps().add(contrMarcaCompOCSP);
return marca;
@@ -470,11 +479,7 @@ private VFCertifFirmatarioType buildFirmatario(CryptoFirCertifFirmatario cryptoF
certifFirmatario.setDtFinValCertifFirmatario(
dateToXMLGregorianCalendar(cryptoFirmatario.getDtFinValCertifFirmatario()));
certifFirmatario.setNiSerialCertifFirmatario(cryptoFirmatario.getNiSerialCertifFirmatario());
- if (cryptoFirmatario.getFirFilePerFirma() != null) {
- VFFilePerFirmaType filePerFirmaFirmatario = buildFilePerFirma(cryptoFirmatario.getFirFilePerFirma());
- certifFirmatario.setFilePerFirma(filePerFirmaFirmatario);
- }
if (cryptoFirmatario.getFirCertifCa() != null) {
VFCertifCaType certifCA = buildCertifCA(cryptoFirmatario.getFirCertifCa());
certifFirmatario.setCertifCaFirmatario(certifCA);
@@ -509,36 +514,9 @@ private VFCertifCaType buildCertifCA(CryptoFirCertifCa cryptoCa) {
certifCA.getUrlDistribCrls().add(urlDistribCrlType);
}
- // Blob della firma può essere NULL?
- if (cryptoCa.getFirFilePerFirma() != null) {
- VFFilePerFirmaType filePerFirma = buildFilePerFirma(cryptoCa.getFirFilePerFirma());
- certifCA.setFilePerFirma(filePerFirma);
- }
return certifCA;
}
- /**
- * Compila la busta che contiene il blob, e relativi metadati, contenente:
- *
- *
{@link VFTipoFileType#CERTIF_CA}
- *
{@link VFTipoFileType#CERTIF_CRL}
- *
{@link VFTipoFileType#CERTIF_FIRMATARIO}
- *
- *
- * @param crytpoFilePerFirma
- * Modello restituito da crypto
- *
- * @return modello di file per firma del wrapper
- */
- private VFFilePerFirmaType buildFilePerFirma(CryptoFirFilePerFirma crytpoFilePerFirma) {
- VFFilePerFirmaType filePerFirma = new VFFilePerFirmaType();
- filePerFirma.setNmFileDownload(crytpoFilePerFirma.getNmFileDownload());
- filePerFirma.setBlFilePerFirma(crytpoFilePerFirma.getBlFilePerFirma());
- // FIXME enum
- filePerFirma.setTiFilePerFirma(VFTipoFileType.valueOf(crytpoFilePerFirma.getTiFilePerFirma()));
- return filePerFirma;
- }
-
/**
* Compila la busta relativa alle CRL. ATTENZIONE: il blob delle crl ({@code parerCrl.getEncoded()}) può
* arrivare a superare i 40MB.
@@ -553,8 +531,6 @@ private VFCrlType buildCrl(CryptoFirCrl cryptoCrl) {
crl.setDtIniCrl(dateToXMLGregorianCalendar(cryptoCrl.getDtIniCrl()));
crl.setDtScadCrl(dateToXMLGregorianCalendar(cryptoCrl.getDtScadCrl()));
crl.setNiSerialCrl(cryptoCrl.getNiSerialCrl());
- VFFilePerFirmaType buildFilePerFirma = buildFilePerFirma(cryptoCrl.getFirFilePerFirma());
- crl.setFilePerFirma(buildFilePerFirma);
CryptoFirCertifCa firCertifCa = cryptoCrl.getFirCertifCa();
VFCertifCaType buildCertifCA = buildCertifCA(firCertifCa);
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasBaseWrapperResult.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasBaseWrapperResult.java
deleted file mode 100644
index 7718c00..0000000
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasBaseWrapperResult.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package it.eng.parer.firma.strategy;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlMessage;
-import eu.europa.esig.dss.diagnostic.AbstractTokenProxy;
-import eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper;
-import eu.europa.esig.dss.diagnostic.CertificateWrapper;
-import eu.europa.esig.dss.enumerations.CertificateSourceType;
-import eu.europa.esig.dss.enumerations.RevocationType;
-import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
-import it.eng.parer.firma.exception.VerificaFirmaWrapperGenericException;
-import it.eng.parer.firma.xml.VerificaFirmaWrapper;
-import java.time.ZonedDateTime;
-import static it.eng.parer.util.DateUtilsConverter.convert;
-
-public abstract class EidasBaseWrapperResult {
-
- private static final Logger LOG = LoggerFactory.getLogger(EidasBaseWrapperResult.class);
-
- protected String getCertificateCAId(AbstractTokenProxy sigts, CertificateWrapper xmlcertificate) {
- // se trusted o selfsigned è la CA
- if (xmlcertificate.isTrusted() || xmlcertificate.isSelfSigned()) {
- return xmlcertificate.getId();
- }
- // se non è la CA la individua dalla chain
- // nota : non esiste più di una CA nella catena
- if (sigts.isTrustedChain()) {
- return sigts.getCertificateChain().stream()
- .filter(c -> c.getSources().contains(CertificateSourceType.TRUSTED_STORE)
- || c.getSources().contains(CertificateSourceType.TRUSTED_LIST))
- .collect(Collectors.toList()).get(0).getId();
- }
- // verifica se esite in chain un certificato selfsigned
- if (sigts.getCertificateChain().stream().anyMatch(c -> c.isSelfSigned())) {
- return sigts.getCertificateChain().stream().filter(c -> c.isSelfSigned()).collect(Collectors.toList())
- .get(0).getId();
- }
-
- // ultimo scenario : restituisce l'id dell'ultimo elemento della catena
- return sigts.getCertificateChain().get(sigts.getCertificateChain().size() - 1).getId();
- }
-
- protected CertificateRevocationWrapper findRevocationByType(CertificateWrapper certificate, ZonedDateTime dtRef,
- RevocationType type) {
- //
- CertificateRevocationWrapper revocation = null;
- // no revocation
- if (certificate.getCertificateRevocationData().stream().noneMatch(r -> r.getRevocationType().equals(type))) {
- // null
- return revocation;
- }
-
- // extract revocations by source type
- List revocationFilteredBySource = certificate.getCertificateRevocationData()
- .stream().filter(r -> r.getRevocationType().equals(type)).collect(Collectors.toList());
-
- // get only one
- if (revocationFilteredBySource.size() == 1) {
- revocation = revocationFilteredBySource.get(0);
- } else {
- //
- List revocationFilteredByOriginDate = null;
-
- // filter by RevocationOrigin (EXTERNAL / CACHED)
- // verify
- // https://github.com/esig/dss/blob/5.8/dss-enumerations/src/main/java/eu/europa/esig/dss/enumerations/RevocationOrigin.java
- if (revocationFilteredBySource.stream().filter(c -> !c.getOrigin().isInternalOrigin()).count() != 0) {
- revocationFilteredByOriginDate = revocationFilteredBySource.stream()
- .filter(c -> !c.getOrigin().isInternalOrigin()).collect(Collectors.toList());
- } else if (revocationFilteredBySource.stream().filter(c -> c.getOrigin().isInternalOrigin()).count() != 0) {
- // filter by RevocationOrigin (embedded)
- revocationFilteredByOriginDate = revocationFilteredBySource.stream()
- .filter(c -> c.getOrigin().isInternalOrigin()).collect(Collectors.toList());
- } else {
- // filter by date
- revocationFilteredByOriginDate = revocationFilteredBySource.stream().filter(
- c -> c.getThisUpdate().after(convert(dtRef)) && c.getNextUpdate().before(convert(dtRef)))
- .collect(Collectors.toList());
- }
-
- // error
- if (revocationFilteredByOriginDate.isEmpty() && LOG.isErrorEnabled()) {
- LOG.error("{} certificate id {} not found", type.name(), certificate.getId());
- // null
- return revocation;
- }
-
- // warn
- if (revocationFilteredByOriginDate.size() > 1 && LOG.isWarnEnabled()) {
- LOG.warn("{} certificate id {} more than one (get first of list)", type.name(), certificate.getId());
- }
- // get first
- revocation = revocationFilteredByOriginDate.get(0);
- }
- //
- return revocation;
- }
-
- /*
- * OCSP REVOCATION + CERTIFICATE
- */
-
- /*
- * Accedendo fino all'ultimo elemento a partire da sinistra percorrendo i successivi livelli
- *
- */
- protected String getMimeTypeUnsigned(EidasWSReportsDTOTree parent, List child) {
- // condizioni di uscita
- // ultimo elemento unsigned non trovato
- if (child == null || child.isEmpty()) {
- return parent.getMimeType();
- }
- // left child
- EidasWSReportsDTOTree leftChild = child.get(0);
- // mime found
- if (leftChild.isUnsigned()) {
- return leftChild.getMimeType();
- } else {
- return getMimeTypeUnsigned(leftChild, leftChild.getChildren());
- }
-
- }
-
- protected void logEidasConclusion(CertificateWrapper certificate, XmlConclusion conclusion) {
- logEidasConclusion(certificate, conclusion, null);
- }
-
- protected void logEidasConclusion(CertificateWrapper certificate, XmlConclusion conclusion, String tipo) {
- StringBuilder msg = new StringBuilder();
- if (conclusion.getWarnings().stream().count() != 0) {
- msg.append(conclusion.getWarnings().stream().map(XmlMessage::getValue).collect(Collectors.joining(";")));
- }
- if (conclusion.getErrors().stream().count() != 0) {
- msg.append(conclusion.getErrors().stream().map(XmlMessage::getValue).collect(Collectors.joining(";")));
- }
- LOG.debug("EIDAS FIRMA CONCLUSION ID = {} {}, msg {}", certificate.getId(),
- tipo == null ? "" : " tipo controllo " + tipo, msg);
- }
-
- protected static class EidasWrapperResultControl {
-
- private EidasWrapperResultControl() {
- throw new IllegalStateException("Utility class");
- }
-
- public static void fieldCannotBeNull(VerificaFirmaWrapper wrapper, Object obj, String fieldName,
- Optional param) throws VerificaFirmaWrapperGenericException {
- try {
- Method getField = findMethod(obj, fieldName);
- if (getField.invoke(obj) == null) {
- final String msg = "[" + obj.getClass().getName() + " nome campo " + fieldName + " risulta null, "
- + (param.isPresent() ? " EIDAS signature id = " + param.get() : "") + "]";
- LOG.error(msg);
- //
- throw new VerificaFirmaWrapperGenericException(msg, wrapper);
- }
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | NoSuchMethodException | SecurityException e) {
- throw new VerificaFirmaWrapperGenericException(e, wrapper);
- }
- }
-
- private static Method findMethod(Object obj, String fieldName) throws NoSuchMethodException {
- Method getField;
- try {
- getField = obj.getClass().getDeclaredMethod("get" + StringUtils.capitalize(fieldName));
- } catch (NoSuchMethodException e) {
- getField = obj.getClass().getSuperclass().getDeclaredMethod("get" + StringUtils.capitalize(fieldName));
- }
- return getField;
- }
- }
-
-}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasWrapperResultStrategy.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasWrapperResultStrategy.java
index c859d9b..99cc251 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasWrapperResultStrategy.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/EidasWrapperResultStrategy.java
@@ -1,100 +1,82 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.strategy;
+import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
-import java.time.LocalDate;
-import java.time.ZoneId;
import java.time.ZonedDateTime;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlCV;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlISC;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlRAC;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlSubXCV;
-import eu.europa.esig.dss.detailedreport.jaxb.XmlXCV;
-import eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper;
-import eu.europa.esig.dss.diagnostic.CertificateWrapper;
-import eu.europa.esig.dss.diagnostic.RevocationWrapper;
import eu.europa.esig.dss.diagnostic.SignatureWrapper;
import eu.europa.esig.dss.diagnostic.TimestampWrapper;
-import eu.europa.esig.dss.enumerations.Indication;
-import eu.europa.esig.dss.enumerations.RevocationType;
-import eu.europa.esig.dss.enumerations.SignatureLevel;
-import eu.europa.esig.dss.enumerations.SubIndication;
import eu.europa.esig.dss.validation.reports.Reports;
+import it.eng.parer.eidas.model.EidasValidationResponse;
import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
-import it.eng.parer.eidas.model.EsitoValidazioneEidas;
-import it.eng.parer.eidas.model.ExtensionsDTO;
import it.eng.parer.entity.constraint.DecServizioVerificaCompDoc.CdServizioVerificaCompDoc;
-import it.eng.parer.firma.exception.VerificaFirmaWrapperGenericException;
-import it.eng.parer.firma.util.VerificaFirmaEnums;
+import it.eng.parer.firma.strategy.eidas.EidasBaseWrapperResult;
+import it.eng.parer.firma.strategy.eidas.factory.EidasVFFirmaCompBuilder;
+import it.eng.parer.firma.strategy.eidas.factory.EidasVFMarcaCompBuilder;
import it.eng.parer.firma.xml.VFAdditionalInfoBustaType;
-import it.eng.parer.firma.xml.VFAdditionalInfoFirmaCompType;
-import it.eng.parer.firma.xml.VFAdditionalInfoMarcaCompType;
-import it.eng.parer.firma.xml.VFCertifCaType;
-import it.eng.parer.firma.xml.VFCertifFirmatarioType;
-import it.eng.parer.firma.xml.VFCertifOcspType;
-import it.eng.parer.firma.xml.VFContrFirmaCompType;
-import it.eng.parer.firma.xml.VFContrMarcaCompType;
-import it.eng.parer.firma.xml.VFCrlType;
-import it.eng.parer.firma.xml.VFFilePerFirmaType;
import it.eng.parer.firma.xml.VFFirmaCompType;
import it.eng.parer.firma.xml.VFMarcaCompType;
-import it.eng.parer.firma.xml.VFOcspType;
-import it.eng.parer.firma.xml.VFTipoControlloType;
-import it.eng.parer.firma.xml.VFTipoFileType;
-import it.eng.parer.firma.xml.VFTipoFirmaType;
-import it.eng.parer.firma.xml.VFUrlDistribCrlType;
-import it.eng.parer.firma.xml.VFUrlDistribOcspType;
import it.eng.parer.firma.xml.VerificaFirmaWrapper;
import it.eng.parer.firma.xml.VerificaFirmaWrapper.VFBusta;
-import it.eng.parer.ws.utils.ParametroApplDB.ParametroApplFl;
-import it.eng.parer.ws.versamento.dto.AbsVersamentoExt;
import it.eng.parer.ws.utils.Costanti;
import it.eng.parer.ws.utils.XmlDateUtility;
public class EidasWrapperResultStrategy extends EidasBaseWrapperResult
- implements IVerificaFirmaWrapperResultStrategy {
+ implements IVerificaFirmaWrapperResultStrategy {
private static final Logger LOG = LoggerFactory.getLogger(EidasWrapperResultStrategy.class);
- private static final String LOG_FMT_SUBINDICATION = "Eidas esito = {} controllo tipo = {} subindication = {}";
- private boolean verificaAllaDataDiFirma;
private Map controlliAbilitati;
- private AbsVersamentoExt versamento;
-
- private static final int PG_BUSTA = 0;
- private static final int PG_FIRMA = 1;
- private static final int PG_MARCA = 2;
+ private boolean isDataDiRiferimentoOnCompVers;
+ private ZonedDateTime dataDiRiferimento;
+ private Set modificatoriWSCalc;
/**
* Firma necessaria al costrutture per le logiche successive che serviranno a determinare, sulla base dell'output di
* verifica, come gestire determinate casistiche (vedi controlli e tipo rif alla data)
- *
- * @param verificaAllaDataDiFirma
- * boolean true/false per verifica alla data firma
- * @param versamento
- * astrazione con metadati di versamento
*
* @param controlliAbilitati
* lista dei controlli (flag true/false)
+ * @param isDataDiRiferimentoOnCompVers
+ * data di riferimento specificata su componente
+ * @param dataDiRiferimento
+ * data di rifiremento da utilizzare per verifica firma
+ * @param modificatoriWSCalc
+ * modificatori versione SIP
*/
- public EidasWrapperResultStrategy(boolean verificaAllaDataDiFirma, Map controlliAbilitati,
- AbsVersamentoExt versamento) {
- this.verificaAllaDataDiFirma = verificaAllaDataDiFirma;
+ public EidasWrapperResultStrategy(Map controlliAbilitati, boolean isDataDiRiferimentoOnCompVers,
+ ZonedDateTime dataDiRiferimento, Set modificatoriWSCalc) {
+ super();
this.controlliAbilitati = controlliAbilitati;
- this.versamento = versamento;
+ this.isDataDiRiferimentoOnCompVers = isDataDiRiferimentoOnCompVers;
+ this.dataDiRiferimento = dataDiRiferimento;
+ this.modificatoriWSCalc = modificatoriWSCalc;
}
@Override
@@ -102,17 +84,9 @@ public String getCode() {
return CdServizioVerificaCompDoc.EIDAS.name();
}
- private Map getControlliAbilitati() {
- return controlliAbilitati;
- }
-
- private boolean isVerificaAllaDataDiFirma() {
- return verificaAllaDataDiFirma;
- }
-
@Override
- public void fromVerificaOutOnWrapper(EsitoValidazioneEidas esito, VerificaFirmaWrapper wrapper, ZonedDateTime dtRef)
- throws VerificaFirmaWrapperGenericException {
+ public void fromVerificaOutOnWrapper(EidasValidationResponse esito, VerificaFirmaWrapper wrapper)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
/*
* Nota: contatori GLOBALI
*/
@@ -140,40 +114,33 @@ public void fromVerificaOutOnWrapper(EsitoValidazioneEidas esito, VerificaFirmaW
}
wrapper.getAdditionalInfo().setTikaMime(tikaMime);
//
- compileWrapper(wrapper, esito.getEidasWSReportsDTOTree(), dtRef, pgs);
+ compileWrapper(wrapper, esito.getEidasWSReportsDTOTree(), pgs);
}
- private void compileWrapper(VerificaFirmaWrapper wrapper, EidasWSReportsDTOTree dto, ZonedDateTime dtRef,
- BigDecimal[] pgs) throws VerificaFirmaWrapperGenericException {
+ private void compileWrapper(VerificaFirmaWrapper wrapper, EidasWSReportsDTOTree dto, BigDecimal[] pgs)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// root element
if (!dto.isParent()) {
- // reports by dss
- Reports reports = new Reports(dto.getReport().getDiagnosticData(), dto.getReport().getDetailedReport(),
- dto.getReport().getSimpleReport(), null /* validation report non gestito */);
- pgs = buildBusta(wrapper, dtRef, dto, reports, pgs);
+ // build busta
+ buildBusta(wrapper, dto, pgs);
}
- // per ogni figlio
- for (EidasWSReportsDTOTree child : dto.getChildren()) {
- if (child.isUnsigned() /* ultimo livello documento non firmato */) {
- break;
- }
- if (child.getReport().getSimpleReport()
- .getSignaturesCount() != 0/* report "valido" esiste almeno una firma */) {
- // reports by dss
- Reports reports = new Reports(child.getReport().getDiagnosticData(),
- child.getReport().getDetailedReport(), child.getReport().getSimpleReport(),
- null /* validation report non gestito */);
- pgs = buildBusta(wrapper, dtRef, child, reports, pgs);
- // recursive call
- compileWrapper(wrapper, child, dtRef, pgs);
- }
+ // only signed child && at least one signature
+ List childSigned = dto.getChildren().stream()
+ .filter(c -> !c.isUnsigned() && c.getReport().getSimpleReport().getSignaturesCount() != 0)
+ .collect(Collectors.toList());
+ for (EidasWSReportsDTOTree child : childSigned) {
+ // build busta
+ buildBusta(wrapper, child, pgs);
+ // recursive
+ compileWrapper(wrapper, child, pgs);
}
}
- private BigDecimal[] buildBusta(VerificaFirmaWrapper wrapper, ZonedDateTime dtRef, EidasWSReportsDTOTree tree,
- Reports reports, BigDecimal[] pgs) throws VerificaFirmaWrapperGenericException {
- // Extensions
- Map extensions = tree.getExtensions();
+ private void buildBusta(VerificaFirmaWrapper wrapper, EidasWSReportsDTOTree dto, BigDecimal[] pgs)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // reports by dss
+ Reports reports = new Reports(dto.getReport().getDiagnosticData(), dto.getReport().getDetailedReport(),
+ dto.getReport().getSimpleReport(), null /* validation report non gestito */);
// creo busta
VFBusta busta = new VFBusta();
@@ -192,33 +159,24 @@ private BigDecimal[] buildBusta(VerificaFirmaWrapper wrapper, ZonedDateTime dtRe
// strutta per gestione firme e contro firme
Map firmaCompParent = new HashMap<>();
for (SignatureWrapper signature : signatures) {
-
- // FIRMA
- VFFirmaCompType firmaCompType = new VFFirmaCompType();
- // set setPgFirma
- firmaCompType.setPgFirma(pgs[PG_FIRMA]);
- // set id (id componente PARER)
- firmaCompType.setId(tree.getIdComponente());
-
// build firma
- buildFirmaComp(wrapper, extensions, firmaCompType, signature, dtRef, reports);
+ VFFirmaCompType firmaCompType = new EidasVFFirmaCompBuilder().create(controlliAbilitati,
+ isDataDiRiferimentoOnCompVers, dataDiRiferimento, modificatoriWSCalc, dto, wrapper, signature,
+ Optional.empty(), pgs);
// inc pgFirma
pgs[PG_FIRMA] = pgs[PG_FIRMA].add(BigDecimal.ONE);
// marche temporali
for (TimestampWrapper ts : signature.getTimestampList()) {
- // MARCHE
- VFMarcaCompType marcaCompType = new VFMarcaCompType();
- // set pgMarche
- marcaCompType.setPgMarca(pgs[PG_MARCA]);
- // set id (id componente PARER)
- marcaCompType.setId(tree.getIdComponente());
+ // build marca
+ VFMarcaCompType marcaCompType = new EidasVFMarcaCompBuilder().create(controlliAbilitati,
+ isDataDiRiferimentoOnCompVers, dataDiRiferimento, modificatoriWSCalc, dto, wrapper, signature,
+ Optional.of(ts), pgs);
+
// add on list
firmaCompType.getMarcaComps().add(marcaCompType);
- // build marca
- buildMarcaComp(wrapper, reports, extensions, marcaCompType, ts, signature.getSignatureFormat(), dtRef);
// inc pgMarche
pgs[PG_MARCA] = pgs[PG_MARCA].add(BigDecimal.ONE);
}
@@ -238,1513 +196,6 @@ private BigDecimal[] buildBusta(VerificaFirmaWrapper wrapper, ZonedDateTime dtRe
});
}
}
-
- return pgs;
- }
-
- private void buildMarcaComp(VerificaFirmaWrapper wrapper, Reports reports, Map extensions,
- VFMarcaCompType marcaCompType, TimestampWrapper ts, SignatureLevel signatureFormat, ZonedDateTime dtRef)
- throws VerificaFirmaWrapperGenericException {
-
- // add info (empty)
- VFAdditionalInfoMarcaCompType additionalInfoMarcaCompType = new VFAdditionalInfoMarcaCompType();
- marcaCompType.setAdditionalInfo(additionalInfoMarcaCompType);
-
- // ********************************
- // USED CERTIFICATE
- // ********************************
- // CERTIFICATO TSA + BLOB
- VFCertifCaType certifCaType = new VFCertifCaType();
- marcaCompType.setCertifTsa(certifCaType);
-
- CertificateWrapper xmlcertificateTsa = reports.getDiagnosticData()
- .getUsedCertificateById(ts.getSigningCertificate().getId());
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateTsa, "serialNumber",
- Optional.ofNullable(ts.getSigningCertificate().getId()));
- certifCaType.setNiSerialCertifCa(new BigDecimal(xmlcertificateTsa.getSerialNumber()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateTsa, "notAfter",
- Optional.ofNullable(ts.getSigningCertificate().getId()));
- certifCaType.setDtFinValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateTsa.getNotAfter()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateTsa, "notBefore",
- Optional.ofNullable(ts.getSigningCertificate().getId()));
- certifCaType.setDtIniValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateTsa.getNotBefore()));
-
- // check subjectKeyId
- if (extensions.containsKey(xmlcertificateTsa.getId())) {
- certifCaType.setDsSubjectKeyId(extensions.get(xmlcertificateTsa.getId()).getSubjectKeyIdentifier());
- }
-
- int urlIdx = 1;
- for (String url : xmlcertificateTsa.getCRLDistributionPoints()) {
- VFUrlDistribCrlType urlDistribCrlType = new VFUrlDistribCrlType();
- urlDistribCrlType.setDlUrlDistribCrl(url);
- urlDistribCrlType.setNiOrdUrlDistribCrl(new BigDecimal(urlIdx));
-
- certifCaType.getUrlDistribCrls().add(urlDistribCrlType);
-
- // inc idc
- urlIdx++;
- }
- // CA
- String certificateCAId = getCertificateCAId(ts, xmlcertificateTsa);
- //
- CertificateWrapper xmlcertificateCA = reports.getDiagnosticData().getUsedCertificateById(certificateCAId);
- // ocsp (from CA+certificate)
- Iterable ocspCombinedUrls = CollectionUtils.union(xmlcertificateCA.getOCSPAccessUrls(),
- xmlcertificateTsa.getOCSPAccessUrls());
- // ocsp
- urlIdx = 1;
- for (String url : ocspCombinedUrls) {
- VFUrlDistribOcspType urlDistribOcspType = new VFUrlDistribOcspType();
- urlDistribOcspType.setDlUrlDistribOcsp(url);
- urlDistribOcspType.setNiOrdUrlDistribOcsp(new BigDecimal(urlIdx));
-
- certifCaType.getUrlDistribOcsps().add(urlDistribOcspType);
- // inc idx
- urlIdx++;
- }
-
- certifCaType.setDlDnIssuerCertifCa(xmlcertificateTsa.getCertificateIssuerDN());
- certifCaType.setDlDnSubjectCertifCa(xmlcertificateTsa.getCertificateDN());
-
- VFFilePerFirmaType filePerFirmaType = new VFFilePerFirmaType();
- certifCaType.setFilePerFirma(filePerFirmaType);
-
- filePerFirmaType.setBlFilePerFirma(xmlcertificateTsa.getBinaries());
- filePerFirmaType.setTiFilePerFirma(VFTipoFileType.CERTIF_CA);
-
- // *************************
- // nullable element
- String dsAlgoMarca = null;
- if (ts.getDigestAlgorithm() != null && ts.getEncryptionAlgorithm() != null) {
- dsAlgoMarca = ts.getDigestAlgorithm().getName().concat("with")
- .concat(ts.getEncryptionAlgorithm().getName());
- }
- marcaCompType.setDsAlgoMarca(dsAlgoMarca);
- marcaCompType.setTmMarcaTemp(XmlDateUtility.dateToXMLGregorianCalendar(ts.getProductionTime()));
- marcaCompType.setTiFormatoMarca(signatureFormat.toString());// ereditato dalla firma
- marcaCompType.setDtScadMarca(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateTsa.getNotAfter()));
- // check marcaBase64
- if (extensions.containsKey(ts.getId())) {
- marcaCompType.setDsMarcaBase64(extensions.get(ts.getId()).getMarcaBase64());
- }
- /**
- * CONTROLLI / ESITI MARCA
- */
- // building block
- XmlBasicBuildingBlocks bbb = reports.getDetailedReport().getBasicBuildingBlockById(ts.getId());
- if (bbb == null) {
- // TOFIX: cosa fare in questi casi ?!
- LOG.warn("BasicBuildingBlockById not found TS ID = {}", ts.getId());
- }
- // CONTROLLI MARCA
- buildContrMarcaComp(marcaCompType, ts, xmlcertificateTsa, bbb);
-
- // esito controllo CERTIFICATO
- VFContrMarcaCompType contrMarcaCompCert = marcaCompType.getContrMarcaComps().stream()
- .filter(c -> c.getTiContr().equals(VFTipoControlloType.CERTIFICATO)).collect(Collectors.toList())
- .get(0);
-
- // OCSP
- buildMarcaCompTSAwithOCSP(wrapper, marcaCompType, reports, xmlcertificateTsa, dtRef, extensions, bbb);
-
- // CRL
- buildMarcaCompTSAwithCRL(wrapper, marcaCompType, certifCaType, xmlcertificateTsa, dtRef, extensions, bbb,
- contrMarcaCompCert);
-
- }
-
- /*
- * Nota: non possiamo persistere più di una CRL (non supportato), viene costruita un'apposita lista "filtrata" con
- * il solo elemento utile
- *
- */
- private void buildMarcaCompTSAwithCRL(VerificaFirmaWrapper wrapper, VFMarcaCompType marcaCompType,
- VFCertifCaType certifCaType, CertificateWrapper xmlcertificateTsa, ZonedDateTime dtRef,
- Map extensions, XmlBasicBuildingBlocks bbb, VFContrMarcaCompType contrMarcaCompCert)
- throws VerificaFirmaWrapperGenericException {
-
- // OCSP prioritario rispetto CRL
- boolean hasOcsp = xmlcertificateTsa.getCertificateRevocationData().stream()
- .anyMatch(r -> r.getRevocationType().equals(RevocationType.OCSP));
-
- // CRL
- RevocationWrapper crl = findRevocationByType(xmlcertificateTsa, dtRef, RevocationType.CRL);
- if (hasOcsp || crl == null) {
- //
- buildContrCRLNotFoundMarcaComp(marcaCompType, xmlcertificateTsa, hasOcsp);
- return;
- } // no crl
-
- // CRL
- VFCrlType crlTypeTsa = buildCrl(wrapper, extensions, crl);
- // CRL : CA
- crlTypeTsa.setCertifCa(certifCaType);
- // MARCA : CRL
- marcaCompType.setCrlTsa(crlTypeTsa);
-
- // controlli CRL
- buildContrCRLMarcaComp(marcaCompType, xmlcertificateTsa, crl, bbb, contrMarcaCompCert, hasOcsp);
- // CRL - End
- }
-
- private void buildMarcaCompTSAwithOCSP(VerificaFirmaWrapper wrapper, VFMarcaCompType marcaCompType, Reports reports,
- CertificateWrapper xmlcertificateTsa, ZonedDateTime dtRef, Map extensions,
- XmlBasicBuildingBlocks bbb) throws VerificaFirmaWrapperGenericException {
- // verifica presenza CRL
- boolean hasCrl = xmlcertificateTsa.getCertificateRevocationData().stream()
- .anyMatch(r -> r.getRevocationType().equals(RevocationType.CRL));
-
- // OCSP
- CertificateRevocationWrapper ocsp = findRevocationByType(xmlcertificateTsa, dtRef, RevocationType.OCSP);
- if (ocsp == null) {
- //
- buildContrOCSPNotFoundMarcaComp(marcaCompType, xmlcertificateTsa, hasCrl);
- return;
- } // no crl
-
- // CA
- VFCertifCaType certifCaOcspType = buildOcspCertifCA(wrapper, reports, xmlcertificateTsa, extensions, ocsp);
-
- // build OCSP
- VFOcspType ocspTypeTsa = buildOcspWithCertif(wrapper, certifCaOcspType, ocsp);
- marcaCompType.setOcspTsa(ocspTypeTsa);
- //
- // CRONTROLLI OCSP
- buildContrOCSPMarcaComp(marcaCompType, xmlcertificateTsa, ocsp, bbb, hasCrl);
- // OCSP - End
- }
-
- private void buildContrCRLNotFoundMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
- boolean hasOcsp) {
- buildContrCRLMarcaComp(marcaCompType, xmlcertificateTsa, null, null, null, hasOcsp);
- }
-
- private void buildContrCRLMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
- RevocationWrapper crl, XmlBasicBuildingBlocks bbb, VFContrMarcaCompType contrMarcaCompCert,
- boolean hasOcsp) {
- /*
- * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
- * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
- */
- boolean bbbFounded = bbb != null;
- // presente la CRL
- boolean hasCrl = crl != null;
- // presente solo la CRL
- boolean onlyCrl = hasCrl && !hasOcsp;
- // presente solo OCSP
- boolean onlyOcsp = !onlyCrl;
- // no revoche
- boolean noRevocations = !hasCrl && !hasOcsp;
-
- // CONTROLLI MARCA - CRL
- VFContrMarcaCompType contrMarcaCompType = new VFContrMarcaCompType();
- marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
- contrMarcaCompType.setTiContr(VFTipoControlloType.CRL);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
- //
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- // scenario 1 : solo crl ed errore su certificato
- if (onlyCrl && !contrMarcaCompCert.getTiEsitoContrMarca()
- .equals(VerificaFirmaEnums.EsitoControllo.POSITIVO.name())) {
- // presente crl e non ocsp, errore sul controllo del certificato
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.message());
- } else /* scenario 2 : crl e ocsp non presente */ if (noRevocations) {
- // caso 1 : 3/12/2009 <= notAfter && 3/12/2009 >= notBefore
- Date revokedDate = Date
- .from(LocalDate.of(2009, 12, 3).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
- if (xmlcertificateTsa.getNotAfter().before(revokedDate)
- && xmlcertificateTsa.getNotBefore().after(revokedDate)) {
- contrMarcaCompType.setTiEsitoContrMarca(
- VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO_3_12_2009.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(
- VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO_3_12_2009.message());
- } else /* caso 2 */ {
- contrMarcaCompType
- .setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.CRL_NON_SCARICABILE.name());
- contrMarcaCompType
- .setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.CRL_NON_SCARICABILE.message());
-
- }
- } else /* scenario 3 : solo ocsp */ if (onlyOcsp) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.CRL_NON_SCARICABILE.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(
- VerificaFirmaEnums.EsitoControllo.CRL_NON_SCARICABILE.alternative()[0]);
- } /* scenario 4 : solo CRL disponibile */ else {
- if (!bbbFounded || bbb.getXCV().getSubXCV().stream()
- .noneMatch(c -> c.getId().equals(xmlcertificateTsa.getId()))) {
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else {
- //
- XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
- .filter(c -> c.getId().equals(xmlcertificateTsa.getId())).collect(Collectors.toList())
- .get(0);
- //
- List xmlRacs = subXvc.getRAC().stream().filter(r -> r.getId().equals(crl.getId()))
- .collect(Collectors.toList());
- if (xmlRacs.isEmpty()) {
- contrMarcaCompType
- .setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else if (!xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
- // evaluate subindication (Revocation acceptence)
- VerificaFirmaEnums.EsitoControllo esito = evaluateCRLXmlRacSubIndication(
- contrMarcaCompType.getTiContr().name(), xmlRacs);
-
- // log eidas message
- logEidasConclusion(xmlcertificateTsa, bbb.getConclusion(), VFTipoControlloType.CRL.name());
-
- contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
- contrMarcaCompType.setTiEsitoContrMarca(esito.name());
- } else {
- contrMarcaCompType
- .setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- }
- }
- }
- }
- }
-
- private void buildContrOCSPNotFoundMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
- boolean hasCrl) {
- buildContrOCSPMarcaComp(marcaCompType, xmlcertificateTsa, null, null, hasCrl);
- }
-
- private void buildContrOCSPMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
- CertificateRevocationWrapper ocsp, XmlBasicBuildingBlocks bbb, boolean hasCrl) {
-
- /*
- * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
- * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
- */
- boolean bbbFounded = bbb != null;
- // presente OCSP
- boolean hasOcsp = ocsp != null;
- // no revoche
- boolean noRevocations = !hasCrl && !hasOcsp;
-
- // CONTROLLI MARCA - OCSP
- VFContrMarcaCompType contrMarcaCompType = new VFContrMarcaCompType();
- marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
- contrMarcaCompType.setTiContr(VFTipoControlloType.OCSP);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
- //
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- // scenario 1 : revoche non presenti
- if (noRevocations) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.OCSP_NON_SCARICABILE.name());
- contrMarcaCompType
- .setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.OCSP_NON_SCARICABILE.message());
- } else if (hasCrl && !hasOcsp) /* scenario 2 : presente la CRL ma NON OCSP */ {
- //
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.message());
- } else /* scenario 3 : ocsp presente */ {
- // Nota : non trovato il build block oppure l'indicazione con il risultato di
- // validazione del certifcato
- if (!bbbFounded || bbb.getXCV().getSubXCV().stream()
- .noneMatch(c -> c.getId().equals(xmlcertificateTsa.getId()))) {
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else {
- //
- XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
- .filter(c -> c.getId().equals(xmlcertificateTsa.getId())).collect(Collectors.toList())
- .get(0);
- //
- List xmlRacs = subXvc.getRAC().stream().filter(r -> r.getId().equals(ocsp.getId()))
- .collect(Collectors.toList());
-
- if (xmlRacs.isEmpty()
- || !xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
- // evalutate subindication
- VerificaFirmaEnums.EsitoControllo esito = evaluateOCSPXmlRacSubIndication(ocsp,
- contrMarcaCompType.getTiContr().name(), xmlRacs);
-
- logEidasConclusion(xmlcertificateTsa, xmlRacs.get(0).getConclusion(),
- VFTipoControlloType.OCSP.name());
-
- contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
- contrMarcaCompType.setTiEsitoContrMarca(esito.name());
- } else {
- contrMarcaCompType
- .setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.OCSP_VALIDO.message());
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.OCSP_VALIDO.name());
- }
- }
- }
- }
- }
-
- private void buildContrMarcaComp(VFMarcaCompType marcaCompType, TimestampWrapper ts,
- CertificateWrapper xmlcertificateTsa, XmlBasicBuildingBlocks bbb) {
- //
- boolean bbbFounded = bbb != null;
- //
- boolean isTimestampCompliant = ts.isSignatureIntact() && ts.isSignatureValid(); // TODO: da verificare se
- // diversa condizione
- marcaCompType.setTiEsitoContrConforme(isTimestampCompliant ? VerificaFirmaEnums.EsitoControllo.POSITIVO.name()
- : VerificaFirmaEnums.EsitoControllo.FORMATO_NON_CONOSCIUTO.name());
- marcaCompType
- .setDsMsgEsitoContrConforme(isTimestampCompliant ? VerificaFirmaEnums.EsitoControllo.POSITIVO.message()
- : VerificaFirmaEnums.EsitoControllo.FORMATO_NON_CONOSCIUTO.name());
-
- if (!bbbFounded) {
- marcaCompType.setTiEsitoVerifMarca(VerificaFirmaEnums.EsitoControllo.WARNING.name());
- marcaCompType.setDsMsgEsitoVerifMarca(VerificaFirmaEnums.EsitoControllo.WARNING.message());
- } else {
- if (!bbb.getConclusion().getIndication().equals(Indication.PASSED)) {
- logEidasConclusion(xmlcertificateTsa, bbb.getConclusion());
- //
- marcaCompType.setTiEsitoVerifMarca(VerificaFirmaEnums.EsitoControllo.WARNING.name());
- marcaCompType.setDsMsgEsitoVerifMarca(VerificaFirmaEnums.EsitoControllo.WARNING.message());
- } else {
- marcaCompType.setTiEsitoVerifMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- marcaCompType.setDsMsgEsitoVerifMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- }
- }
-
- VFContrMarcaCompType contrMarcaCompType = new VFContrMarcaCompType();
- marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
- contrMarcaCompType.setTiContr(VFTipoControlloType.CRITTOGRAFICO);
-
- XmlCV cv = bbbFounded ? bbb.getCV() : null;
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS).booleanValue()) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- if (!isTimestampCompliant) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else if (!bbbFounded) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.ERRORE.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.ERRORE.message());
- } else {
- if (!cv.getConclusion().getIndication().equals(Indication.PASSED)) {
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // getSubIndication
- // ==
- // null
- // subindication
- if (cv.getConclusion().getSubIndication() != null) {
- switch (cv.getConclusion().getSubIndication()) {
- case FORMAT_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO;
- break;
- case NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, contrMarcaCompType.getTiContr(),
- cv.getConclusion().getSubIndication());
- break;
- }
- }
- // log eidas message
- logEidasConclusion(xmlcertificateTsa, cv.getConclusion(), VFTipoControlloType.CRITTOGRAFICO.name());
-
- contrMarcaCompType.setTiEsitoContrMarca(esito.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
- } else {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- }
- }
- }
-
- // CONTROLLI MARCA - CERTIFICATO
- contrMarcaCompType = new VFContrMarcaCompType();
- marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
- contrMarcaCompType.setTiContr(VFTipoControlloType.CERTIFICATO);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS).booleanValue()) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- // identificazione certificato
- XmlISC isc = bbbFounded ? bbb.getISC() : null;
- // validità del certificato
- XmlXCV xcv = bbbFounded ? bbb.getXCV() : null;
- //
- if (!isTimestampCompliant) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else if (!bbbFounded) {
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.ERRORE.message());
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.ERRORE.name());
- } else {
- if (!isc.getConclusion().getIndication().equals(Indication.PASSED)) {
- // log eidas message
- logEidasConclusion(xmlcertificateTsa, xcv.getConclusion(), VFTipoControlloType.CERTIFICATO.name());
-
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- } else if (!xcv.getConclusion().getIndication().equals(Indication.PASSED)) {
- /*
- * Unico esito supportato nelle marche è NEGATIVO (ERRORE su EIDAS non trova traduzione.....) Lo
- * switch/case è "over" rispetto l'unico caso di esito possibile (se non PASSED), viene comunque
- * implementato per "traccare" le possibili subindication
- */
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // getSubIndication
- // ==
- // null
- // subindication
- if (xcv.getConclusion().getSubIndication() != null) {
- switch (xcv.getConclusion().getSubIndication()) {
- case OUT_OF_BOUNDS_NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO;
- break;
- case OUT_OF_BOUNDS_NOT_REVOKED:
- // The current time is not in the validity range of the signers certificate.
- // Non è chiaro se la data di firma sia precedente o successiva alla validità
- // del
- // certificato.
- // vedi anche https://ec.europa.eu/cefdigital/tracker/browse/DSS-2070
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, contrMarcaCompType.getTiContr(),
- cv.getConclusion().getSubIndication());
- break;
- }
- }
-
- // log eidas message
- logEidasConclusion(xmlcertificateTsa, xcv.getConclusion(), VFTipoControlloType.CERTIFICATO.name());
-
- contrMarcaCompType.setTiEsitoContrMarca(esito.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
- } else {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- }
- }
- }
-
- // CONTROLLI MARCA - CATENA_TRUSTED
- contrMarcaCompType = new VFContrMarcaCompType();
- marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
- contrMarcaCompType.setTiContr(VFTipoControlloType.CATENA_TRUSTED);
- //
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS).booleanValue()) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else if (!isTimestampCompliant) {
- contrMarcaCompType.setTiEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrMarcaCompType.setDsMsgEsitoContrMarca(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else {
- //
- contrMarcaCompType.setTiEsitoContrMarca(
- xmlcertificateTsa.isTrustedChain() ? VerificaFirmaEnums.EsitoControllo.POSITIVO.name()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- //
- contrMarcaCompType.setDsMsgEsitoContrMarca(
- xmlcertificateTsa.isTrustedChain() ? VerificaFirmaEnums.EsitoControllo.POSITIVO.message()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- }
-
- }
-
- private void buildFirmaComp(VerificaFirmaWrapper wrapper, Map extensions,
- VFFirmaCompType firmaCompType, SignatureWrapper signature, ZonedDateTime dtRef, Reports reports)
- throws VerificaFirmaWrapperGenericException {
-
- // add info (empty)
- VFAdditionalInfoFirmaCompType additionalInfoFirmaCompType = new VFAdditionalInfoFirmaCompType();
- firmaCompType.setAdditionalInfo(additionalInfoFirmaCompType);
-
- // SIGNATURE CERTIFICATE
- // certificate
- CertificateWrapper xmlcertificate = reports.getDiagnosticData()
- .getUsedCertificateById(signature.getSigningCertificate().getId());
-
- // FIRMATARIO + BLOB
- VFCertifFirmatarioType certifFirmatarioType = new VFCertifFirmatarioType();
- firmaCompType.setCertifFirmatario(certifFirmatarioType);
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificate, "serialNumber",
- Optional.ofNullable(xmlcertificate.getId()));
- certifFirmatarioType.setNiSerialCertifFirmatario(new BigDecimal(xmlcertificate.getSerialNumber()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificate, "notBefore",
- Optional.ofNullable(xmlcertificate.getId()));
- certifFirmatarioType
- .setDtIniValCertifFirmatario(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificate.getNotBefore()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificate, "notAfter",
- Optional.ofNullable(xmlcertificate.getId()));
- certifFirmatarioType
- .setDtFinValCertifFirmatario(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificate.getNotAfter()));
-
- VFFilePerFirmaType filePerFirmaType = new VFFilePerFirmaType();
- certifFirmatarioType.setFilePerFirma(filePerFirmaType);
-
- filePerFirmaType.setBlFilePerFirma(xmlcertificate.getBinaries());
- filePerFirmaType.setTiFilePerFirma(VFTipoFileType.CERTIF_FIRMATARIO);
-
- // CA
- String certificateCAId = getCertificateCAId(signature, xmlcertificate);
- //
- CertificateWrapper xmlcertificateCA = reports.getDiagnosticData().getUsedCertificateById(certificateCAId);
-
- VFCertifCaType certifCaType = new VFCertifCaType();
- certifFirmatarioType.setCertifCaFirmatario(certifCaType);
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateCA, "serialNumber",
- Optional.ofNullable(xmlcertificateCA.getId()));
- certifCaType.setNiSerialCertifCa(new BigDecimal(xmlcertificateCA.getSerialNumber()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateCA, "notBefore",
- Optional.ofNullable(xmlcertificateCA.getId()));
- certifCaType.setDtIniValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateCA.getNotBefore()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateCA, "notAfter",
- Optional.ofNullable(xmlcertificateCA.getId()));
- certifCaType.setDtFinValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateCA.getNotAfter()));
- // check subjectKeyId
- if (extensions.containsKey(xmlcertificateCA.getId())) {
- certifCaType.setDsSubjectKeyId(extensions.get(xmlcertificateCA.getId()).getSubjectKeyIdentifier());
- }
- certifCaType.setDlDnIssuerCertifCa(xmlcertificateCA.getCertificateIssuerDN());
- certifCaType.setDlDnSubjectCertifCa(xmlcertificateCA.getCertificateDN());
-
- int urlIdx = 1;
- for (String url : xmlcertificateCA.getCRLDistributionPoints()) {
- VFUrlDistribCrlType urlDistribCrlType = new VFUrlDistribCrlType();
- urlDistribCrlType.setDlUrlDistribCrl(url);
- urlDistribCrlType.setNiOrdUrlDistribCrl(new BigDecimal(urlIdx));
-
- certifCaType.getUrlDistribCrls().add(urlDistribCrlType);
- // inc idx
- urlIdx++;
- }
- // ocsp (from CA+certificate)
- Iterable ocspCombinedUrls = CollectionUtils.union(xmlcertificateCA.getOCSPAccessUrls(),
- xmlcertificate.getOCSPAccessUrls());
- urlIdx = 1;
- for (String url : ocspCombinedUrls) {
- VFUrlDistribOcspType urlDistribOcspType = new VFUrlDistribOcspType();
- urlDistribOcspType.setDlUrlDistribOcsp(url);
- urlDistribOcspType.setNiOrdUrlDistribOcsp(new BigDecimal(urlIdx));
-
- certifCaType.getUrlDistribOcsps().add(urlDistribOcspType);
- // inc idx
- urlIdx++;
- }
- //
- filePerFirmaType = new VFFilePerFirmaType();
- certifCaType.setFilePerFirma(filePerFirmaType);
-
- filePerFirmaType.setBlFilePerFirma(xmlcertificateCA.getBinaries());
- filePerFirmaType.setTiFilePerFirma(VFTipoFileType.CERTIF_CA);
- // FIRMA : CA
- firmaCompType.setCertifCa(certifCaType);
- // nullable element
- String dsAlgoFirma = null;
- if (signature.getDigestAlgorithm() != null && signature.getEncryptionAlgorithm() != null) {
- dsAlgoFirma = signature.getDigestAlgorithm().getName().concat("with")
- .concat(signature.getEncryptionAlgorithm().getName());
- }
- firmaCompType.setDsAlgoFirma(dsAlgoFirma);
- firmaCompType.setDlDnFirmatario(xmlcertificate.getCertificateDN());
- firmaCompType.setDsFirmaBase64(Base64.encodeBase64String(signature.getSignatureValue()));
-
- String cdFirmatario = null;
- if (StringUtils.isNotBlank(xmlcertificate.getSubjectSerialNumber())) {
- cdFirmatario = xmlcertificate.getSubjectSerialNumber();
- } else {
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificate, "serialNumber",
- Optional.ofNullable(xmlcertificate.getId()));
- cdFirmatario = xmlcertificate.getSerialNumber();
- }
- firmaCompType.setCdFirmatario(cdFirmatario);
- firmaCompType.setDtFirma(XmlDateUtility.dateToXMLGregorianCalendar(signature.getClaimedSigningTime()));
-
- //
- if (!signature.getTimestampList().isEmpty()) {
- firmaCompType
- .setTmRifTempUsato(XmlDateUtility.dateToXMLGregorianCalendar(signature.getClaimedSigningTime()));
- firmaCompType.setTipoRiferimentoTemporaleUsato(VerificaFirmaEnums.TipoRifTemporale.MT_VERS_NORMA.name());
- } else if (isVerificaAllaDataDiFirma()) {
- firmaCompType
- .setTmRifTempUsato(XmlDateUtility.dateToXMLGregorianCalendar(signature.getClaimedSigningTime()));
- firmaCompType.setTipoRiferimentoTemporaleUsato(VerificaFirmaEnums.TipoRifTemporale.DATA_FIRMA.name());
- } else {
- firmaCompType.setTmRifTempUsato(XmlDateUtility.dateToXMLGregorianCalendar(dtRef));
- firmaCompType.setTipoRiferimentoTemporaleUsato(VerificaFirmaEnums.TipoRifTemporale.RIF_TEMP_VERS.name());
- }
-
- //
- firmaCompType.setTiFormatoFirma(signature.getSignatureFormat().toString());
- //
- firmaCompType.setNmCognomeFirmatario(xmlcertificate.getSurname());
- firmaCompType.setNmFirmatario(xmlcertificate.getGivenName());
- //
- firmaCompType.setTiFirma(VFTipoFirmaType.DIGITALE);
-
- // basic building block
- XmlBasicBuildingBlocks bbb = reports.getDetailedReport().getBasicBuildingBlockById(signature.getId());
- if (bbb == null) {
- // TOFIX: cosa fare in questi casi ?!
- LOG.warn("BasicBuildingBlockById not found SIGNATURE ID = {}", signature.getId());
- }
- // basic building block counter signature parent
- XmlBasicBuildingBlocks bbbParent = null;
- if (signature.isCounterSignature()) {
- bbbParent = reports.getDetailedReport().getBasicBuildingBlockById(signature.getParent().getId());
- if (bbbParent == null) {
- // TOFIX: cosa fare in questi casi ?!
- LOG.warn("Parent BasicBuildingBlockById not found SIGNATURE ID = {}", signature.getParent().getId());
- }
- }
- // CONTROLLI FIRMA
- // global result
- boolean isSignaturePassed = reports.getSimpleReport().isValid(signature.getId());
- buildContrFirmaComp(firmaCompType, isSignaturePassed, signature, xmlcertificateCA, bbb, bbbParent);
-
- // controllo CERTIFICATO (CRL+OCSP)
- VFContrFirmaCompType contrFirmaCert = firmaCompType.getContrFirmaComps().stream()
- .filter(c -> c.getTiContr().equals(VFTipoControlloType.CERTIFICATO)).collect(Collectors.toList())
- .get(0);
-
- // OCSP CA
- buildFirmaCompCAwithOCSP(wrapper, reports, xmlcertificateCA, firmaCompType, dtRef, extensions);
- // OCSP + CONTR
- buildFirmaCompCERwithOCSP(wrapper, reports, xmlcertificate, firmaCompType, dtRef, extensions, bbb);
-
- // CRL CA
- buildFirmaCompCAwithCRL(wrapper, xmlcertificateCA, certifCaType, firmaCompType, dtRef, extensions);
- // CRL + CONTR
- buildFirmaCompCERwithCRL(wrapper, xmlcertificate, certifCaType, firmaCompType, dtRef, extensions, bbb,
- contrFirmaCert);
-
- }
-
- private void buildContrFirmaComp(VFFirmaCompType firmaCompType, boolean isSignaturePassed,
- SignatureWrapper signature, CertificateWrapper xmlcertificate, XmlBasicBuildingBlocks bbb,
- XmlBasicBuildingBlocks bbbParent) {
-
- // format checking
- boolean isFormatCompliant = false;
- if (bbbParent != null) {
- // counter signature : non ha il controllo di formato (lo eredita dal padre)
- isFormatCompliant = bbbParent.getFC() != null
- && bbbParent.getFC().getConclusion().getIndication().equals(Indication.PASSED);
- } else {
- isFormatCompliant = bbb != null && bbb.getFC() != null
- && bbb.getFC().getConclusion().getIndication().equals(Indication.PASSED);
- }
- firmaCompType.setTiEsitoContrConforme(isFormatCompliant ? VerificaFirmaEnums.EsitoControllo.POSITIVO.name()
- : VerificaFirmaEnums.EsitoControllo.FORMATO_NON_CONFORME.name());
- //
- firmaCompType
- .setDsMsgEsitoContrConforme(isFormatCompliant ? VerificaFirmaEnums.EsitoControllo.POSITIVO.message()
- : VerificaFirmaEnums.EsitoControllo.FORMATO_NON_CONFORME.name());
-
- // verifica risultato "globale" di verifica firma
- firmaCompType.setTiEsitoVerifFirma(isSignaturePassed ? VerificaFirmaEnums.EsitoControllo.POSITIVO.name()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- //
- firmaCompType.setDsMsgEsitoVerifFirma(isSignaturePassed ? VerificaFirmaEnums.EsitoControllo.POSITIVO.message()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
-
- // caso "particolare" di building block non trovato (vedi controllo
- // precedente con WARNING)
- // in questi casi si assumono come NON PASSATI i controlli sull'oggetto perché
- // non reperibili
- boolean bbbFounded = bbb != null;
-
- // CONTROLLI FIRMA - CRITTOGRAFICO signatureValidations
- // CertificateReliability
- VFContrFirmaCompType contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.CRITTOGRAFICO);
-
- // valiazione crittografica
- XmlCV cv = bbbFounded ? bbb.getCV() : null;
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS).booleanValue()) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- if (!isFormatCompliant) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else if (!bbbFounded) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- } else {
- if (!cv.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // getSubIndication
- // ==
- // null //
- // subindication
- if (cv.getConclusion().getSubIndication() != null) {
- switch (cv.getConclusion().getSubIndication()) {
- case FORMAT_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO;
- break;
- case NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO;
- break;
- case SIG_CRYPTO_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO;
- break;
- case HASH_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, contrFirmaCompType.getTiContr(),
- cv.getConclusion().getSubIndication());
- break;
- }
- }
- // log eidas message
- logEidasConclusion(xmlcertificate, cv.getConclusion(), VFTipoControlloType.CRITTOGRAFICO.name());
-
- contrFirmaCompType.setTiEsitoContrFirma(esito.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
- } else {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- }
- }
- }
-
- // TOFIX: al momento è lo stesso risultato raccolto sopra
- // CONTROLLI FIRMA - CRITTOGRAFICO_ABILITATO signatureValidations
- contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.CRITTOGRAFICO_ABILITATO);
-
- if (!isFormatCompliant) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else if (!bbbFounded) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- } else {
- if (!cv.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // getSubIndication
- // ==
- // null //
- // subindication
- // subindication
- if (cv.getConclusion().getSubIndication() != null) {
- switch (cv.getConclusion().getSubIndication()) {
- case FORMAT_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO;
- break;
- case NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO;
- break;
- case SIG_CRYPTO_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO;
- break;
- case HASH_FAILURE:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.NEGATIVO; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, contrFirmaCompType.getTiContr(),
- cv.getConclusion().getSubIndication());
- break;
- }
- }
- // log eidas message
- logEidasConclusion(xmlcertificate, cv.getConclusion(),
- VFTipoControlloType.CRITTOGRAFICO_ABILITATO.name());
-
- contrFirmaCompType.setTiEsitoContrFirma(esito.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
- } else {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- }
- }
-
- // CONTROLLI FIRMA - CATENA_TRUSTED_ABILITATO CertificateAssociation &&
- // CertificateReliability
- contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.CATENA_TRUSTED_ABILITATO);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS).booleanValue()) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else if (!isFormatCompliant) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else {
- contrFirmaCompType.setTiEsitoContrFirma(
- signature.isTrustedChain() || isSignaturePassed ? VerificaFirmaEnums.EsitoControllo.POSITIVO.name()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(signature.isTrustedChain() || isSignaturePassed
- ? VerificaFirmaEnums.EsitoControllo.POSITIVO.message()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- }
-
- // CONTROLLI FIRMA - CERTIFICATO CertificateExpiration
- contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.CERTIFICATO);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS).booleanValue()) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- if (!isFormatCompliant) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else {
- // identificazione certificato
- XmlISC isc = bbbFounded ? bbb.getISC() : null;
- // validità del certificato
- XmlXCV xcv = bbbFounded ? bbb.getXCV() : null;
- if (!bbbFounded) {
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else {
- // isc
- if (!isc.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
- // log eidas message
- logEidasConclusion(xmlcertificate, isc.getConclusion(), VFTipoControlloType.CERTIFICATO.name());
-
- // Nota: non si effettua verifica di sottoindicazione in quanto se questo tipo
- // di controllo è
- // errato
- // si assume che il certificato di firma non è valido
- contrFirmaCompType
- .setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.CERTIFICATO_NON_VALIDO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(
- VerificaFirmaEnums.EsitoControllo.CERTIFICATO_NON_VALIDO.alternative()[0]);
- } else if (!xcv.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
- String alternativeMsg = null;
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_ERRATO; // getSubIndication
- // ==
- // null
- // subindication xcv
- if (xcv.getConclusion().getSubIndication() != null) {
- switch (xcv.getConclusion().getSubIndication()) {
- case OUT_OF_BOUNDS_NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO;
- break;
- case OUT_OF_BOUNDS_NOT_REVOKED:
- // The current time is not in the validity range of the signers certificate.
- // Non è chiaro se la data di firma sia precedente o successiva alla validità
- // del
- // certificato.
- // vedi anche https://ec.europa.eu/cefdigital/tracker/browse/DSS-2070
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO;
- /*
- * MAC 25213 - in questo caso abbiamo un esito INDETERMINATE da eidas MA sia che la
- * verifica sia a alla data di versamento, sia che lo sia alla data della firma se
- * rientra nel periodo di valità del certificato deve essere positivo.
- */
- Date dataRiferimento = XmlDateUtility
- .xmlGregorianCalendarToDate(firmaCompType.getTmRifTempUsato());
- Date dataInizio = XmlDateUtility.xmlGregorianCalendarToDate(
- firmaCompType.getCertifFirmatario().getDtIniValCertifFirmatario());
- Date dataFine = XmlDateUtility.xmlGregorianCalendarToDate(
- firmaCompType.getCertifFirmatario().getDtFinValCertifFirmatario());
-
- if (dataRiferimento != null && isBetween(dataRiferimento, dataInizio, dataFine)) {
- esito = VerificaFirmaEnums.EsitoControllo.POSITIVO;
- }
-
- break;
- case EXPIRED:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO;
- break;
- case CRYPTO_CONSTRAINTS_FAILURE_NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_NON_VALIDO;
- break;
- case NOT_YET_VALID:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_NON_VALIDO;
- break;
- case TRY_LATER:
- // revoche non presenti
- if (versamento.getModificatoriWSCalc()
- .contains(Costanti.ModificatoriWS.TAG_FIRMA_1_5)) {
- esito = VerificaFirmaEnums.EsitoControllo.REVOCHE_NON_CONSISTENTI;
- } else {
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_ERRATO;
- // alternative message (che quindi non è il defalut dell'esito)
- alternativeMsg = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_ERRATO
- .alternative()[0];
- }
- break;
- case REVOKED:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_REVOCATO;
- break;
- case NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_ERRATO; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, contrFirmaCompType.getTiContr(),
- cv.getConclusion().getSubIndication());
- break;
- }
- }
-
- // log eidas message
- logEidasConclusion(xmlcertificate, xcv.getConclusion(), VFTipoControlloType.CERTIFICATO.name());
-
- contrFirmaCompType.setTiEsitoContrFirma(esito.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(
- StringUtils.isBlank(alternativeMsg) ? esito.message() : alternativeMsg);
- } else {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- }
- }
- }
- }
-
- // CONTROLLI FIRMA - CATENA_TRUSTED CertificateAssociation &&
- // CertificateReliability
- // Nota: su DB risultano solo per casi molto vecchi il riferimento di questo
- // controllo con la relativa CRL
- contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.CATENA_TRUSTED);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS).booleanValue()) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- if (!isFormatCompliant) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_ESEGUITO.message());
- } else {
- contrFirmaCompType.setTiEsitoContrFirma(signature.isTrustedChain() || isSignaturePassed
- ? VerificaFirmaEnums.EsitoControllo.POSITIVO.name()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(signature.isTrustedChain() || isSignaturePassed
- ? VerificaFirmaEnums.EsitoControllo.POSITIVO.message()
- : VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- }
- }
-
- }
-
- private void buildFirmaCompCERwithCRL(VerificaFirmaWrapper wrapper, CertificateWrapper xmlcertificate,
- VFCertifCaType certifCaType, VFFirmaCompType firmaCompType, ZonedDateTime dtRef,
- Map extensions, XmlBasicBuildingBlocks bbb, VFContrFirmaCompType contrFirmaCert)
- throws VerificaFirmaWrapperGenericException {
- // OCSP prioritario rispetto CRL
- boolean hasOcsp = xmlcertificate.getCertificateRevocationData().stream()
- .anyMatch(r -> r.getRevocationType().equals(RevocationType.OCSP));
-
- // CRL
- RevocationWrapper crl = findRevocationByType(xmlcertificate, dtRef, RevocationType.CRL);
- if (hasOcsp || crl == null) {
- //
- buildContrCRLNotFoundFirmaComp(firmaCompType, xmlcertificate, contrFirmaCert, hasOcsp);
- return;
- }
-
- // CRL
- VFCrlType crlType = buildCrl(wrapper, extensions, crl);
-
- // FIRMA : CRL
- firmaCompType.setCrl(crlType);
- // CRL: CA
- crlType.setCertifCa(certifCaType);
-
- // controlli CRL
- buildContrCRLFirmaComp(firmaCompType, xmlcertificate, crl, bbb, contrFirmaCert, hasOcsp);
- // CRL - END
- }
-
- private void buildFirmaCompCERwithOCSP(VerificaFirmaWrapper wrapper, Reports reports,
- CertificateWrapper xmlcertificate, VFFirmaCompType firmaCompType, ZonedDateTime dtRef,
- Map extensions, XmlBasicBuildingBlocks bbb)
- throws VerificaFirmaWrapperGenericException {
- // verifica presenza CRL
- boolean hasCrl = xmlcertificate.getCertificateRevocationData().stream()
- .anyMatch(r -> r.getRevocationType().equals(RevocationType.CRL));
- // OCSP
- CertificateRevocationWrapper ocsp = findRevocationByType(xmlcertificate, dtRef, RevocationType.OCSP);
- if (ocsp == null) {
- //
- buildContrOCSPNotFoundFirmaComp(firmaCompType, xmlcertificate, hasCrl);
- return;
- } // no ocsp
-
- // CA
- VFCertifCaType certifCaOcspType = buildOcspCertifCA(wrapper, reports, xmlcertificate, extensions, ocsp);
-
- // OCSP + certif
- VFOcspType ocspType = buildOcspWithCertif(wrapper, certifCaOcspType, ocsp);
- // FIRMA : OCSP
- firmaCompType.setOcsp(ocspType);
-
- // controlli OCSP
- buildContrOCSPFirmaComp(firmaCompType, xmlcertificate, ocsp, bbb, hasCrl);
- // OCSP - END
-
- }
-
- private void buildFirmaCompCAwithCRL(VerificaFirmaWrapper wrapper, CertificateWrapper xmlcertificateCA,
- VFCertifCaType certifCaType, VFFirmaCompType firmaCompType, ZonedDateTime dtRef,
- Map extensions) throws VerificaFirmaWrapperGenericException {
-
- // OCSP prioritario rispetto CRL
- boolean hasOcsp = xmlcertificateCA.getCertificateRevocationData().stream()
- .anyMatch(r -> r.getRevocationType().equals(RevocationType.OCSP));
-
- // CRL
- RevocationWrapper crl = findRevocationByType(xmlcertificateCA, dtRef, RevocationType.CRL);
- if (hasOcsp || crl == null) {
- return;
- }
-
- // CRL
- VFCrlType crlType = buildCrl(wrapper, extensions, crl);
-
- // CRL : CA
- crlType.setCertifCa(certifCaType);
- // FIRMA : CRL CA
- firmaCompType.setCrlCertifCa(crlType);
- // CRL - END
- }
-
- private void buildFirmaCompCAwithOCSP(VerificaFirmaWrapper wrapper, Reports reports,
- CertificateWrapper xmlcertificateCA, VFFirmaCompType firmaCompType, ZonedDateTime dtRef,
- Map extensions) throws VerificaFirmaWrapperGenericException {
- // OCSP
- RevocationWrapper ocsp = findRevocationByType(xmlcertificateCA, dtRef, RevocationType.OCSP);
- if (ocsp == null) {
- return;
- } // no ocsp
-
- // CA
- VFCertifCaType certifCaOcspType = buildOcspCertifCA(wrapper, reports, xmlcertificateCA, extensions, ocsp);
-
- // OCSP + certif
- VFOcspType ocspType = buildOcspWithCertif(wrapper, certifCaOcspType, ocsp);
- // FIRMA : OCSP
- firmaCompType.setOcspCertifCa(ocspType);
- // OCSP - END
- }
-
- private VFCertifCaType buildOcspCertifCA(VerificaFirmaWrapper wrapper, Reports reports,
- CertificateWrapper xmlcertificate, Map extensions, RevocationWrapper ocsp)
- throws VerificaFirmaWrapperGenericException {
- // CA
- String certificateCAId = getCertificateCAId(ocsp, xmlcertificate);
- //
- CertificateWrapper xmlcertificateCAOCSP = reports.getDiagnosticData().getUsedCertificateById(certificateCAId);
-
- VFCertifCaType certifCaOcspType = new VFCertifCaType();
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateCAOCSP, "serialNumber",
- Optional.ofNullable(xmlcertificateCAOCSP.getId()));
- certifCaOcspType.setNiSerialCertifCa(new BigDecimal(xmlcertificate.getSerialNumber()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateCAOCSP, "notBefore",
- Optional.ofNullable(xmlcertificate.getId()));
- certifCaOcspType.setDtIniValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificate.getNotBefore()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateCAOCSP, "notAfter",
- Optional.ofNullable(xmlcertificate.getId()));
- certifCaOcspType
- .setDtFinValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateCAOCSP.getNotAfter()));
- // check subjectKeyId
- if (extensions.containsKey(xmlcertificateCAOCSP.getId())) {
- certifCaOcspType.setDsSubjectKeyId(extensions.get(xmlcertificateCAOCSP.getId()).getSubjectKeyIdentifier());
- }
- certifCaOcspType.setDlDnIssuerCertifCa(xmlcertificateCAOCSP.getCertificateIssuerDN());
- certifCaOcspType.setDlDnSubjectCertifCa(xmlcertificateCAOCSP.getCertificateDN());
-
- int urlIdx = 1;
- for (String url : xmlcertificateCAOCSP.getCRLDistributionPoints()) {
- VFUrlDistribCrlType urlDistribCrlType = new VFUrlDistribCrlType();
- urlDistribCrlType.setDlUrlDistribCrl(url);
- urlDistribCrlType.setNiOrdUrlDistribCrl(new BigDecimal(urlIdx));
-
- certifCaOcspType.getUrlDistribCrls().add(urlDistribCrlType);
- // inc idx
- urlIdx++;
- }
- // ocsp (from CA+certificate)
- Iterable ocspCombinedUrls = CollectionUtils.union(xmlcertificateCAOCSP.getOCSPAccessUrls(),
- xmlcertificate.getOCSPAccessUrls());
- urlIdx = 1;
- for (String url : ocspCombinedUrls) {
- VFUrlDistribOcspType urlDistribOcspType = new VFUrlDistribOcspType();
- urlDistribOcspType.setDlUrlDistribOcsp(url);
- urlDistribOcspType.setNiOrdUrlDistribOcsp(new BigDecimal(urlIdx));
-
- certifCaOcspType.getUrlDistribOcsps().add(urlDistribOcspType);
- // inc idx
- urlIdx++;
- }
-
- VFFilePerFirmaType filePerFirmaType = new VFFilePerFirmaType();
- certifCaOcspType.setFilePerFirma(filePerFirmaType);
-
- filePerFirmaType.setBlFilePerFirma(xmlcertificate.getBinaries());
- filePerFirmaType.setTiFilePerFirma(VFTipoFileType.CERTIF_CA);
-
- return certifCaOcspType;
- }
-
- // No CRL
- private void buildContrCRLNotFoundFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
- VFContrFirmaCompType contrFirmaCert, boolean hasOcsp) {
- buildContrCRLFirmaComp(firmaCompType, xmlcertificate, null, null, contrFirmaCert, hasOcsp);
- }
-
- private void buildContrCRLFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
- RevocationWrapper crl, XmlBasicBuildingBlocks bbb, VFContrFirmaCompType contrFirmaCert, boolean hasOcsp) {
-
- /*
- * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
- * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
- */
- boolean bbbFounded = bbb != null;
- // presente la CRL
- boolean hasCrl = crl != null;
- // presente solo la CRL
- boolean onlyCrl = hasCrl && !hasOcsp;
- // presente solo OCSP
- boolean onlyOcsp = !onlyCrl;
- // no revoche
- boolean noRevocations = !hasCrl && !hasOcsp;
-
- VFContrFirmaCompType contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.CRL);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
- //
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- // scenario 1 : solo crl ed errore su certificato
- if (onlyCrl
- && !contrFirmaCert.getTiEsitoContrFirma().equals(VerificaFirmaEnums.EsitoControllo.POSITIVO.name())
- && !contrFirmaCert.getTiEsitoContrFirma()
- .equals(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name())
- && !contrFirmaCert.getTiEsitoContrFirma()
- .equals(VerificaFirmaEnums.EsitoControllo.REVOCHE_NON_CONSISTENTI.name())) {
- // presente crl e non ocsp, errore sul controllo del certificato
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.message());
- } else if (noRevocations) /* scenario 2 : crl e ocsp non presente */ {
- // valutazione CERTIFICATO_SCADUTO_3_12_2009
- // caso 1 : 3/12/2009 <= notAfter && 3/12/2009 >= notBefore
- Date revokedDate = Date
- .from(LocalDate.of(2009, 12, 3).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
- if (xmlcertificate.getNotAfter().before(revokedDate)
- && xmlcertificate.getNotBefore().after(revokedDate)) {
- contrFirmaCompType.setTiEsitoContrFirma(
- VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO_3_12_2009.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(
- VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO_3_12_2009.message());
- } else /* caso 2 */ {
- contrFirmaCompType
- .setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.CRL_NON_SCARICABILE.name());
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.CRL_NON_SCARICABILE.message());
- }
- } else if (onlyOcsp) /* scenario 3 : solo ocsp */ {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.alternative()[0]);
- } else /* scenario 4 : solo CRL disponibile */ {
- // Nota : non trovato il build block oppure l'indicazione con il risultato di
- // validazione del certifcato
- if (!bbbFounded
- || bbb.getXCV().getSubXCV().stream().noneMatch(c -> c.getId().equals(xmlcertificate.getId()))) {
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else {
- //
- XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
- .filter(c -> c.getId().equals(xmlcertificate.getId())).collect(Collectors.toList()).get(0);
- //
- List xmlRacs = subXvc.getRAC().stream().filter(r -> r.getId().equals(crl.getId()))
- .collect(Collectors.toList());
-
- if (xmlRacs.isEmpty()) {
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else if (!xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
- // evaluate subindication (Revocation acceptence)
- VerificaFirmaEnums.EsitoControllo esito = evaluateCRLXmlRacSubIndication(
- contrFirmaCompType.getTiContr().name(), xmlRacs);
-
- // log eidas message
- logEidasConclusion(xmlcertificate, bbb.getConclusion(), VFTipoControlloType.CRL.name());
-
- contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
- contrFirmaCompType.setTiEsitoContrFirma(esito.name());
- } else {
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.POSITIVO.name());
- }
- }
- }
- }
- }
-
- private VerificaFirmaEnums.EsitoControllo evaluateCRLXmlRacSubIndication(String tiContr, List xmlRacs) {
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.CRL_NON_VALIDA;
- SubIndication subIndication = xmlRacs.get(0).getConclusion().getSubIndication();
- if (subIndication != null) {
- switch (subIndication) {
- case OUT_OF_BOUNDS_NO_POE:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_SCADUTO;
- break;
- case REVOKED:
- esito = VerificaFirmaEnums.EsitoControllo.CERTIFICATO_REVOCATO;
- break;
- case TRY_LATER:
- esito = VerificaFirmaEnums.EsitoControllo.CRL_NON_VALIDA;
- break;
- case NOT_YET_VALID:
- esito = VerificaFirmaEnums.EsitoControllo.CRL_NON_VALIDA;
- break;
- case EXPIRED:
- esito = VerificaFirmaEnums.EsitoControllo.CRL_SCADUTA;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.CRL_NON_VALIDA; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, tiContr, subIndication);
- break;
- }
- }
- return esito;
- }
-
- /*
- * CRL + FILE
- */
- private VFCrlType buildCrl(VerificaFirmaWrapper wrapper, Map extensions,
- RevocationWrapper crl) throws VerificaFirmaWrapperGenericException {
- VFCrlType crlType = new VFCrlType();
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, crl, "thisUpdate", Optional.ofNullable(crl.getId()));
- crlType.setDtIniCrl(XmlDateUtility.dateToXMLGregorianCalendar(crl.getThisUpdate()));
-
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, crl, "nextUpdate", Optional.ofNullable(crl.getId()));
- crlType.setDtScadCrl(XmlDateUtility.dateToXMLGregorianCalendar(crl.getNextUpdate()));
-
- if (extensions.containsKey(crl.getId()) && extensions.get(crl.getId()).getCrlNumber() != null) {
- crlType.setNiSerialCrl(new BigDecimal(extensions.get(crl.getId()).getCrlNumber()));
- }
-
- VFFilePerFirmaType filePerFirmaType = new VFFilePerFirmaType();
- crlType.setFilePerFirma(filePerFirmaType);
-
- filePerFirmaType.setBlFilePerFirma(crl.getBinaries());
- filePerFirmaType.setTiFilePerFirma(VFTipoFileType.CRL);
-
- return crlType;
- }
-
- /*
- * OCSP REVOCATION + CERTIFICATE
- */
- private VFOcspType buildOcspWithCertif(VerificaFirmaWrapper wrapper, VFCertifCaType certifCaType,
- RevocationWrapper ocsp) throws VerificaFirmaWrapperGenericException {
- // certificate
- CertificateWrapper xmlcertificateOcspResp = ocsp.getSigningCertificate();
-
- // certif
- VFCertifOcspType certifOcspType = new VFCertifOcspType();
- certifOcspType.setCertifCa(certifCaType);
- // Nota: certificato ocsp responder presenta un serialnumber e non un
- // subjectserial number
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateOcspResp, "serialNumber",
- Optional.ofNullable(xmlcertificateOcspResp.getId()));
- certifOcspType.setNiSerialCertifOcsp(new BigDecimal(xmlcertificateOcspResp.getSerialNumber()));
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateOcspResp, "notBefore",
- Optional.ofNullable(xmlcertificateOcspResp.getId()));
- certifOcspType.setDtIniValCertifOcsp(
- XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateOcspResp.getNotBefore()));
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateOcspResp, "notAfter",
- Optional.ofNullable(xmlcertificateOcspResp.getId()));
- certifOcspType
- .setDtFinValCertifOcsp(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateOcspResp.getNotAfter()));
- // test
- EidasWrapperResultControl.fieldCannotBeNull(wrapper, xmlcertificateOcspResp, "certificateDN",
- Optional.ofNullable(xmlcertificateOcspResp.getId()));
- certifOcspType.setDlDnSubject(xmlcertificateOcspResp.getCertificateDN());
-
- // file
- VFFilePerFirmaType filePerFirmaCertifOcspType = new VFFilePerFirmaType();
- certifOcspType.setFilePerFirma(filePerFirmaCertifOcspType);
-
- filePerFirmaCertifOcspType.setBlFilePerFirma(ocsp.getBinaries());
- filePerFirmaCertifOcspType.setTiFilePerFirma(VFTipoFileType.CERTIF_OCSP);
-
- // OCSP
- VFOcspType ocspType = new VFOcspType();
- // TOFIX: da verificare (ResponderID)
- // https://tools.ietf.org/html/rfc6960#section-4.2.2.3
- if (StringUtils.isNotBlank(ocsp.getSigningCertificateReference().getIssuerName())) {
- ocspType.setDsCertifIssuername(ocsp.getSigningCertificateReference().getIssuerName());
- }
- if (ocsp.getSigningCertificateReference().isIssuerSerialPresent()) {
- ocspType.setDsCertifSerialBase64(
- Base64.encodeBase64String(ocsp.getSigningCertificateReference().getIssuerSerial()));
- }
- if (ocsp.getSigningCertificateReference().getSki() != null) {
- ocspType.setDsCertifSkiBase64(Base64.encodeBase64String(ocsp.getSigningCertificateReference().getSki()));
- }
-
- ocspType.setCertifOcsp(certifOcspType);
- // file
- VFFilePerFirmaType filePerFirmaOcspType = new VFFilePerFirmaType();
- ocspType.setFilePerFirma(filePerFirmaOcspType);
-
- filePerFirmaOcspType.setBlFilePerFirma(ocsp.getBinaries());
- filePerFirmaOcspType.setTiFilePerFirma(VFTipoFileType.OCSP);
-
- return ocspType;
- }
-
- private void buildContrOCSPNotFoundFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
- boolean hasCrl) {
- buildContrOCSPFirmaComp(firmaCompType, xmlcertificate, null, null, hasCrl);
- }
-
- private void buildContrOCSPFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
- CertificateRevocationWrapper ocsp, XmlBasicBuildingBlocks bbb, boolean hasCrl) {
-
- /*
- * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
- * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
- */
- boolean bbbFounded = bbb != null;
- // presente OCSP
- boolean hasOcsp = ocsp != null;
- // no revoche
- boolean noRevocations = !hasCrl && !hasOcsp;
-
- VFContrFirmaCompType contrFirmaCompType = new VFContrFirmaCompType();
- firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
- contrFirmaCompType.setTiContr(VFTipoControlloType.OCSP);
-
- if (!getControlliAbilitati().get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
- //
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.DISABILITATO.message());
- } else {
- // scenario 1 : revoche non presenti
- if (noRevocations) {
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.OCSP_NON_SCARICABILE.name());
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.OCSP_NON_SCARICABILE.message());
- } else if (hasCrl && !hasOcsp) /* scenario 2 : presente la CRL ma NON OCSP */ {
- //
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.name());
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NON_NECESSARIO.message());
- } else /* scenario 3 : ocsp presente */ {
- // Nota : non trovato il build block oppure l'indicazione con il risultato di
- // validazione del certifcato
- if (!bbbFounded
- || bbb.getXCV().getSubXCV().stream().noneMatch(c -> c.getId().equals(xmlcertificate.getId()))) {
- contrFirmaCompType.setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else {
- //
- XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
- .filter(c -> c.getId().equals(xmlcertificate.getId())).collect(Collectors.toList()).get(0);
- //
- List xmlRacs = subXvc.getRAC().stream().filter(r -> r.getId().equals(ocsp.getId()))
- .collect(Collectors.toList());
-
- if (xmlRacs.isEmpty()) {
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.NEGATIVO.name());
- } else if (!xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
- // evalutate subindication
- VerificaFirmaEnums.EsitoControllo esito = evaluateOCSPXmlRacSubIndication(ocsp,
- contrFirmaCompType.getTiContr().name(), xmlRacs);
-
- // log eidas message
- logEidasConclusion(xmlcertificate, xmlRacs.get(0).getConclusion(),
- VFTipoControlloType.OCSP.name());
-
- contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
- contrFirmaCompType.setTiEsitoContrFirma(esito.name());
- } else {
- contrFirmaCompType
- .setDsMsgEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.OCSP_VALIDO.message());
- contrFirmaCompType.setTiEsitoContrFirma(VerificaFirmaEnums.EsitoControllo.OCSP_VALIDO.name());
- }
- }
- }
- }
- }
-
- private VerificaFirmaEnums.EsitoControllo evaluateOCSPXmlRacSubIndication(CertificateRevocationWrapper ocsp,
- String tiContr, List xmlRacs) {
- VerificaFirmaEnums.EsitoControllo esito = VerificaFirmaEnums.EsitoControllo.OCSP_SCONOSCIUTO;
- // ocsp response known by server
- if (ocsp.isKnown()) {
- // subindication
- SubIndication subIndication = xmlRacs.get(0).getConclusion().getSubIndication();
- if (subIndication != null) {
- switch (subIndication) {
- case TRY_LATER:
- esito = VerificaFirmaEnums.EsitoControllo.OCSP_NON_AGGIORNATO;
- break;
- default:
- esito = VerificaFirmaEnums.EsitoControllo.OCSP_SCONOSCIUTO; // default
- LOG.debug(LOG_FMT_SUBINDICATION, esito, tiContr, subIndication);
- break;
- }
- }
- }
- // revoked response by server
- if (ocsp.isRevoked()) {
- esito = VerificaFirmaEnums.EsitoControllo.OCSP_REVOCATO;
- }
- return esito;
- }
-
- private boolean isBetween(Date ref, Date from, Date to) {
- return !ref.after(to) && !ref.before(from);
}
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/IVerificaFirmaWrapperResultStrategy.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/IVerificaFirmaWrapperResultStrategy.java
index 22c9784..75ba809 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/IVerificaFirmaWrapperResultStrategy.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/IVerificaFirmaWrapperResultStrategy.java
@@ -1,9 +1,28 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.firma.strategy;
+import java.lang.reflect.InvocationTargetException;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -12,7 +31,6 @@
import it.eng.parer.firma.exception.VerificaFirmaWrapperResNotFoundException;
import it.eng.parer.firma.xml.VFAdditionalInfoWrapperType;
import it.eng.parer.firma.xml.VerificaFirmaWrapper;
-import java.time.ZonedDateTime;
public interface IVerificaFirmaWrapperResultStrategy {
@@ -21,15 +39,17 @@ public interface IVerificaFirmaWrapperResultStrategy {
String getCode();
// business logic
- default VerificaFirmaWrapper fromVerificaOutOnWrapper(E esito, ZonedDateTime dtRef) throws Exception {
+ default VerificaFirmaWrapper fromVerificaOutOnWrapper(E esito)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
VerificaFirmaWrapper localWrapper = new VerificaFirmaWrapper();
- this.fromVerificaOutOnWrapper(esito, localWrapper, dtRef);
+ this.fromVerificaOutOnWrapper(esito, localWrapper);
return localWrapper;
}
- void fromVerificaOutOnWrapper(E esito, VerificaFirmaWrapper wrapper, ZonedDateTime dtRef) throws Exception;
+ void fromVerificaOutOnWrapper(E esito, VerificaFirmaWrapper wrapper)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
- default VerificaFirmaWrapper buildVFWrapper(E result, ZonedDateTime dtRef, boolean isDetached)
+ default VerificaFirmaWrapper buildVFWrapper(E result, boolean isDetached)
throws VerificaFirmaWrapperResNotFoundException, VerificaFirmaWrapperGenericException,
VerificaFirmaConnectionException {
@@ -50,7 +70,7 @@ default VerificaFirmaWrapper buildVFWrapper(E result, ZonedDateTime dtRef, boole
try {
LOG.debug("Inizio popolamento esito da [ {} ]", getCode());
// populate with output firma
- fromVerificaOutOnWrapper(result, wrapper, dtRef);
+ fromVerificaOutOnWrapper(result, wrapper);
LOG.debug("Termine popolamento esito da [{}]", getCode());
} catch (Exception ex) {
throw new VerificaFirmaWrapperGenericException(ex, wrapper);
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasBaseWrapperResult.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasBaseWrapperResult.java
new file mode 100644
index 0000000..495a899
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasBaseWrapperResult.java
@@ -0,0 +1,432 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.firma.strategy.eidas;
+
+import static it.eng.parer.util.DateUtilsConverter.convert;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.time.ZonedDateTime;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.europa.esig.dss.detailedreport.jaxb.XmlConclusion;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlConstraintsConclusion;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlMessage;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlRAC;
+import eu.europa.esig.dss.diagnostic.AbstractTokenProxy;
+import eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper;
+import eu.europa.esig.dss.diagnostic.CertificateWrapper;
+import eu.europa.esig.dss.diagnostic.RevocationWrapper;
+import eu.europa.esig.dss.enumerations.CertificateSourceType;
+import eu.europa.esig.dss.enumerations.RevocationType;
+import eu.europa.esig.dss.enumerations.SubIndication;
+import eu.europa.esig.dss.enumerations.UriBasedEnum;
+import eu.europa.esig.dss.validation.reports.Reports;
+import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
+import it.eng.parer.firma.util.VerificaFirmaEnums.SacerIndication;
+import it.eng.parer.firma.xml.VFCertifCaType;
+import it.eng.parer.firma.xml.VFCertifOcspType;
+import it.eng.parer.firma.xml.VFCrlType;
+import it.eng.parer.firma.xml.VFOcspType;
+import it.eng.parer.firma.xml.VFUrlDistribCrlType;
+import it.eng.parer.firma.xml.VFUrlDistribOcspType;
+import it.eng.parer.ws.utils.XmlDateUtility;
+
+public abstract class EidasBaseWrapperResult {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EidasBaseWrapperResult.class);
+ protected static final String LOG_FMT_SUBINDICATION = "Eidas esito = {} controllo tipo = {} subindication = {}";
+ private static final String MESSAGE_ESITO_CONTR_WITH_ERRORS = "{0} [{1}]";
+ private static final String MESSAGE_ESITO_CONTR_WITH_DETAILS = MESSAGE_ESITO_CONTR_WITH_ERRORS + " : {2}";
+ protected static final String MESSAGE_NO_INDICATION = "no indication uri";
+ protected static final String MESSAGE_ERROR_SEPARATOR = ";";
+
+ protected DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.ITALY);
+
+ protected static final int PG_BUSTA = 0;
+ protected static final int PG_FIRMA = 1;
+ protected static final int PG_MARCA = 2;
+
+ protected String getCertificateCAId(AbstractTokenProxy sigts, CertificateWrapper xmlcertificate) {
+ // se trusted o selfsigned è la CA
+ if (xmlcertificate.isTrusted() || xmlcertificate.isSelfSigned()) {
+ return xmlcertificate.getId();
+ }
+ // se non è la CA la individua dalla chain
+ // nota : non esiste più di una CA nella catena
+ if (sigts.isTrustedChain()) {
+ return sigts.getCertificateChain().stream()
+ .filter(c -> c.getSources().contains(CertificateSourceType.TRUSTED_STORE)
+ || c.getSources().contains(CertificateSourceType.TRUSTED_LIST))
+ .collect(Collectors.toList()).get(0).getId();
+ }
+ // verifica se esite in chain un certificato selfsigned
+ if (sigts.getCertificateChain().stream().anyMatch(CertificateWrapper::isSelfSigned)) {
+ return sigts.getCertificateChain().stream().filter(CertificateWrapper::isSelfSigned)
+ .collect(Collectors.toList()).get(0).getId();
+ }
+
+ // ultimo scenario : restituisce l'id dell'ultimo elemento della catena
+ return sigts.getCertificateChain().get(sigts.getCertificateChain().size() - 1).getId();
+ }
+
+ protected CertificateRevocationWrapper findRevocationByType(CertificateWrapper certificate, ZonedDateTime dtRef,
+ RevocationType type) {
+ //
+ CertificateRevocationWrapper revocation = null;
+ // no revocation
+ if (certificate.getCertificateRevocationData().stream().noneMatch(r -> r.getRevocationType().equals(type))) {
+ // null
+ return revocation;
+ }
+
+ // extract revocations by source type
+ List revocationFilteredBySource = certificate.getCertificateRevocationData()
+ .stream().filter(r -> r.getRevocationType().equals(type)).collect(Collectors.toList());
+
+ // get only one
+ if (revocationFilteredBySource.size() == 1) {
+ revocation = revocationFilteredBySource.get(0);
+ } else {
+ //
+ List revocationFilteredByOriginDate = null;
+
+ // filter by RevocationOrigin (EXTERNAL / CACHED)
+ // verify
+ // https://github.com/esig/dss/blob/5.8/dss-enumerations/src/main/java/eu/europa/esig/dss/enumerations/RevocationOrigin.java
+ if (revocationFilteredBySource.stream().filter(c -> !c.getOrigin().isInternalOrigin()).count() != 0) {
+ revocationFilteredByOriginDate = revocationFilteredBySource.stream()
+ .filter(c -> !c.getOrigin().isInternalOrigin()).collect(Collectors.toList());
+ } else if (revocationFilteredBySource.stream().filter(c -> c.getOrigin().isInternalOrigin()).count() != 0) {
+ // filter by RevocationOrigin (embedded)
+ revocationFilteredByOriginDate = revocationFilteredBySource.stream()
+ .filter(c -> c.getOrigin().isInternalOrigin()).collect(Collectors.toList());
+ } else {
+ // filter by date
+ revocationFilteredByOriginDate = revocationFilteredBySource.stream().filter(
+ c -> c.getThisUpdate().after(convert(dtRef)) && c.getNextUpdate().before(convert(dtRef)))
+ .collect(Collectors.toList());
+ }
+
+ // error
+ if (revocationFilteredByOriginDate.isEmpty() && LOG.isErrorEnabled()) {
+ LOG.error("{} certificate id {} not found", type.name(), certificate.getId());
+ // null
+ return revocation;
+ }
+
+ // warn
+ if (revocationFilteredByOriginDate.size() > 1 && LOG.isWarnEnabled()) {
+ LOG.warn("{} certificate id {} more than one (get first of list)", type.name(), certificate.getId());
+ }
+ // get first
+ revocation = revocationFilteredByOriginDate.get(0);
+ }
+ //
+ return revocation;
+ }
+
+ /*
+ * OCSP REVOCATION + CERTIFICATE
+ */
+
+ /*
+ * Accedendo fino all'ultimo elemento a partire da sinistra percorrendo i successivi livelli
+ *
+ */
+ protected String getMimeTypeUnsigned(EidasWSReportsDTOTree parent, List child) {
+ // condizioni di uscita
+ // ultimo elemento unsigned non trovato
+ if (child == null || child.isEmpty()) {
+ return parent.getMimeType();
+ }
+ // left child
+ EidasWSReportsDTOTree leftChild = child.get(0);
+ // mime found
+ if (leftChild.isUnsigned()) {
+ return leftChild.getMimeType();
+ } else {
+ return getMimeTypeUnsigned(leftChild, leftChild.getChildren());
+ }
+
+ }
+
+ protected void logEidasConclusion(CertificateWrapper certificate, XmlConclusion conclusion) {
+ logEidasConclusion(certificate, conclusion, null);
+ }
+
+ protected void logEidasConclusion(CertificateWrapper certificate, XmlConstraintsConclusion contraints,
+ String tipo) {
+ logEidasConclusion(certificate, contraints.getConclusion(), tipo);
+ }
+
+ protected void logEidasConclusion(CertificateWrapper certificate, XmlConclusion conclusion, String tipo) {
+ StringBuilder msg = new StringBuilder();
+ if (conclusion.getWarnings().stream().count() != 0) {
+ msg.append(conclusion.getWarnings().stream().map(XmlMessage::getValue).collect(Collectors.joining(";")));
+ }
+ if (conclusion.getErrors().stream().count() != 0) {
+ msg.append(conclusion.getErrors().stream().map(XmlMessage::getValue).collect(Collectors.joining(";")));
+ }
+ LOG.debug("EIDAS FIRMA CONCLUSION ID = {} {}, msg {}",
+ certificate != null ? certificate.getId() : "ID_FIRMA_NOT_FOUND",
+ tipo == null ? "" : " tipo controllo " + tipo, msg);
+ }
+
+ protected static class EidasWrapperResultControl {
+
+ private EidasWrapperResultControl() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ public static void fieldCannotBeNull(Object obj, String fieldName, Optional param)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException,
+ InvocationTargetException {
+ Method getField = findMethod(obj, fieldName);
+ if (getField.invoke(obj) == null) {
+ final String msg = "[" + obj.getClass().getName() + "] il campo " + fieldName
+ + " richiesto alla compilazione è NULL."
+ + (param.isPresent() ? " EIDAS signature id = " + param.get() : "");
+ throw new NullPointerException(msg);
+ }
+ }
+
+ private static Method findMethod(Object obj, String fieldName) throws NoSuchMethodException {
+ Method getField;
+ try {
+ getField = ClassUtils.getPublicMethod(obj.getClass(), "get" + StringUtils.capitalize(fieldName));
+ } catch (NoSuchMethodException e) {
+ getField = obj.getClass().getSuperclass().getDeclaredMethod("get" + StringUtils.capitalize(fieldName));
+ }
+ return getField;
+ }
+ }
+
+ protected SacerIndication evaluateOCSPXmlRacSubIndication(CertificateRevocationWrapper ocsp, String tiContr,
+ List xmlRacs) {
+ SacerIndication esito = SacerIndication.OCSP_SCONOSCIUTO;
+ // ocsp response known by server
+ if (ocsp.isKnown()) {
+ // subindication
+ SubIndication subIndication = xmlRacs.get(0).getConclusion().getSubIndication();
+ if (subIndication != null) {
+ switch (subIndication) {
+ case TRY_LATER:
+ esito = SacerIndication.OCSP_NON_AGGIORNATO;
+ break;
+ default:
+ esito = SacerIndication.OCSP_SCONOSCIUTO; // default
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, tiContr, subIndication);
+ break;
+ }
+ }
+ }
+ // revoked response by server
+ if (ocsp.isRevoked()) {
+ esito = SacerIndication.OCSP_REVOCATO;
+ }
+ return esito;
+ }
+
+ protected SacerIndication evaluateCRLXmlRacSubIndication(String tiContr, List xmlRacs) {
+ SacerIndication esito = SacerIndication.CRL_NON_VALIDA;
+ SubIndication subIndication = xmlRacs.get(0).getConclusion().getSubIndication();
+ if (subIndication != null) {
+ switch (subIndication) {
+ case OUT_OF_BOUNDS_NO_POE:
+ esito = SacerIndication.CERTIFICATO_SCADUTO;
+ break;
+ case REVOKED:
+ esito = SacerIndication.CERTIFICATO_REVOCATO;
+ break;
+ case TRY_LATER:
+ case NOT_YET_VALID:
+ esito = SacerIndication.CRL_NON_VALIDA;
+ break;
+ case EXPIRED:
+ esito = SacerIndication.CRL_SCADUTA;
+ break;
+ default:
+ esito = SacerIndication.CRL_NON_VALIDA; // default
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, tiContr, subIndication);
+ break;
+ }
+ }
+ return esito;
+ }
+
+ protected VFCertifCaType buildOcspCertifCA(Reports reports, CertificateWrapper xmlcertificate,
+ RevocationWrapper ocsp)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // CA
+ String certificateCAId = getCertificateCAId(ocsp, xmlcertificate);
+ //
+ CertificateWrapper xmlcertificateCAOCSP = reports.getDiagnosticData().getUsedCertificateById(certificateCAId);
+
+ VFCertifCaType certifCaOcspType = new VFCertifCaType();
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateCAOCSP, "serialNumber",
+ Optional.ofNullable(xmlcertificateCAOCSP.getId()));
+ certifCaOcspType.setNiSerialCertifCa(new BigDecimal(xmlcertificate.getSerialNumber()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateCAOCSP, "notBefore",
+ Optional.ofNullable(xmlcertificate.getId()));
+ certifCaOcspType.setDtIniValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificate.getNotBefore()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateCAOCSP, "notAfter",
+ Optional.ofNullable(xmlcertificate.getId()));
+ certifCaOcspType
+ .setDtFinValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateCAOCSP.getNotAfter()));
+ // Note: report EIDAS doens't cover it ! ( SubjectKeyId non presente su rerport)
+ // certifCaOcspType.setDsSubjectKeyId();
+ certifCaOcspType.setDlDnIssuerCertifCa(xmlcertificateCAOCSP.getCertificateIssuerDN());
+ certifCaOcspType.setDlDnSubjectCertifCa(xmlcertificateCAOCSP.getCertificateDN());
+
+ int urlIdx = 1;
+ // check NON empty URL
+ List crlFiltered = xmlcertificateCAOCSP.getCRLDistributionPoints().stream()
+ .filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ for (String url : crlFiltered) {
+ VFUrlDistribCrlType urlDistribCrlType = new VFUrlDistribCrlType();
+ urlDistribCrlType.setDlUrlDistribCrl(url);
+ urlDistribCrlType.setNiOrdUrlDistribCrl(new BigDecimal(urlIdx));
+
+ certifCaOcspType.getUrlDistribCrls().add(urlDistribCrlType);
+ // inc idx
+ urlIdx++;
+ }
+ // ocsp (from CA+certificate)
+ // check NON empty URL
+ Iterable ocspCombinedUrls = CollectionUtils
+ .union(xmlcertificateCAOCSP.getOCSPAccessUrls(), xmlcertificate.getOCSPAccessUrls()).stream()
+ .filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ urlIdx = 1;
+ for (String url : ocspCombinedUrls) {
+ VFUrlDistribOcspType urlDistribOcspType = new VFUrlDistribOcspType();
+ urlDistribOcspType.setDlUrlDistribOcsp(url);
+ urlDistribOcspType.setNiOrdUrlDistribOcsp(new BigDecimal(urlIdx));
+
+ certifCaOcspType.getUrlDistribOcsps().add(urlDistribOcspType);
+ // inc idx
+ urlIdx++;
+ }
+
+ return certifCaOcspType;
+ }
+
+ /*
+ * OCSP REVOCATION + CERTIFICATE
+ */
+ protected VFOcspType buildOcspWithCertif(VFCertifCaType certifCaType, RevocationWrapper ocsp)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // certificate
+ CertificateWrapper xmlcertificateOcspResp = ocsp.getSigningCertificate();
+
+ // certif
+ VFCertifOcspType certifOcspType = new VFCertifOcspType();
+ certifOcspType.setCertifCa(certifCaType);
+ // Nota: certificato ocsp responder presenta un serialnumber e non un
+ // subjectserial number
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateOcspResp, "serialNumber",
+ Optional.ofNullable(xmlcertificateOcspResp.getId()));
+ certifOcspType.setNiSerialCertifOcsp(new BigDecimal(xmlcertificateOcspResp.getSerialNumber()));
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateOcspResp, "notBefore",
+ Optional.ofNullable(xmlcertificateOcspResp.getId()));
+ certifOcspType.setDtIniValCertifOcsp(
+ XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateOcspResp.getNotBefore()));
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateOcspResp, "notAfter",
+ Optional.ofNullable(xmlcertificateOcspResp.getId()));
+ certifOcspType
+ .setDtFinValCertifOcsp(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateOcspResp.getNotAfter()));
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateOcspResp, "certificateDN",
+ Optional.ofNullable(xmlcertificateOcspResp.getId()));
+ certifOcspType.setDlDnSubject(xmlcertificateOcspResp.getCertificateDN());
+
+ // OCSP
+ VFOcspType ocspType = new VFOcspType();
+ // TOFIX: da verificare (ResponderID)
+ // https://tools.ietf.org/html/rfc6960#section-4.2.2.3
+ if (StringUtils.isNotBlank(ocsp.getSigningCertificateReference().getIssuerName())) {
+ ocspType.setDsCertifIssuername(ocsp.getSigningCertificateReference().getIssuerName());
+ }
+ if (ocsp.getSigningCertificateReference().isIssuerSerialPresent()) {
+ ocspType.setDsCertifSerialBase64(
+ Base64.encodeBase64String(ocsp.getSigningCertificateReference().getIssuerSerial()));
+ }
+ if (ocsp.getSigningCertificateReference().getSki() != null) {
+ ocspType.setDsCertifSkiBase64(Base64.encodeBase64String(ocsp.getSigningCertificateReference().getSki()));
+ }
+
+ ocspType.setCertifOcsp(certifOcspType);
+
+ return ocspType;
+ }
+
+ /*
+ * CRL + FILE
+ */
+ protected VFCrlType buildCrl(RevocationWrapper crl)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ VFCrlType crlType = new VFCrlType();
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(crl, "thisUpdate", Optional.ofNullable(crl.getId()));
+ crlType.setDtIniCrl(XmlDateUtility.dateToXMLGregorianCalendar(crl.getThisUpdate()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(crl, "nextUpdate", Optional.ofNullable(crl.getId()));
+ crlType.setDtScadCrl(XmlDateUtility.dateToXMLGregorianCalendar(crl.getNextUpdate()));
+ // Note: report EIDAS doens't cover it ! ( SubjectKeyId non presente su rerport)
+ // crlType.setNiSerialCrl();
+
+ return crlType;
+ }
+
+ /*
+ * formatter message esito
+ */
+ protected String generateErrorContrMsgEsito(String localmsg, UriBasedEnum indication, Optional details) {
+ if (details.isPresent()) {
+ return MessageFormat.format(MESSAGE_ESITO_CONTR_WITH_DETAILS, localmsg,
+ indication != null ? indication.getUri() : MESSAGE_NO_INDICATION, details.get());
+ } else {
+ return MessageFormat.format(MESSAGE_ESITO_CONTR_WITH_ERRORS, localmsg,
+ indication != null ? indication.getUri() : MESSAGE_NO_INDICATION);
+
+ }
+ }
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasFirmaBuilder.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasFirmaBuilder.java
new file mode 100644
index 0000000..d618674
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasFirmaBuilder.java
@@ -0,0 +1,873 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.firma.strategy.eidas;
+
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlCV;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlConstraint;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlConstraintsConclusion;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlISC;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlRAC;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlSAV;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlStatus;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlSubXCV;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlXCV;
+import eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper;
+import eu.europa.esig.dss.diagnostic.CertificateWrapper;
+import eu.europa.esig.dss.diagnostic.RevocationWrapper;
+import eu.europa.esig.dss.diagnostic.SignatureWrapper;
+import eu.europa.esig.dss.diagnostic.TimestampWrapper;
+import eu.europa.esig.dss.enumerations.Indication;
+import eu.europa.esig.dss.enumerations.RevocationType;
+import eu.europa.esig.dss.enumerations.SubIndication;
+import eu.europa.esig.dss.validation.reports.Reports;
+import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
+import it.eng.parer.firma.util.VerificaFirmaEnums;
+import it.eng.parer.firma.util.VerificaFirmaEnums.SacerIndication;
+import it.eng.parer.firma.xml.VFAdditionalInfoFirmaCompType;
+import it.eng.parer.firma.xml.VFCertifCaType;
+import it.eng.parer.firma.xml.VFCertifFirmatarioType;
+import it.eng.parer.firma.xml.VFContrFirmaCompType;
+import it.eng.parer.firma.xml.VFCrlType;
+import it.eng.parer.firma.xml.VFFirmaCompType;
+import it.eng.parer.firma.xml.VFOcspType;
+import it.eng.parer.firma.xml.VFTipoControlloType;
+import it.eng.parer.firma.xml.VFTipoFirmaType;
+import it.eng.parer.firma.xml.VFUrlDistribCrlType;
+import it.eng.parer.firma.xml.VFUrlDistribOcspType;
+import it.eng.parer.firma.xml.VerificaFirmaWrapper;
+import it.eng.parer.ws.utils.Costanti;
+import it.eng.parer.ws.utils.ParametroApplDB.ParametroApplFl;
+import it.eng.parer.ws.utils.XmlDateUtility;
+
+public class EidasFirmaBuilder extends EidasBaseWrapperResult implements IEidasBuilderVFObj {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EidasFirmaBuilder.class);
+
+ private Map controlliAbilitati;
+ private boolean isDataDiRiferimentoOnCompVers;
+ private Set modificatoriWSCalc;
+
+ public EidasFirmaBuilder(Map controlliAbilitati, boolean isDataDiRiferimentoOnCompVers,
+ Set modificatoriWSCalc) {
+ super();
+ this.controlliAbilitati = controlliAbilitati;
+ this.isDataDiRiferimentoOnCompVers = isDataDiRiferimentoOnCompVers;
+ this.modificatoriWSCalc = modificatoriWSCalc;
+ }
+
+ @Override
+ public VFFirmaCompType build(EidasWSReportsDTOTree eidasReportsDto, VerificaFirmaWrapper vfWrapper,
+ SignatureWrapper signatureW, Optional timestampW, ZonedDateTime dataDiRiferimento,
+ BigDecimal[] pgs)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ // reports by dss
+ Reports reports = new Reports(eidasReportsDto.getReport().getDiagnosticData(),
+ eidasReportsDto.getReport().getDetailedReport(), eidasReportsDto.getReport().getSimpleReport(),
+ null /* validation report non gestito */);
+
+ // FIRMA
+ VFFirmaCompType firmaCompType = new VFFirmaCompType();
+ // set setPgFirma
+ firmaCompType.setPgFirma(pgs[PG_FIRMA]);
+ // set id (id componente PARER)
+ firmaCompType.setId(eidasReportsDto.getIdComponente());
+
+ // add info (empty)
+ VFAdditionalInfoFirmaCompType additionalInfoFirmaCompType = new VFAdditionalInfoFirmaCompType();
+ firmaCompType.setAdditionalInfo(additionalInfoFirmaCompType);
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(signatureW, "signingCertificate", Optional.empty());
+ // SIGNATURE CERTIFICATE
+ // certificate
+ CertificateWrapper xmlcertificate = reports.getDiagnosticData()
+ .getUsedCertificateById(signatureW.getSigningCertificate().getId());
+
+ // FIRMATARIO + BLOB
+ VFCertifFirmatarioType certifFirmatarioType = new VFCertifFirmatarioType();
+ firmaCompType.setCertifFirmatario(certifFirmatarioType);
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificate, "serialNumber",
+ Optional.ofNullable(xmlcertificate.getId()));
+ certifFirmatarioType.setNiSerialCertifFirmatario(new BigDecimal(xmlcertificate.getSerialNumber()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificate, "notBefore",
+ Optional.ofNullable(xmlcertificate.getId()));
+ certifFirmatarioType
+ .setDtIniValCertifFirmatario(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificate.getNotBefore()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificate, "notAfter",
+ Optional.ofNullable(xmlcertificate.getId()));
+ certifFirmatarioType
+ .setDtFinValCertifFirmatario(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificate.getNotAfter()));
+
+ // CA
+ String certificateCAId = getCertificateCAId(signatureW, xmlcertificate);
+ //
+ CertificateWrapper xmlcertificateCA = reports.getDiagnosticData().getUsedCertificateById(certificateCAId);
+
+ VFCertifCaType certifCaType = new VFCertifCaType();
+ certifFirmatarioType.setCertifCaFirmatario(certifCaType);
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateCA, "serialNumber",
+ Optional.ofNullable(xmlcertificateCA.getId()));
+ certifCaType.setNiSerialCertifCa(new BigDecimal(xmlcertificateCA.getSerialNumber()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateCA, "notBefore",
+ Optional.ofNullable(xmlcertificateCA.getId()));
+ certifCaType.setDtIniValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateCA.getNotBefore()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateCA, "notAfter",
+ Optional.ofNullable(xmlcertificateCA.getId()));
+ certifCaType.setDtFinValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateCA.getNotAfter()));
+ // Note: report EIDAS doens't cover it ! ( SubjectKeyId non presente su rerport)
+ // certifCaType.setDsSubjectKeyId();
+ certifCaType.setDlDnIssuerCertifCa(xmlcertificateCA.getCertificateIssuerDN());
+ certifCaType.setDlDnSubjectCertifCa(xmlcertificateCA.getCertificateDN());
+
+ int urlIdx = 1;
+ // check NON empty URL
+ List crlFiltered = xmlcertificateCA.getCRLDistributionPoints().stream().filter(StringUtils::isNotBlank)
+ .collect(Collectors.toList());
+ for (String url : crlFiltered) {
+ VFUrlDistribCrlType urlDistribCrlType = new VFUrlDistribCrlType();
+ urlDistribCrlType.setDlUrlDistribCrl(url);
+ urlDistribCrlType.setNiOrdUrlDistribCrl(new BigDecimal(urlIdx));
+
+ certifCaType.getUrlDistribCrls().add(urlDistribCrlType);
+ // inc idx
+ urlIdx++;
+ }
+ // ocsp (from CA+certificate)
+ Iterable ocspCombinedUrls = CollectionUtils
+ .union(xmlcertificateCA.getOCSPAccessUrls(), xmlcertificate.getOCSPAccessUrls()).stream()
+ .filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ urlIdx = 1;
+ for (String url : ocspCombinedUrls) {
+ VFUrlDistribOcspType urlDistribOcspType = new VFUrlDistribOcspType();
+ urlDistribOcspType.setDlUrlDistribOcsp(url);
+ urlDistribOcspType.setNiOrdUrlDistribOcsp(new BigDecimal(urlIdx));
+
+ certifCaType.getUrlDistribOcsps().add(urlDistribOcspType);
+ // inc idx
+ urlIdx++;
+ }
+
+ // FIRMA : CA
+ firmaCompType.setCertifCa(certifCaType);
+ // nullable element
+ String dsAlgoFirma = null;
+ if (signatureW.getDigestAlgorithm() != null && signatureW.getEncryptionAlgorithm() != null) {
+ dsAlgoFirma = signatureW.getDigestAlgorithm().getName().concat("with")
+ .concat(signatureW.getEncryptionAlgorithm().getName());
+ }
+ firmaCompType.setDsAlgoFirma(dsAlgoFirma);
+ firmaCompType.setDlDnFirmatario(xmlcertificate.getCertificateDN());
+ firmaCompType.setDsFirmaBase64(Base64.encodeBase64String(signatureW.getSignatureValue()));
+
+ String cdFirmatario = null;
+ if (StringUtils.isNotBlank(xmlcertificate.getSubjectSerialNumber())) {
+ cdFirmatario = xmlcertificate.getSubjectSerialNumber();
+ } else {
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificate, "serialNumber",
+ Optional.ofNullable(xmlcertificate.getId()));
+ cdFirmatario = xmlcertificate.getSerialNumber();
+ }
+ firmaCompType.setCdFirmatario(cdFirmatario);
+ firmaCompType.setDtFirma(XmlDateUtility.dateToXMLGregorianCalendar(signatureW.getClaimedSigningTime()));
+
+ //
+ if (!signatureW.getTimestampList().isEmpty()) {
+ firmaCompType
+ .setTmRifTempUsato(XmlDateUtility.dateToXMLGregorianCalendar(signatureW.getClaimedSigningTime()));
+ firmaCompType.setTipoRiferimentoTemporaleUsato(VerificaFirmaEnums.TipoRifTemporale.MT_VERS_NORMA.name());
+ } else {
+ firmaCompType.setTmRifTempUsato(XmlDateUtility.dateToXMLGregorianCalendar(dataDiRiferimento));
+ firmaCompType.setTipoRiferimentoTemporaleUsato(
+ isDataDiRiferimentoOnCompVers ? VerificaFirmaEnums.TipoRifTemporale.RIF_TEMP_VERS.name()
+ : VerificaFirmaEnums.TipoRifTemporale.DATA_VERS.name());
+ }
+
+ //
+ firmaCompType.setTiFormatoFirma(signatureW.getSignatureFormat().toString());
+ //
+ firmaCompType.setNmCognomeFirmatario(xmlcertificate.getSurname());
+ firmaCompType.setNmFirmatario(xmlcertificate.getGivenName());
+ //
+ firmaCompType.setTiFirma(VFTipoFirmaType.DIGITALE);
+
+ // basic building block
+ XmlBasicBuildingBlocks bbb = reports.getDetailedReport().getBasicBuildingBlockById(signatureW.getId());
+ if (bbb == null) {
+ // TOFIX: cosa fare in questi casi ?!
+ LOG.warn("BasicBuildingBlockById not found SIGNATURE ID = {}", signatureW.getId());
+ }
+ // basic building block counter signature parent
+ XmlBasicBuildingBlocks bbbParent = null;
+ if (signatureW.isCounterSignature()) {
+ bbbParent = reports.getDetailedReport().getBasicBuildingBlockById(signatureW.getParent().getId());
+ if (bbbParent == null) {
+ // TOFIX: cosa fare in questi casi ?!
+ LOG.warn("Parent BasicBuildingBlockById not found SIGNATURE ID = {}", signatureW.getParent().getId());
+ }
+ }
+ // CONTROLLI FIRMA
+ // global result
+ boolean isSignaturePassed = reports.getSimpleReport().isValid(signatureW.getId());
+ buildContrFirmaComp(firmaCompType, isSignaturePassed, signatureW, xmlcertificate, bbb, bbbParent);
+
+ // OCSP CA
+ buildFirmaCompCAwithOCSP(reports, xmlcertificateCA, firmaCompType, dataDiRiferimento);
+ // OCSP + CONTR
+ buildFirmaCompCERwithOCSP(reports, xmlcertificate, firmaCompType, dataDiRiferimento, bbb);
+
+ // CRL CA
+ buildFirmaCompCAwithCRL(xmlcertificateCA, certifCaType, firmaCompType, dataDiRiferimento);
+ // CRL + CONTR
+ buildFirmaCompCERwithCRL(xmlcertificate, certifCaType, firmaCompType, dataDiRiferimento, bbb);
+
+ return firmaCompType;
+ }
+
+ private void buildContrFirmaComp(VFFirmaCompType firmaCompType, boolean isSignaturePassed,
+ SignatureWrapper signature, CertificateWrapper xmlcertificate, XmlBasicBuildingBlocks bbb,
+ XmlBasicBuildingBlocks bbbParent) {
+
+ // format checking
+ boolean isFormatCompliant = false;
+ XmlConstraintsConclusion formatCompliantConstraint = null;
+ if (bbbParent != null) {
+ formatCompliantConstraint = bbbParent.getFC();
+ // counter signature : non ha il controllo di formato (lo eredita dal padre)
+ isFormatCompliant = formatCompliantConstraint != null
+ && formatCompliantConstraint.getConclusion().getIndication().equals(Indication.PASSED);
+ } else {
+ formatCompliantConstraint = bbb.getFC();
+ isFormatCompliant = bbb != null && formatCompliantConstraint != null
+ && formatCompliantConstraint.getConclusion().getIndication().equals(Indication.PASSED);
+ }
+ SacerIndication esitoContrConforme = isFormatCompliant ? SacerIndication.POSITIVO
+ : SacerIndication.FORMATO_NON_CONFORME;
+
+ firmaCompType.setTiEsitoContrConforme(esitoContrConforme.name());
+ //
+ firmaCompType.setDsMsgEsitoContrConforme(esitoContrConforme.equals(SacerIndication.POSITIVO)
+ ? esitoContrConforme.message() : generateErrorContrMsgEsito(esitoContrConforme.message(),
+ formatCompliantConstraint.getConclusion().getIndication(), Optional.empty()));
+ //
+ SacerIndication esitoVerifFirma = isSignaturePassed ? SacerIndication.POSITIVO : SacerIndication.NEGATIVO;
+ // verifica risultato "globale" di verifica firma
+ firmaCompType.setTiEsitoVerifFirma(esitoVerifFirma.name());
+ //
+ firmaCompType.setDsMsgEsitoVerifFirma(esitoVerifFirma.message());
+
+ // caso "particolare" di building block non trovato (vedi controllo
+ // precedente con WARNING)
+ // in questi casi si assumono come NON PASSATI i controlli sull'oggetto perché
+ // non reperibili
+ boolean bbbFounded = bbb != null;
+
+ // CONTROLLI FIRMA - CRITTOGRAFICO signatureValidations
+ // CertificateReliability
+ VFContrFirmaCompType contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.CRITTOGRAFICO);
+
+ // valiazione crittografica
+ XmlCV cv = bbbFounded ? bbb.getCV() : null;
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ if (!bbbFounded) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ if (!cv.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
+ // init
+ SacerIndication esito = SacerIndication.NEGATIVO; // getSubIndication
+ SubIndication subIndication = cv.getConclusion().getSubIndication();
+ if (subIndication != null) {
+ switch (subIndication) {
+ case FORMAT_FAILURE:
+ esito = SacerIndication.NON_ESEGUITO;
+ break;
+ case NO_POE:
+ esito = SacerIndication.NON_NECESSARIO;
+ break;
+ case SIG_CRYPTO_FAILURE:
+ case HASH_FAILURE:
+ esito = SacerIndication.NEGATIVO;
+ break;
+ default:
+ esito = SacerIndication.NEGATIVO; // default
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, contrFirmaCompType.getTiContr(), subIndication);
+ break;
+ }
+ }
+ // log eidas message
+ logEidasConclusion(xmlcertificate, cv, VFTipoControlloType.CRITTOGRAFICO.name());
+
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(
+ generateErrorContrMsgEsito(esito.message(), subIndication, Optional.empty()));
+ } else {
+ contrFirmaCompType.setTiEsitoContrFirma(SacerIndication.POSITIVO.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(SacerIndication.POSITIVO.message());
+ }
+ }
+ }
+
+ // TOFIX: al momento è lo stesso risultato raccolto sopra
+ // CONTROLLI FIRMA - CRITTOGRAFICO_ABILITATO signatureValidations
+ contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.CRITTOGRAFICO_ABILITATO);
+
+ if (!bbbFounded) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ if (!cv.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
+ // init
+ SacerIndication esito = SacerIndication.NEGATIVO; // getSubIndication
+ SubIndication subIndication = cv.getConclusion().getSubIndication();
+ //
+ if (subIndication != null) {
+ switch (subIndication) {
+ case FORMAT_FAILURE:
+ esito = SacerIndication.NON_ESEGUITO;
+ break;
+ case NO_POE:
+ esito = SacerIndication.NON_NECESSARIO;
+ break;
+ case SIG_CRYPTO_FAILURE:
+ case HASH_FAILURE:
+ esito = SacerIndication.NEGATIVO;
+ break;
+ default:
+ esito = SacerIndication.NEGATIVO; // default
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, contrFirmaCompType.getTiContr(), subIndication);
+ break;
+ }
+ }
+ // log eidas message
+ logEidasConclusion(xmlcertificate, cv, VFTipoControlloType.CRITTOGRAFICO_ABILITATO.name());
+
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(
+ generateErrorContrMsgEsito(esito.message(), subIndication, Optional.empty()));
+ } else {
+ contrFirmaCompType.setTiEsitoContrFirma(SacerIndication.POSITIVO.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(SacerIndication.POSITIVO.message());
+ }
+ }
+
+ // CONTROLLI FIRMA - CATENA_TRUSTED_ABILITATO CertificateAssociation &&
+ // CertificateReliability
+ contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.CATENA_TRUSTED_ABILITATO);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ //
+ SacerIndication esito = signature.isTrustedChain() || isSignaturePassed ? SacerIndication.POSITIVO
+ : SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ }
+
+ // CONTROLLI FIRMA - CERTIFICATO CertificateExpiration
+ contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.CERTIFICATO);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ // identificazione certificato
+ XmlISC isc = bbbFounded ? bbb.getISC() : null;
+ // validità firma
+ XmlSAV sav = bbbFounded ? bbb.getSAV() : null;
+ // validità del certificato
+ XmlXCV xcv = bbbFounded ? bbb.getXCV() : null;
+ if (!bbbFounded) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ // isc
+ if ((!isc.getConclusion().getIndication().equals(Indication.PASSED)
+ || !sav.getConclusion().getIndication().equals(Indication.PASSED)) && !isSignaturePassed) {
+ // log eidas message
+ XmlConstraintsConclusion constraint = !isc.getConclusion().getIndication().equals(Indication.PASSED)
+ ? isc : sav;
+ logEidasConclusion(xmlcertificate, constraint, VFTipoControlloType.CERTIFICATO.name());
+
+ SacerIndication esito = SacerIndication.CERTIFICATO_NON_VALIDO;
+ // Nota: non si effettua verifica di sottoindicazione in quanto se questo tipo
+ // di controllo è
+ // errato
+ // si assume che il certificato di firma non è valido
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(generateErrorContrMsgEsito(esito.message(),
+ constraint.getConclusion().getIndication(), Optional.of(
+ "il certificato non presenta alcuni degli attributi previsti dallo standard ('signing-certificate', 'cert-diget', ecc.)")));
+ } else if (!xcv.getConclusion().getIndication().equals(Indication.PASSED) && !isSignaturePassed) {
+ // init
+ SacerIndication esito = SacerIndication.CERTIFICATO_ERRATO; // getSubIndication
+ SubIndication subIndication = xcv.getConclusion().getSubIndication();
+ Optional details = Optional.empty();
+ // get SubXCV for more infos
+ Optional subXCV = xcv.getSubXCV().stream()
+ .filter(c -> c.getId().equals(xmlcertificate.getId())).findFirst();
+ //
+ if (subIndication != null) {
+ switch (subIndication) {
+ case EXPIRED:
+ case OUT_OF_BOUNDS_NO_POE:
+ case OUT_OF_BOUNDS_NOT_REVOKED:
+ // The current time is not in the validity range of the signers certificate.
+ // Non è chiaro se la data di firma sia precedente o successiva alla validità
+ // del
+ // certificato.
+ // vedi anche https://ec.europa.eu/cefdigital/tracker/browse/DSS-2070
+ esito = SacerIndication.CERTIFICATO_SCADUTO;
+ details = Optional.of((xmlcertificate.getNotAfter() != null
+ ? " scaduto in data " + dateFormatter.format(xmlcertificate.getNotAfter()) : "")
+ + (xmlcertificate.getNotBefore() != null ? " valido a partire dalla data "
+ + dateFormatter.format(xmlcertificate.getNotBefore()) : "")
+ + " successivo al riferimento temporale utilizzato "
+ + dateFormatter.format(XmlDateUtility
+ .xmlGregorianCalendarToDate(firmaCompType.getTmRifTempUsato())));
+ break;
+ case NO_POE:
+ case CRYPTO_CONSTRAINTS_FAILURE_NO_POE:
+ case NOT_YET_VALID:
+ esito = SacerIndication.CERTIFICATO_NON_VALIDO;
+ details = Optional.of("certificato non è ancora valido");
+ break;
+ case TRY_LATER:
+ case REVOCATION_OUT_OF_BOUNDS_NO_POE:
+ // revoche non presenti
+ if (modificatoriWSCalc.contains(Costanti.ModificatoriWS.TAG_FIRMA_1_5)) {
+ esito = SacerIndication.REVOCHE_NON_CONSISTENTI;
+ } else {
+ esito = SacerIndication.CERTIFICATO_ERRATO;
+ // alternative message (che quindi non è il defalut dell'esito)
+ details = Optional.of(
+ "errore sul controllo delle revoche del certificato, informazioni non scaricabili o non affidabili");
+ }
+ break;
+ case REVOKED_NO_POE:
+ case REVOKED:
+ //
+ esito = SacerIndication.CERTIFICATO_REVOCATO;
+ // message details
+ if (subXCV.isPresent()) {
+ StringBuilder detailedMsg = new StringBuilder();
+ detailedMsg.append((subXCV.get().getRevocationInfo() != null
+ && subXCV.get().getRevocationInfo().getRevocationDate() != null
+ ? "revocato in data " + dateFormatter
+ .format(subXCV.get().getRevocationInfo().getRevocationDate())
+ : "data revoca non presente"));
+ //
+ detailedMsg.append(MESSAGE_ERROR_SEPARATOR);
+ //
+ detailedMsg.append(subXCV.get().getConstraint().stream()
+ .filter(s -> s.getStatus().equals(XmlStatus.NOT_OK)
+ && s.getAdditionalInfo() != null)
+ .map(XmlConstraint::getAdditionalInfo)
+ .collect(Collectors.joining(MESSAGE_ERROR_SEPARATOR)));
+ // details
+ details = Optional.of(detailedMsg.toString());
+ }
+ break;
+ default:
+ esito = SacerIndication.CERTIFICATO_ERRATO; // default
+ details = Optional.of("il certificato non è un certificato di firma");
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, contrFirmaCompType.getTiContr(),
+ cv.getConclusion().getSubIndication());
+ break;
+ }
+ }
+
+ // log eidas message
+ logEidasConclusion(xmlcertificate, xcv, VFTipoControlloType.CERTIFICATO.name());
+
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(
+ generateErrorContrMsgEsito(esito.message(), subIndication, details));
+ } else {
+ contrFirmaCompType.setTiEsitoContrFirma(SacerIndication.POSITIVO.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(SacerIndication.POSITIVO.message());
+ }
+ }
+ }
+
+ // CONTROLLI FIRMA - CATENA_TRUSTED CertificateAssociation &&
+ // CertificateReliability
+ // Nota: su DB risultano solo per casi molto vecchi il riferimento di questo
+ // controllo con la relativa CRL
+ contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.CATENA_TRUSTED);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ SacerIndication esito = signature.isTrustedChain() || isSignaturePassed ? SacerIndication.POSITIVO
+ : SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ }
+ }
+
+ private void buildFirmaCompCERwithCRL(CertificateWrapper xmlcertificate, VFCertifCaType certifCaType,
+ VFFirmaCompType firmaCompType, ZonedDateTime dataDiRiferimento, XmlBasicBuildingBlocks bbb)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // OCSP prioritario rispetto CRL
+ boolean hasOcsp = xmlcertificate.getCertificateRevocationData().stream()
+ .anyMatch(r -> r.getRevocationType().equals(RevocationType.OCSP));
+
+ // CRL
+ RevocationWrapper crl = findRevocationByType(xmlcertificate, dataDiRiferimento, RevocationType.CRL);
+ if (hasOcsp || crl == null) {
+ //
+ buildContrCRLNotFoundFirmaComp(firmaCompType, xmlcertificate, hasOcsp);
+ return;
+ }
+
+ // CRL
+ VFCrlType crlType = buildCrl(crl);
+
+ // FIRMA : CRL
+ firmaCompType.setCrl(crlType);
+ // CRL: CA
+ crlType.setCertifCa(certifCaType);
+
+ // controlli CRL
+ buildContrCRLFirmaComp(firmaCompType, xmlcertificate, crl, bbb, hasOcsp);
+ // CRL - END
+ }
+
+ private void buildFirmaCompCERwithOCSP(Reports reports, CertificateWrapper xmlcertificate,
+ VFFirmaCompType firmaCompType, ZonedDateTime dataDiRiferimento, XmlBasicBuildingBlocks bbb)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // verifica presenza CRL
+ boolean hasCrl = xmlcertificate.getCertificateRevocationData().stream()
+ .anyMatch(r -> r.getRevocationType().equals(RevocationType.CRL));
+ // OCSP
+ CertificateRevocationWrapper ocsp = findRevocationByType(xmlcertificate, dataDiRiferimento,
+ RevocationType.OCSP);
+ if (ocsp == null) {
+ //
+ buildContrOCSPNotFoundFirmaComp(firmaCompType, xmlcertificate, hasCrl);
+ return;
+ } // no ocsp
+
+ // CA
+ VFCertifCaType certifCaOcspType = buildOcspCertifCA(reports, xmlcertificate, ocsp);
+
+ // OCSP + certif
+ VFOcspType ocspType = buildOcspWithCertif(certifCaOcspType, ocsp);
+ // FIRMA : OCSP
+ firmaCompType.setOcsp(ocspType);
+
+ // controlli OCSP
+ buildContrOCSPFirmaComp(firmaCompType, xmlcertificate, ocsp, bbb, hasCrl);
+ // OCSP - END
+
+ }
+
+ private void buildFirmaCompCAwithCRL(CertificateWrapper xmlcertificateCA, VFCertifCaType certifCaType,
+ VFFirmaCompType firmaCompType, ZonedDateTime dataDiRiferimento)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ // OCSP prioritario rispetto CRL
+ boolean hasOcsp = xmlcertificateCA.getCertificateRevocationData().stream()
+ .anyMatch(r -> r.getRevocationType().equals(RevocationType.OCSP));
+
+ // CRL
+ RevocationWrapper crl = findRevocationByType(xmlcertificateCA, dataDiRiferimento, RevocationType.CRL);
+ if (hasOcsp || crl == null) {
+ return;
+ }
+
+ // CRL
+ VFCrlType crlType = buildCrl(crl);
+
+ // CRL : CA
+ crlType.setCertifCa(certifCaType);
+ // FIRMA : CRL CA
+ firmaCompType.setCrlCertifCa(crlType);
+ // CRL - END
+ }
+
+ private void buildFirmaCompCAwithOCSP(Reports reports, CertificateWrapper xmlcertificateCA,
+ VFFirmaCompType firmaCompType, ZonedDateTime dataDiRiferimento)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // OCSP
+ RevocationWrapper ocsp = findRevocationByType(xmlcertificateCA, dataDiRiferimento, RevocationType.OCSP);
+ if (ocsp == null) {
+ return;
+ } // no ocsp
+
+ // CA
+ VFCertifCaType certifCaOcspType = buildOcspCertifCA(reports, xmlcertificateCA, ocsp);
+
+ // OCSP + certif
+ VFOcspType ocspType = buildOcspWithCertif(certifCaOcspType, ocsp);
+ // FIRMA : OCSP
+ firmaCompType.setOcspCertifCa(ocspType);
+ // OCSP - END
+ }
+
+ // No CRL
+ private void buildContrCRLNotFoundFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
+ boolean hasOcsp) {
+ buildContrCRLFirmaComp(firmaCompType, xmlcertificate, null, null, hasOcsp);
+ }
+
+ private void buildContrCRLFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
+ RevocationWrapper crl, XmlBasicBuildingBlocks bbb, boolean hasOcsp) {
+
+ /*
+ * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
+ * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
+ */
+ boolean bbbFounded = bbb != null;
+ // presente la CRL
+ boolean hasCrl = crl != null;
+ // presente solo la CRL
+ boolean onlyCrl = hasCrl && !hasOcsp;
+ // presente solo OCSP
+ boolean onlyOcsp = !onlyCrl;
+ // no revoche
+ boolean noRevocations = !hasCrl && !hasOcsp;
+
+ VFContrFirmaCompType contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.CRL);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ // scenario 1 : crl e ocsp non presente
+ if (noRevocations) {
+ // valutazione CERTIFICATO_SCADUTO_3_12_2009
+ // caso 1 : 3/12/2009 <= notAfter && 3/12/2009 >= notBefore
+ Date revokedDate = Date
+ .from(LocalDate.of(2009, 12, 3).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
+ if (xmlcertificate.getNotAfter().before(revokedDate)
+ && xmlcertificate.getNotBefore().after(revokedDate)) {
+ SacerIndication esito = SacerIndication.CERTIFICATO_SCADUTO_3_12_2009;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else /* caso 2 */ {
+ SacerIndication esito = SacerIndication.CRL_NON_SCARICABILE;
+
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ }
+ } else if (onlyOcsp) /* scenario 3 : solo ocsp */ {
+ SacerIndication esito = SacerIndication.NON_NECESSARIO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(
+ esito.message() + ": controllo non necessario in quanto avviene tramite OCSP");
+ } else /* scenario 4 : solo CRL disponibile */ {
+ // Nota : non trovato il build block oppure l'indicazione con il risultato di
+ // validazione del certifcato
+ if (!bbbFounded
+ || bbb.getXCV().getSubXCV().stream().noneMatch(c -> c.getId().equals(xmlcertificate.getId()))) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ //
+ XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
+ .filter(c -> c.getId().equals(xmlcertificate.getId())).collect(Collectors.toList()).get(0);
+ //
+ List xmlRacs = subXvc.getCRS().getRAC().stream().filter(r -> r.getId().equals(crl.getId()))
+ .collect(Collectors.toList());
+
+ if (xmlRacs.isEmpty()) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else if (!xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
+ // log eidas message
+ logEidasConclusion(xmlcertificate, xmlRacs.get(0), VFTipoControlloType.CRL.name());
+
+ // evaluate subindication (Revocation acceptence)
+ SacerIndication esito = evaluateCRLXmlRacSubIndication(contrFirmaCompType.getTiContr().name(),
+ xmlRacs);
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(generateErrorContrMsgEsito(esito.message(),
+ xmlRacs.get(0).getConclusion().getIndication(), Optional.empty()));
+ } else {
+ SacerIndication esito = SacerIndication.POSITIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ }
+ }
+ }
+ }
+ }
+
+ private void buildContrOCSPNotFoundFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
+ boolean hasCrl) {
+ buildContrOCSPFirmaComp(firmaCompType, xmlcertificate, null, null, hasCrl);
+ }
+
+ private void buildContrOCSPFirmaComp(VFFirmaCompType firmaCompType, CertificateWrapper xmlcertificate,
+ CertificateRevocationWrapper ocsp, XmlBasicBuildingBlocks bbb, boolean hasCrl) {
+
+ /*
+ * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
+ * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
+ */
+ boolean bbbFounded = bbb != null;
+ // presente OCSP
+ boolean hasOcsp = ocsp != null;
+ // no revoche
+ boolean noRevocations = !hasCrl && !hasOcsp;
+
+ VFContrFirmaCompType contrFirmaCompType = new VFContrFirmaCompType();
+ firmaCompType.getContrFirmaComps().add(contrFirmaCompType);
+ contrFirmaCompType.setTiContr(VFTipoControlloType.OCSP);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ // scenario 1 : revoche non presenti
+ if (noRevocations) {
+ SacerIndication esito = SacerIndication.OCSP_NON_SCARICABILE;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else if (hasCrl && !hasOcsp) /* scenario 2 : presente la CRL ma NON OCSP */ {
+ SacerIndication esito = SacerIndication.NON_NECESSARIO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(
+ esito.message() + ": controllo non necessario in quanto avviene tramite CRL");
+ } else /* scenario 3 : ocsp presente */ {
+ // Nota : non trovato il build block oppure l'indicazione con il risultato di
+ // validazione del certifcato
+ if (!bbbFounded
+ || bbb.getXCV().getSubXCV().stream().noneMatch(c -> c.getId().equals(xmlcertificate.getId()))) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else {
+ //
+ XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
+ .filter(c -> c.getId().equals(xmlcertificate.getId())).collect(Collectors.toList()).get(0);
+ //
+ List xmlRacs = subXvc.getCRS().getRAC().stream().filter(r -> r.getId().equals(ocsp.getId()))
+ .collect(Collectors.toList());
+
+ if (xmlRacs.isEmpty()) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ } else if (!xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
+ // log eidas message
+ logEidasConclusion(xmlcertificate, xmlRacs.get(0), VFTipoControlloType.OCSP.name());
+
+ // evalutate subindication
+ SacerIndication esito = evaluateOCSPXmlRacSubIndication(ocsp,
+ contrFirmaCompType.getTiContr().name(), xmlRacs);
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(generateErrorContrMsgEsito(esito.message(),
+ xmlRacs.get(0).getConclusion().getIndication(), Optional.empty()));
+ } else {
+ SacerIndication esito = SacerIndication.OCSP_VALIDO;
+ //
+ contrFirmaCompType.setTiEsitoContrFirma(esito.name());
+ contrFirmaCompType.setDsMsgEsitoContrFirma(esito.message());
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasMarcaBuilder.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasMarcaBuilder.java
new file mode 100644
index 0000000..3638243
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/EidasMarcaBuilder.java
@@ -0,0 +1,660 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.firma.strategy.eidas;
+
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.europa.esig.dss.detailedreport.jaxb.XmlBasicBuildingBlocks;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlCV;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlISC;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlRAC;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlSubXCV;
+import eu.europa.esig.dss.detailedreport.jaxb.XmlXCV;
+import eu.europa.esig.dss.diagnostic.CertificateRevocationWrapper;
+import eu.europa.esig.dss.diagnostic.CertificateWrapper;
+import eu.europa.esig.dss.diagnostic.RevocationWrapper;
+import eu.europa.esig.dss.diagnostic.SignatureWrapper;
+import eu.europa.esig.dss.diagnostic.TimestampWrapper;
+import eu.europa.esig.dss.enumerations.Indication;
+import eu.europa.esig.dss.enumerations.RevocationType;
+import eu.europa.esig.dss.enumerations.SubIndication;
+import eu.europa.esig.dss.validation.reports.Reports;
+import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
+import it.eng.parer.firma.util.VerificaFirmaEnums.SacerIndication;
+import it.eng.parer.firma.xml.VFAdditionalInfoMarcaCompType;
+import it.eng.parer.firma.xml.VFCertifCaType;
+import it.eng.parer.firma.xml.VFContrMarcaCompType;
+import it.eng.parer.firma.xml.VFCrlType;
+import it.eng.parer.firma.xml.VFMarcaCompType;
+import it.eng.parer.firma.xml.VFOcspType;
+import it.eng.parer.firma.xml.VFTipoControlloType;
+import it.eng.parer.firma.xml.VFUrlDistribCrlType;
+import it.eng.parer.firma.xml.VFUrlDistribOcspType;
+import it.eng.parer.firma.xml.VerificaFirmaWrapper;
+import it.eng.parer.ws.utils.ParametroApplDB.ParametroApplFl;
+import it.eng.parer.ws.utils.XmlDateUtility;
+
+public class EidasMarcaBuilder extends EidasBaseWrapperResult implements IEidasBuilderVFObj {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EidasMarcaBuilder.class);
+
+ private Map controlliAbilitati;
+
+ public EidasMarcaBuilder(Map controlliAbilitati) {
+ super();
+ this.controlliAbilitati = controlliAbilitati;
+ }
+
+ @Override
+ public VFMarcaCompType build(EidasWSReportsDTOTree eidasReportsDto, VerificaFirmaWrapper vfWrapper,
+ SignatureWrapper signatureW, Optional timestampW, ZonedDateTime dataDiRiferimento,
+ BigDecimal[] pgs)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ // get TimestampWrapper
+ TimestampWrapper ts = timestampW
+ .orElseThrow(() -> new NullPointerException("Errore compilazione marca, timestamp NULL."));
+
+ // reports by dss
+ Reports reports = new Reports(eidasReportsDto.getReport().getDiagnosticData(),
+ eidasReportsDto.getReport().getDetailedReport(), eidasReportsDto.getReport().getSimpleReport(),
+ null /* validation report non gestito */);
+
+ // MARCHE
+ VFMarcaCompType marcaCompType = new VFMarcaCompType();
+ // set pgMarche
+ marcaCompType.setPgMarca(pgs[PG_MARCA]);
+ // set id (id componente PARER)
+ marcaCompType.setId(eidasReportsDto.getIdComponente());
+
+ // add info (empty)
+ VFAdditionalInfoMarcaCompType additionalInfoMarcaCompType = new VFAdditionalInfoMarcaCompType();
+ marcaCompType.setAdditionalInfo(additionalInfoMarcaCompType);
+
+ // ********************************
+ // USED CERTIFICATE
+ // ********************************
+ // CERTIFICATO TSA + BLOB
+ VFCertifCaType certifCaType = new VFCertifCaType();
+ marcaCompType.setCertifTsa(certifCaType);
+
+ // Timestamp no signing certificate !
+ if (ts.getSigningCertificate() == null) {
+ // building block
+ XmlBasicBuildingBlocks bbb = reports.getDetailedReport().getBasicBuildingBlockById(ts.getId());
+ if (bbb == null) {
+ // TOFIX: cosa fare in questi casi ?!
+ LOG.warn("BasicBuildingBlockById not found TS ID = {}", ts.getId());
+ }
+ // CONTROLLI MARCA
+ buildContrMarcaComp(marcaCompType, ts, null, bbb);
+ return marcaCompType;
+ }
+
+ CertificateWrapper xmlcertificateTsa = reports.getDiagnosticData()
+ .getUsedCertificateById(ts.getSigningCertificate().getId());
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateTsa, "serialNumber",
+ Optional.ofNullable(ts.getSigningCertificate().getId()));
+ certifCaType.setNiSerialCertifCa(new BigDecimal(xmlcertificateTsa.getSerialNumber()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateTsa, "notAfter",
+ Optional.ofNullable(ts.getSigningCertificate().getId()));
+ certifCaType.setDtFinValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateTsa.getNotAfter()));
+
+ // test
+ EidasWrapperResultControl.fieldCannotBeNull(xmlcertificateTsa, "notBefore",
+ Optional.ofNullable(ts.getSigningCertificate().getId()));
+ certifCaType.setDtIniValCertifCa(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateTsa.getNotBefore()));
+ // Note: report EIDAS doens't cover it ! ( SubjectKeyId non presente su rerport)
+ // certifCaType.setDsSubjectKeyId();
+ int urlIdx = 1;
+ // check NON empty URL
+ List crlFiltered = xmlcertificateTsa.getCRLDistributionPoints().stream().filter(StringUtils::isNotBlank)
+ .collect(Collectors.toList());
+ for (String url : crlFiltered) {
+ VFUrlDistribCrlType urlDistribCrlType = new VFUrlDistribCrlType();
+ urlDistribCrlType.setDlUrlDistribCrl(url);
+ urlDistribCrlType.setNiOrdUrlDistribCrl(new BigDecimal(urlIdx));
+
+ certifCaType.getUrlDistribCrls().add(urlDistribCrlType);
+
+ // inc idc
+ urlIdx++;
+ }
+ // CA
+ String certificateCAId = getCertificateCAId(ts, xmlcertificateTsa);
+ //
+ CertificateWrapper xmlcertificateCA = reports.getDiagnosticData().getUsedCertificateById(certificateCAId);
+ // ocsp (from CA+certificate)
+ // check NON empty URL
+ Iterable ocspCombinedUrls = CollectionUtils
+ .union(xmlcertificateCA.getOCSPAccessUrls(), xmlcertificateTsa.getOCSPAccessUrls()).stream()
+ .filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ // ocsp
+ urlIdx = 1;
+ for (String url : ocspCombinedUrls) {
+ VFUrlDistribOcspType urlDistribOcspType = new VFUrlDistribOcspType();
+ urlDistribOcspType.setDlUrlDistribOcsp(url);
+ urlDistribOcspType.setNiOrdUrlDistribOcsp(new BigDecimal(urlIdx));
+
+ certifCaType.getUrlDistribOcsps().add(urlDistribOcspType);
+ // inc idx
+ urlIdx++;
+ }
+
+ certifCaType.setDlDnIssuerCertifCa(xmlcertificateTsa.getCertificateIssuerDN());
+ certifCaType.setDlDnSubjectCertifCa(xmlcertificateTsa.getCertificateDN());
+
+ // *************************
+ // nullable element
+ String dsAlgoMarca = null;
+ if (ts.getDigestAlgorithm() != null && ts.getEncryptionAlgorithm() != null) {
+ dsAlgoMarca = ts.getDigestAlgorithm().getName().concat("with")
+ .concat(ts.getEncryptionAlgorithm().getName());
+ }
+ marcaCompType.setDsAlgoMarca(dsAlgoMarca);
+ marcaCompType.setTmMarcaTemp(XmlDateUtility.dateToXMLGregorianCalendar(ts.getProductionTime()));
+ marcaCompType.setTiFormatoMarca(signatureW.getSignatureFormat().toString());// ereditato dalla firma
+ marcaCompType.setDtScadMarca(XmlDateUtility.dateToXMLGregorianCalendar(xmlcertificateTsa.getNotAfter()));
+ // Note: report EIDAS doens't cover it ! ( MarcaBase64 non presente su rerport)
+ // marcaCompType.setDsMarcaBase64();
+ /**
+ * CONTROLLI / ESITI MARCA
+ */
+ // building block
+ XmlBasicBuildingBlocks bbb = reports.getDetailedReport().getBasicBuildingBlockById(ts.getId());
+ if (bbb == null) {
+ // TOFIX: cosa fare in questi casi ?!
+ LOG.warn("BasicBuildingBlockById not found TS ID = {}", ts.getId());
+ }
+ // CONTROLLI MARCA
+ buildContrMarcaComp(marcaCompType, ts, xmlcertificateTsa, bbb);
+
+ // OCSP
+ buildMarcaCompTSAwithOCSP(marcaCompType, reports, xmlcertificateTsa, dataDiRiferimento, bbb);
+
+ // CRL
+ buildMarcaCompTSAwithCRL(marcaCompType, certifCaType, xmlcertificateTsa, dataDiRiferimento, bbb);
+
+ return marcaCompType;
+ }
+
+ /*
+ * Nota: non possiamo persistere più di una CRL (non supportato), viene costruita un'apposita lista "filtrata" con
+ * il solo elemento utile
+ *
+ */
+ private void buildMarcaCompTSAwithCRL(VFMarcaCompType marcaCompType, VFCertifCaType certifCaType,
+ CertificateWrapper xmlcertificateTsa, ZonedDateTime dataDiRiferimento, XmlBasicBuildingBlocks bbb)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ // OCSP prioritario rispetto CRL
+ boolean hasOcsp = xmlcertificateTsa.getCertificateRevocationData().stream()
+ .anyMatch(r -> r.getRevocationType().equals(RevocationType.OCSP));
+
+ // CRL
+ RevocationWrapper crl = findRevocationByType(xmlcertificateTsa, dataDiRiferimento, RevocationType.CRL);
+ if (hasOcsp || crl == null) {
+ //
+ buildContrCRLNotFoundMarcaComp(marcaCompType, xmlcertificateTsa, hasOcsp);
+ return;
+ } // no crl
+
+ // CRL
+ VFCrlType crlTypeTsa = buildCrl(crl);
+ // CRL : CA
+ crlTypeTsa.setCertifCa(certifCaType);
+ // MARCA : CRL
+ marcaCompType.setCrlTsa(crlTypeTsa);
+
+ // controlli CRL
+ buildContrCRLMarcaComp(marcaCompType, xmlcertificateTsa, crl, bbb, hasOcsp);
+ // CRL - End
+ }
+
+ private void buildMarcaCompTSAwithOCSP(VFMarcaCompType marcaCompType, Reports reports,
+ CertificateWrapper xmlcertificateTsa, ZonedDateTime dataDiRiferimento, XmlBasicBuildingBlocks bbb)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // verifica presenza CRL
+ boolean hasCrl = xmlcertificateTsa.getCertificateRevocationData().stream()
+ .anyMatch(r -> r.getRevocationType().equals(RevocationType.CRL));
+
+ // OCSP
+ CertificateRevocationWrapper ocsp = findRevocationByType(xmlcertificateTsa, dataDiRiferimento,
+ RevocationType.OCSP);
+ if (ocsp == null) {
+ //
+ buildContrOCSPNotFoundMarcaComp(marcaCompType, xmlcertificateTsa, hasCrl);
+ return;
+ } // no crl
+
+ // CA
+ VFCertifCaType certifCaOcspType = buildOcspCertifCA(reports, xmlcertificateTsa, ocsp);
+
+ // build OCSP
+ VFOcspType ocspTypeTsa = buildOcspWithCertif(certifCaOcspType, ocsp);
+ marcaCompType.setOcspTsa(ocspTypeTsa);
+ //
+ // CRONTROLLI OCSP
+ buildContrOCSPMarcaComp(marcaCompType, xmlcertificateTsa, ocsp, bbb, hasCrl);
+ // OCSP - End
+ }
+
+ private void buildContrOCSPNotFoundMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
+ boolean hasCrl) {
+ buildContrOCSPMarcaComp(marcaCompType, xmlcertificateTsa, null, null, hasCrl);
+ }
+
+ private void buildContrOCSPMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
+ CertificateRevocationWrapper ocsp, XmlBasicBuildingBlocks bbb, boolean hasCrl) {
+
+ /*
+ * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
+ * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
+ */
+ boolean bbbFounded = bbb != null;
+ // presente OCSP
+ boolean hasOcsp = ocsp != null;
+ // no revoche
+ boolean noRevocations = !hasCrl && !hasOcsp;
+
+ // CONTROLLI MARCA - OCSP
+ VFContrMarcaCompType contrMarcaCompType = new VFContrMarcaCompType();
+ marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
+ contrMarcaCompType.setTiContr(VFTipoControlloType.OCSP);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ // scenario 1 : revoche non presenti
+ if (noRevocations) {
+ SacerIndication esito = SacerIndication.OCSP_NON_SCARICABILE;
+
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else if (hasCrl && !hasOcsp) /* scenario 2 : presente la CRL ma NON OCSP */ {
+ SacerIndication esito = SacerIndication.NON_NECESSARIO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType
+ .setDsMsgEsitoContrMarca(esito.message() + ": non è necessario in quanto avviene tramite CRL");
+ } else /* scenario 2 : ocsp presente */ {
+ // Nota : non trovato il build block oppure l'indicazione con il risultato di
+ // validazione del certifcato
+ if (!bbbFounded || bbb.getXCV().getSubXCV().stream()
+ .noneMatch(c -> c.getId().equals(xmlcertificateTsa.getId()))) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ //
+ XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
+ .filter(c -> c.getId().equals(xmlcertificateTsa.getId())).collect(Collectors.toList())
+ .get(0);
+ //
+ List xmlRacs = subXvc.getCRS().getRAC().stream().filter(r -> r.getId().equals(ocsp.getId()))
+ .collect(Collectors.toList());
+
+ if (xmlRacs.isEmpty()
+ || !xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
+ //
+ logEidasConclusion(xmlcertificateTsa, xmlRacs.get(0), VFTipoControlloType.OCSP.name());
+ // evalutate subindication
+ SacerIndication esito = evaluateOCSPXmlRacSubIndication(ocsp,
+ contrMarcaCompType.getTiContr().name(), xmlRacs);
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(generateErrorContrMsgEsito(esito.message(),
+ xmlRacs.get(0).getConclusion().getIndication(), Optional.empty()));
+ } else {
+ SacerIndication esito = SacerIndication.OCSP_VALIDO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ }
+ }
+ }
+ }
+ }
+
+ private void buildContrMarcaComp(VFMarcaCompType marcaCompType, TimestampWrapper ts,
+ CertificateWrapper xmlcertificateTsa, XmlBasicBuildingBlocks bbb) {
+ //
+ boolean bbbFounded = bbb != null;
+ // TOFIX: da verificare se diversa condizione
+ boolean isTimestampCompliant = ts.isSignatureIntact() && ts.isSignatureValid();
+
+ SacerIndication esitoContrConforme = isTimestampCompliant ? SacerIndication.POSITIVO
+ : SacerIndication.FORMATO_NON_CONOSCIUTO;
+
+ marcaCompType.setTiEsitoContrConforme(esitoContrConforme.name());
+ marcaCompType.setDsMsgEsitoContrConforme(esitoContrConforme.message());
+
+ if (!bbbFounded) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ marcaCompType.setTiEsitoVerifMarca(esito.name());
+ marcaCompType.setDsMsgEsitoVerifMarca(esito.message());
+ } else {
+ if (!bbb.getConclusion().getIndication().equals(Indication.PASSED)) {
+ logEidasConclusion(xmlcertificateTsa, bbb.getConclusion());
+ //
+ SacerIndication esito = SacerIndication.WARNING;
+ //
+ marcaCompType.setTiEsitoVerifMarca(esito.name());
+ marcaCompType.setDsMsgEsitoVerifMarca(generateErrorContrMsgEsito(esito.message(),
+ bbb.getConclusion().getIndication(), Optional.empty()));
+ } else {
+ SacerIndication esito = SacerIndication.POSITIVO;
+ //
+ marcaCompType.setTiEsitoVerifMarca(esito.name());
+ marcaCompType.setDsMsgEsitoVerifMarca(esito.message());
+ }
+ }
+
+ VFContrMarcaCompType contrMarcaCompType = new VFContrMarcaCompType();
+ marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
+ contrMarcaCompType.setTiContr(VFTipoControlloType.CRITTOGRAFICO);
+
+ XmlCV cv = bbbFounded ? bbb.getCV() : null;
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ if (!isTimestampCompliant) {
+ SacerIndication esito = SacerIndication.NON_ESEGUITO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else if (!bbbFounded) {
+ SacerIndication esito = SacerIndication.ERRORE;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ if (!cv.getConclusion().getIndication().equals(Indication.PASSED)) {
+ // init
+ SacerIndication esito = SacerIndication.NEGATIVO; // getSubIndication
+ SubIndication subIndication = cv.getConclusion().getSubIndication();
+ //
+ if (subIndication != null) {
+ switch (subIndication) {
+ case FORMAT_FAILURE:
+ esito = SacerIndication.NON_ESEGUITO;
+ break;
+ case NO_POE:
+ esito = SacerIndication.NON_NECESSARIO;
+ break;
+ default:
+ esito = SacerIndication.NEGATIVO; // default
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, contrMarcaCompType.getTiContr(), subIndication);
+ break;
+ }
+ }
+ // log eidas message
+ logEidasConclusion(xmlcertificateTsa, cv, VFTipoControlloType.CRITTOGRAFICO.name());
+
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(
+ generateErrorContrMsgEsito(esito.message(), subIndication, Optional.empty()));
+ } else {
+ contrMarcaCompType.setTiEsitoContrMarca(SacerIndication.POSITIVO.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(SacerIndication.POSITIVO.message());
+ }
+ }
+ }
+
+ // CONTROLLI MARCA - CERTIFICATO
+ contrMarcaCompType = new VFContrMarcaCompType();
+ marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
+ contrMarcaCompType.setTiContr(VFTipoControlloType.CERTIFICATO);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ // identificazione certificato
+ XmlISC isc = bbbFounded ? bbb.getISC() : null;
+ // validità del certificato
+ XmlXCV xcv = bbbFounded ? bbb.getXCV() : null;
+ //
+ if (!isTimestampCompliant) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else if (!bbbFounded) {
+ SacerIndication esito = SacerIndication.ERRORE;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ if (!isc.getConclusion().getIndication().equals(Indication.PASSED)) {
+ // log eidas message
+ logEidasConclusion(xmlcertificateTsa, isc, VFTipoControlloType.CERTIFICATO.name());
+
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(generateErrorContrMsgEsito(esito.message(),
+ isc.getConclusion().getIndication(), Optional.empty()));
+ } else if (!xcv.getConclusion().getIndication().equals(Indication.PASSED)) {
+ /*
+ * Unico esito supportato nelle marche è NEGATIVO (ERRORE su EIDAS non trova traduzione.....) Lo
+ * switch/case è "over" rispetto l'unico caso di esito possibile (se non PASSED), viene comunque
+ * implementato per "traccare" le possibili subindication
+ */
+ // init
+ SacerIndication esito = SacerIndication.NEGATIVO; // getSubIndication
+ SubIndication subIndication = xcv.getConclusion().getSubIndication();
+ Optional details = Optional.empty();
+ //
+ if (subIndication != null) {
+ switch (subIndication) {
+ case OUT_OF_BOUNDS_NO_POE:
+ case OUT_OF_BOUNDS_NOT_REVOKED:
+ // The current time is not in the validity range of the signers certificate.
+ // Non è chiaro se la data di firma sia precedente o successiva alla validità
+ // del
+ // certificato.
+ // vedi anche https://ec.europa.eu/cefdigital/tracker/browse/DSS-2070
+ esito = SacerIndication.NEGATIVO;
+ details = Optional.of(
+ (xmlcertificateTsa.getNotAfter() != null || xmlcertificateTsa.getNotBefore() != null
+ ? ": Il certificato " : "")
+ + (xmlcertificateTsa.getNotAfter() != null
+ ? " scaduto in data "
+ + dateFormatter.format(xmlcertificateTsa.getNotAfter())
+ : "")
+ + (xmlcertificateTsa.getNotBefore() != null
+ ? " valido a partire dalla data "
+ + dateFormatter.format(xmlcertificateTsa.getNotBefore())
+ + " successivo al riferimento temporale utilizzato "
+ + dateFormatter.format(xmlcertificateTsa.getNotAfter())
+ : ""));
+ break;
+ default:
+ esito = SacerIndication.NEGATIVO; // default
+ LOG.debug(LOG_FMT_SUBINDICATION, esito, contrMarcaCompType.getTiContr(),
+ cv.getConclusion().getSubIndication());
+ break;
+ }
+ }
+
+ // log eidas message
+ logEidasConclusion(xmlcertificateTsa, xcv, VFTipoControlloType.CERTIFICATO.name());
+
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(
+ generateErrorContrMsgEsito(esito.message(), subIndication, details));
+ } else {
+ contrMarcaCompType.setTiEsitoContrMarca(SacerIndication.POSITIVO.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(SacerIndication.POSITIVO.message());
+ }
+ }
+ }
+
+ // CONTROLLI MARCA - CATENA_TRUSTED
+ contrMarcaCompType = new VFContrMarcaCompType();
+ marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
+ contrMarcaCompType.setTiContr(VFTipoControlloType.CATENA_TRUSTED);
+ //
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else if (!isTimestampCompliant || xmlcertificateTsa == null) {
+ SacerIndication esito = SacerIndication.NON_ESEGUITO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ SacerIndication esito = xmlcertificateTsa.isTrustedChain() ? SacerIndication.POSITIVO
+ : SacerIndication.NEGATIVO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ }
+
+ }
+
+ private void buildContrCRLNotFoundMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
+ boolean hasOcsp) {
+ buildContrCRLMarcaComp(marcaCompType, xmlcertificateTsa, null, null, hasOcsp);
+ }
+
+ private void buildContrCRLMarcaComp(VFMarcaCompType marcaCompType, CertificateWrapper xmlcertificateTsa,
+ RevocationWrapper crl, XmlBasicBuildingBlocks bbb, boolean hasOcsp) {
+ /*
+ * caso "particolare" di building block non trovato (vedi controllo precedente con WARNING) in questi casi si
+ * assumono come NON PASSATI i controlli sull'oggetto perché non reperibili
+ */
+ boolean bbbFounded = bbb != null;
+ // presente la CRL
+ boolean hasCrl = crl != null;
+ // presente solo la CRL
+ boolean onlyCrl = hasCrl && !hasOcsp;
+ // presente solo OCSP
+ boolean onlyOcsp = !onlyCrl;
+ // no revoche
+ boolean noRevocations = !hasCrl && !hasOcsp;
+
+ // CONTROLLI MARCA - CRL
+ VFContrMarcaCompType contrMarcaCompType = new VFContrMarcaCompType();
+ marcaCompType.getContrMarcaComps().add(contrMarcaCompType);
+ contrMarcaCompType.setTiContr(VFTipoControlloType.CRL);
+
+ if (!controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS).booleanValue()) {
+ SacerIndication esito = SacerIndication.DISABILITATO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ // scenario 1 : crl e ocsp non presente
+ if (noRevocations) {
+ // caso 1 : 3/12/2009 <= notAfter && 3/12/2009 >= notBefore
+ Date revokedDate = Date
+ .from(LocalDate.of(2009, 12, 3).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
+ if (xmlcertificateTsa.getNotAfter().before(revokedDate)
+ && xmlcertificateTsa.getNotBefore().after(revokedDate)) {
+ SacerIndication esito = SacerIndication.CERTIFICATO_SCADUTO_3_12_2009;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else /* caso 2 */ {
+ SacerIndication esito = SacerIndication.CRL_NON_SCARICABILE;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+
+ }
+ } else /* scenario 2 : solo ocsp */ if (onlyOcsp) {
+ SacerIndication esito = SacerIndication.CRL_NON_SCARICABILE;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message()
+ + ": non scaricabile dal server perché il controllo sulla revoca avviene tramite OCSP");
+ } /* scenario 3 : solo CRL disponibile */ else {
+ if (!bbbFounded || bbb.getXCV().getSubXCV().stream()
+ .noneMatch(c -> c.getId().equals(xmlcertificateTsa.getId()))) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else {
+ //
+ XmlSubXCV subXvc = bbb.getXCV().getSubXCV().stream()
+ .filter(c -> c.getId().equals(xmlcertificateTsa.getId())).collect(Collectors.toList())
+ .get(0);
+ //
+ List xmlRacs = subXvc.getCRS().getRAC().stream().filter(r -> r.getId().equals(crl.getId()))
+ .collect(Collectors.toList());
+ if (xmlRacs.isEmpty()) {
+ SacerIndication esito = SacerIndication.NEGATIVO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ } else if (!xmlRacs.get(0).getConclusion().getIndication().equals(Indication.PASSED)) {
+ // log eidas message
+ logEidasConclusion(xmlcertificateTsa, bbb.getConclusion(), VFTipoControlloType.CRL.name());
+
+ // evaluate subindication (Revocation acceptence)
+ SacerIndication esito = evaluateCRLXmlRacSubIndication(contrMarcaCompType.getTiContr().name(),
+ xmlRacs);
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(generateErrorContrMsgEsito(esito.message(),
+ xmlRacs.get(0).getConclusion().getIndication(), Optional.empty()));
+ } else {
+ SacerIndication esito = SacerIndication.POSITIVO;
+ //
+ contrMarcaCompType.setTiEsitoContrMarca(esito.name());
+ contrMarcaCompType.setDsMsgEsitoContrMarca(esito.message());
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/IEidasBuilderVFObj.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/IEidasBuilderVFObj.java
new file mode 100644
index 0000000..2a73f6d
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/IEidasBuilderVFObj.java
@@ -0,0 +1,71 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package it.eng.parer.firma.strategy.eidas;
+
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
+import java.time.ZonedDateTime;
+import java.util.Optional;
+
+import eu.europa.esig.dss.diagnostic.SignatureWrapper;
+import eu.europa.esig.dss.diagnostic.TimestampWrapper;
+import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
+import it.eng.parer.firma.xml.VFFirmaCompType;
+import it.eng.parer.firma.xml.VFMarcaCompType;
+import it.eng.parer.firma.xml.VerificaFirmaWrapper;
+
+public interface IEidasBuilderVFObj {
+
+ /**
+ * Main method per la generazione del dto trattatot nel singolo strategy (vedi {@link EidasFirmaBuilder}
+ * {@link EidasMarcaBuilder}), viene restituito un oggetto di tipo {@link VFFirmaCompType} / {@link VFMarcaCompType}
+ *
+ * @param eidasReportsDto
+ * dto contentenete la risposta del servizio di verifica firma EIDAS
+ * @param vfWrapper
+ * wrapper finale che conterrà i report EIDAS mappati opportunamente
+ * @param signatureW
+ * wrapper firma EIDAS
+ * @param timestampW
+ * timestamp wrapper EIDAS
+ * @param dataDiRiferimento
+ * data di verifica (esplicitata su metadati o sysdate)
+ * @param pgs
+ * array di progressivi busta/firma/marca
+ *
+ * @return restituitisce un oggetto di tipo {@link VFFirmaCompType} o {@link VFMarcaCompType}
+ *
+ * @throws InvocationTargetException
+ * eccezione generica
+ * @throws IllegalArgumentException
+ * eccezione generica
+ * @throws IllegalAccessException
+ * eccezione generica
+ * @throws NoSuchMethodException
+ * eccezione generica
+ *
+ */
+ public T build(EidasWSReportsDTOTree eidasReportsDto, VerificaFirmaWrapper vfWrapper, SignatureWrapper signatureW,
+ Optional timestampW, ZonedDateTime dataDiRiferimento, BigDecimal[] pgs)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasAbsBuilderFactory.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasAbsBuilderFactory.java
new file mode 100644
index 0000000..d8f26a9
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasAbsBuilderFactory.java
@@ -0,0 +1,98 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.firma.strategy.eidas.factory;
+
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
+import java.time.ZonedDateTime;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import eu.europa.esig.dss.diagnostic.SignatureWrapper;
+import eu.europa.esig.dss.diagnostic.TimestampWrapper;
+import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
+import it.eng.parer.firma.strategy.eidas.EidasMarcaBuilder;
+import it.eng.parer.firma.strategy.eidas.IEidasBuilderVFObj;
+import it.eng.parer.firma.xml.VFFirmaCompType;
+import it.eng.parer.firma.xml.VFMarcaCompType;
+import it.eng.parer.firma.xml.VerificaFirmaWrapper;
+import it.eng.parer.ws.utils.Costanti;
+
+public abstract class EidasAbsBuilderFactory {
+
+ /**
+ *
+ * Factory creazione e build del dto di tipo "verifica firma", che ospiterà firma o marca.
+ *
+ * @param controlliAbilitati
+ * controlli abilitati recuperti a sistema
+ * @param isDataDiRiferimentoOnCompVers
+ * se data riferimento per verifica esplicita
+ * @param dataDiRiferimento
+ * data di verifica (esplicitata su metadati o sysdate)
+ * @param modificatoriWSCalc
+ * modificatori ws (dipendono dalla versione)
+ * @param eidasReportsDto
+ * dto contentenete la risposta del servizio di verifica firma EIDAS
+ * @param vfWrapper
+ * wrapper finale che conterrà i report EIDAS mappati opportunamente
+ * @param signatureW
+ * wrapper firma EIDAS
+ * @param timestampW
+ * timestamp wrapper EIDAS
+ * @param pgs
+ * array di progressivi busta/firma/marca
+ *
+ * @return restituitisce un oggetto di tipo {@link VFFirmaCompType} o {@link VFMarcaCompType}
+ *
+ * @throws InvocationTargetException
+ * eccezione generica
+ * @throws IllegalArgumentException
+ * eccezione generica
+ * @throws IllegalAccessException
+ * eccezione generica
+ * @throws NoSuchMethodException
+ * eccezione generica
+ */
+ public V create(Map controlliAbilitati, boolean isDataDiRiferimentoOnCompVers,
+ ZonedDateTime dataDiRiferimento, Set modificatoriWSCalc,
+ EidasWSReportsDTOTree eidasReportsDto, VerificaFirmaWrapper vfWrapper, SignatureWrapper signatureW,
+ Optional timestampW, BigDecimal[] pgs)
+ throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ IEidasBuilderVFObj buider = init(controlliAbilitati, isDataDiRiferimentoOnCompVers, modificatoriWSCalc);
+
+ return buider.build(eidasReportsDto, vfWrapper, signatureW, timestampW, dataDiRiferimento, pgs);
+ }
+
+ /**
+ * Creazione strategy ({@link EidasVFFirmaCompBuilder} e {@link EidasMarcaBuilder})
+ *
+ * @param controlliAbilitati
+ * controlli abilitati recuperti a sistema
+ * @param isDataDiRiferimentoOnCompVers
+ * data di verifica (esplicitata su metadati o sysdate)
+ * @param modificatoriWSCalc
+ * modificatori ws (dipendono dalla versione)
+ *
+ * @return implementazione stratey effettivo
+ */
+ protected abstract IEidasBuilderVFObj init(Map controlliAbilitati,
+ boolean isDataDiRiferimentoOnCompVers, Set modificatoriWSCalc);
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasVFFirmaCompBuilder.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasVFFirmaCompBuilder.java
new file mode 100644
index 0000000..0959765
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasVFFirmaCompBuilder.java
@@ -0,0 +1,36 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.firma.strategy.eidas.factory;
+
+import java.util.Map;
+import java.util.Set;
+
+import it.eng.parer.firma.strategy.eidas.EidasFirmaBuilder;
+import it.eng.parer.firma.strategy.eidas.IEidasBuilderVFObj;
+import it.eng.parer.firma.xml.VFFirmaCompType;
+import it.eng.parer.ws.utils.Costanti.ModificatoriWS;
+
+public class EidasVFFirmaCompBuilder extends EidasAbsBuilderFactory {
+
+ @Override
+ protected IEidasBuilderVFObj init(Map controlliAbilitati,
+ boolean isDataDiRiferimentoOnCompVers, Set modificatoriWSCalc) {
+ return new EidasFirmaBuilder(controlliAbilitati, isDataDiRiferimentoOnCompVers, modificatoriWSCalc);
+ }
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasVFMarcaCompBuilder.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasVFMarcaCompBuilder.java
new file mode 100644
index 0000000..1b46cde
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/strategy/eidas/factory/EidasVFMarcaCompBuilder.java
@@ -0,0 +1,36 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.firma.strategy.eidas.factory;
+
+import java.util.Map;
+import java.util.Set;
+
+import it.eng.parer.firma.strategy.eidas.EidasMarcaBuilder;
+import it.eng.parer.firma.strategy.eidas.IEidasBuilderVFObj;
+import it.eng.parer.firma.xml.VFMarcaCompType;
+import it.eng.parer.ws.utils.Costanti.ModificatoriWS;
+
+public class EidasVFMarcaCompBuilder extends EidasAbsBuilderFactory {
+
+ @Override
+ protected IEidasBuilderVFObj init(Map controlliAbilitati,
+ boolean isDataDiRiferimentoOnCompVers, Set modificatoriWSCalc) {
+ return new EidasMarcaBuilder(controlliAbilitati);
+ }
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/CryptoErrorHandler.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/CryptoErrorHandler.java
index 7ffabde..70ddda8 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/CryptoErrorHandler.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/CryptoErrorHandler.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.util;
import java.io.IOException;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasErrorHandler.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasErrorHandler.java
index 5cdf909..065b028 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasErrorHandler.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasErrorHandler.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.firma.util;
import java.io.IOException;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasUtils.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasUtils.java
index a25a018..792c58b 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasUtils.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/EidasUtils.java
@@ -1,13 +1,29 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.firma.util;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -19,8 +35,6 @@
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.xml.sax.SAXException;
@@ -30,16 +44,12 @@
import eu.europa.esig.dss.diagnostic.DiagnosticDataXmlDefiner;
import eu.europa.esig.dss.simplereport.SimpleReportFacade;
import eu.europa.esig.dss.simplereport.SimpleReportXmlDefiner;
-import it.eng.parer.eidas.model.DataToValidateDTOExt;
-import it.eng.parer.eidas.model.EidasMetadataToValidate;
+import it.eng.parer.eidas.model.EidasDataToValidateMetadata;
import it.eng.parer.eidas.model.EidasWSReportsDTOTree;
-import it.eng.parer.eidas.model.RemoteDocumentExt;
-import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
-import it.eng.parer.exception.SacerWsRuntimeException;
+import it.eng.parer.eidas.model.EidasRemoteDocument;
import it.eng.parer.ws.utils.ParametroApplDB.ParametroApplFl;
import it.eng.parer.ws.versamento.dto.ComponenteVers;
import it.eng.parer.ws.versamento.dto.FileBinario;
-import java.time.ZonedDateTime;
/**
*
@@ -52,10 +62,9 @@ private EidasUtils() {
}
/**
- * @deprecated
*
- * Compila l'input per la verifica firma tramite DSS. Utilizzata la versione /v2 in cui si utilizza
- * multipart con stream da file.
+ * Compila l'input per la verifica firma tramite DSS. Utilizzata la versione /v2 in cui si utilizza multipart con
+ * stream da file.
*
* @param componenteVers
* componente versato
@@ -65,95 +74,44 @@ private EidasUtils() {
* lista controlli abilitati (flag true/false)
* @param dataDiRiferimento
* data di riferimento
- * @param verificaAllaDataDiFirma
- * flag true/false per verifica alla data firma
* @param uuid
* UUID generato
*
* @return Bean utilizzato per invocare il servizio di verifica EIDAS.
*/
- @Deprecated
- public static DataToValidateDTOExt buildEidasDtoFromCompVers(ComponenteVers componenteVers,
- List sottoComponentiFirma, Map controlliAbilitati, Date dataDiRiferimento,
- boolean verificaAllaDataDiFirma, String uuid) {
- final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
+ public static EidasDataToValidateMetadata buildDataToValidateMetadataFromCompVers(ComponenteVers componenteVers,
+ List sottoComponentiFirma, Map controlliAbilitati,
+ ZonedDateTime dataDiRiferimento, String uuid) {
+ final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
//
if (!hasFirmeDetached) {
/*
* Firma non detached : il file firmato è su componente
*/
FileBinario signedFB = componenteVers.getRifFileBinario();
- return buildDocuments(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento,
- signedFB.getFileName(), componenteVers.getId(), signedFB.getFileSuDisco(), uuid);
+ return buildDocuments(controlliAbilitati, dataDiRiferimento, signedFB, componenteVers.getId(), uuid);
} else {
/*
* Firma detached : il file firmato è su sottocomponente
*/
FileBinario signedFB = sottoComponentiFirma.get(0).getRifFileBinario();
FileBinario originalFB = componenteVers.getRifFileBinario();
- return buildDocuments(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento,
- signedFB.getFileName(), componenteVers.getId(), signedFB.getFileSuDisco(), true,
- originalFB.getFileName(), sottoComponentiFirma.get(0).getId(), originalFB.getFileSuDisco(), uuid);
- }
- }
-
- /**
- * @deprecated
- *
- * Compila l'input per la verifica firma tramite DSS. Utilizzata la versione /v2 in cui si utilizza
- * multipart con stream da file.
- *
- * @param signedDoc
- * documento firma
- * @param firme
- * lista file firmati
- * @param marche
- * lista file di tipo marche
- * @param controlliAbilitati
- * lista controlli abilitati (flag true/false)
- * @param verificaAllaDataDiFirma
- * flag true/false per verifica alla data firma
- * @param dataDiRiferimento
- * data di riferimento
- * @param uuid
- * UUID generato
- * @param idComponente
- * ID componente firmato
- * @param idSottoComponente
- * ID sotto componente firmato
- *
- * @return Bean utilizzato per invocare il servizio di verifica EIDAS.
- */
- @Deprecated
- public static DataToValidateDTOExt buildEidasDtoFromFiles(File signedDoc, List firme, List marche,
- Map controlliAbilitati, boolean verificaAllaDataDiFirma, Date dataDiRiferimento,
- String uuid, String idComponente, String idSottoComponente) {
- final boolean hasFirmeDetached = firme != null && !firme.isEmpty();
-
- if (!hasFirmeDetached) {
- return buildDocuments(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento, signedDoc.getName(),
- idComponente, signedDoc, uuid);
- } else {
- File originalDoc = firme.get(0);
- return buildDocuments(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento, signedDoc.getName(),
- idComponente, signedDoc, true, idSottoComponente, originalDoc.getName(), originalDoc, uuid);
+ return buildDocuments(controlliAbilitati, dataDiRiferimento, signedFB, componenteVers.getId(), true,
+ originalFB, sottoComponentiFirma.get(0).getId(), uuid);
}
}
- private static DataToValidateDTOExt buildDocuments(Map controlliAbilitati,
- boolean verificaAllaDataDiFirma, Date dataDiRiferimento, String fileName, String idComponente,
- File signedDoc, String uuid) {
- return buildDocuments(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento, fileName, idComponente,
- signedDoc, false, null, null, null, uuid);
+ private static EidasDataToValidateMetadata buildDocuments(Map controlliAbilitati,
+ ZonedDateTime dataDiRiferimento, FileBinario signedDoc, String idComponente, String uuid) {
+ return buildDocuments(controlliAbilitati, dataDiRiferimento, signedDoc, idComponente, false, null, null, uuid);
}
- private static DataToValidateDTOExt buildDocuments(Map controlliAbilitati,
- boolean verificaAllaDataDiFirma, Date dataDiRiferimento, String signedDocFileName, String idComponente,
- File signedDoc, boolean hasFirmeDetached, String originalDocFileName, String idSottoComponente,
- File originalDoc, String uuid) {
+ private static EidasDataToValidateMetadata buildDocuments(Map controlliAbilitati,
+ ZonedDateTime dataDiRiferimento, FileBinario signedDoc, String idComponente, boolean hasFirmeDetached,
+ FileBinario originalDoc, String idSottoComponente, String uuid) {
- DataToValidateDTOExt input = new DataToValidateDTOExt();
+ EidasDataToValidateMetadata input = new EidasDataToValidateMetadata();
boolean controlloCrittogaficoAbilitato = controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS);
boolean controlloCatenaTrustAbilitato = controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS);
@@ -164,105 +122,37 @@ private static DataToValidateDTOExt buildDocuments(Map controll
input.setControlloCertificatoIgnorato(!controlloCertificatoAbilitato);
input.setControlloRevocaIgnorato(!controlloRevocaAbilitato);
- if (!hasFirmeDetached) {
- // signed
- RemoteDocumentExt signedDocument = new RemoteDocumentExt();
- signedDocument.setName(StringUtils.defaultString(signedDocFileName, signedDoc.getName()));
- signedDocument.setBytes(toByteArray(signedDoc));
- input.setSignedDocumentExt(signedDocument);
- // id componente firmato
- input.setIdComponente(idComponente);
- } else {
- RemoteDocumentExt originalDocument = new RemoteDocumentExt();
- originalDocument.setName(StringUtils.defaultString(originalDocFileName, originalDoc.getName()));
- originalDocument.setBytes(toByteArray(originalDoc));
- input.setOriginalDocumentsExt(Arrays.asList(originalDocument));
- // signed
- RemoteDocumentExt signedDocument = new RemoteDocumentExt();
- signedDocument.setName(StringUtils.defaultString(signedDocFileName, signedDoc.getName()));
- signedDocument.setBytes(toByteArray(signedDoc));
- input.setSignedDocumentExt(signedDocument);
- // id componente firmato
- input.setIdComponente(idSottoComponente);
+ // no raw
+ boolean includeValues = controlliAbilitati.get(ParametroApplFl.FL_EIDAS_INCLUDI_FILEBASE64);
+ input.setIncludeCertificateRevocationValues(includeValues);
+ input.setIncludeCertificateTokenValues(includeValues);
+ input.setIncludeTimestampTokenValues(includeValues);
+ // id componente firmato
+ input.setDocumentId(hasFirmeDetached ? idSottoComponente : idComponente);
+
+ // signed
+ EidasRemoteDocument eidasRemoteDocument = new EidasRemoteDocument();
+ eidasRemoteDocument.setName(signedDoc.getFileName());
+ if (signedDoc.getObjectStorageResource() != null) {
+ eidasRemoteDocument.setUri(signedDoc.getObjectStorageResource().getPresignedURL());
}
- //
- input.setUuid(uuid);
- //
- input.setVerificaAllaDataDiFirma(verificaAllaDataDiFirma);
- //
- input.setDataDiRiferimento(dataDiRiferimento);
+ input.setRemoteSignedDocument(eidasRemoteDocument);
- return input;
- }
-
- public static EidasMetadataToValidate buildEidasMetadata(ComponenteVers componenteVers,
- List sottoComponentiFirma, Map controlliAbilitati,
- boolean verificaAllaDataDiFirma, ZonedDateTime dataDiRiferimento, String uuid) {
-
- final boolean hasFirmeDetached = sottoComponentiFirma != null && !sottoComponentiFirma.isEmpty();
-
- if (!hasFirmeDetached) {
- return buildEidasMetadata(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento,
- componenteVers.getId(), componenteVers.getRifFileBinario().getFileName(), StringUtils.EMPTY, uuid);
- } else {
- return buildEidasMetadata(controlliAbilitati, verificaAllaDataDiFirma, dataDiRiferimento,
- sottoComponentiFirma.get(0).getId(), sottoComponentiFirma.get(0).getRifFileBinario().getFileName(),
- componenteVers.getRifFileBinario().getFileName(), uuid);
+ if (hasFirmeDetached) {
+ EidasRemoteDocument eidasRemoteDocumentOrig = new EidasRemoteDocument();
+ eidasRemoteDocumentOrig.setName(originalDoc.getFileName());
+ if (originalDoc.getObjectStorageResource() != null) {
+ eidasRemoteDocumentOrig.setUri(originalDoc.getObjectStorageResource().getPresignedURL());
+ }
+ input.setRemoteOriginalDocuments(Arrays.asList(eidasRemoteDocumentOrig));
}
-
- }
-
- private static EidasMetadataToValidate buildEidasMetadata(Map controlliAbilitati,
- boolean verificaAllaDataDiFirma, ZonedDateTime dataDiRiferimento, String idDocuments,
- String signedDocumentName, String originalDocumentName, String uuid) {
-
- EidasMetadataToValidate input = new EidasMetadataToValidate();
-
- // control flag
- boolean controlloCrittogaficoAbilitato = controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CRITTOG_VERS);
- boolean controlloCatenaTrustAbilitato = controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_TRUST_VERS);
- boolean controlloCertificatoAbilitato = controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_CERTIF_VERS);
- boolean controlloRevocaAbilitato = controlliAbilitati.get(ParametroApplFl.FL_ABILITA_CONTR_REVOCA_VERS);
-
- input.setControlloCrittograficoIgnorato(!controlloCrittogaficoAbilitato);
- input.setControlloCatenaTrustIgnorato(!controlloCatenaTrustAbilitato);
- input.setControlloCertificatoIgnorato(!controlloCertificatoAbilitato);
- input.setControlloRevocaIgnorato(!controlloRevocaAbilitato);
- // uuid
+ //
input.setUuid(uuid);
- // verificaAllaDataDiFirma
- input.setVerificaAllaDataDiFirma(verificaAllaDataDiFirma);
- // dataDiRiferimento
- if (dataDiRiferimento != null) {
- input.setDataDiRiferimento(Date.from(dataDiRiferimento.toInstant()));
- }
+ input.setDataDiRiferimento(Date.from(dataDiRiferimento.toInstant()));
- // id componente / sotto componente
- input.setIdDocuments(idDocuments);
- // signed document name
- input.setSignedDocumentName(signedDocumentName);
- // original document name
- /*
- * nota: attenzione questo meccanismo è posizionale ossia, fa il "paio" con l'array di file originali passati
- * nel body del multipart (parametro "originalFiles") e.g. pos = 0 file0.ext / originalFiles 0 pos = 1 file1.ext
- * / originalFiles 1
- */
- input.setOriginalDocumentNames(new String[] { originalDocumentName });
return input;
}
- private static byte[] toByteArray(File file) {
- if (file == null) {
- return ArrayUtils.EMPTY_BYTE_ARRAY;
- }
- try (FileInputStream fis = new FileInputStream(file)) {
- return IOUtils.toByteArray(fis);
-
- } catch (IOException e) {
- throw new SacerWsRuntimeException(e, SacerWsErrorCategory.INTERNAL_ERROR);
- }
- }
-
// tree no binaries
/**
* @deprecated
@@ -345,8 +235,6 @@ private static void removeraw(EidasWSReportsDTOTree dto) {
// set null on chain
s.getCertificateChain().forEach(c -> c.getCertificate().setBase64Encoded(StringUtils.EMPTY.getBytes()));
});
- // extensions
- dto.setExtensions(null);
}
/*
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaEnums.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaEnums.java
index bfc6920..7dc0b60 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaEnums.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaEnums.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -13,31 +30,19 @@
*/
public class VerificaFirmaEnums {
- public enum EsitoControllo {
+ public enum SacerIndication {
- POSITIVO("Controllo OK"), NEGATIVO("Controllo fallito"), WARNING("Controllo con Warning"), /**/
- NON_ESEGUITO("Non eseguito perchè il formato non è conforme"), FORMATO_NON_CONOSCIUTO, /**/
- FORMATO_NON_CONFORME, NON_AMMESSO_DELIB_45_CNIPA, DISABILITATO("Il controllo è disabilitato"), /**/
- NON_NECESSARIO("Il controllo non è necessario",
- "Il controllo non è necessario in quanto avviene tramite OCSP"), /**/
- ERRORE("Controllo non svolto per errore del sistema"), /**/
- CERTIFICATO_ERRATO("Il certificato non è un certificato di firma",
- "Errore sul controllo delle revoche del certificato, informazioni non scaricabili o non affidabili"), /**/
- CERTIFICATO_NON_VALIDO("Il certificato non è ancora valido",
- "Il certificato non presenta alcuni degli attributi previsti dallo standard ('signing-certificate', 'cert-diget', ecc.)"), /**/
- CERTIFICATO_REVOCATO("Il certificato è stato revocato o sospeso"), /**/
- CERTIFICATO_SCADUTO("Il certificato è scaduto"), /**/
+ POSITIVO("Controllo OK"), NEGATIVO("Controllo fallito"), WARNING("Controllo con Warning"),
+ NON_ESEGUITO("Non eseguito perchè il formato non è conforme"), FORMATO_NON_CONOSCIUTO("Formato non conosciuto"),
+ FORMATO_NON_CONFORME("Formato non conforme"), NON_AMMESSO_DELIB_45_CNIPA("Non ammetto delib45 cnipa"),
+ DISABILITATO("Il controllo è disabilitato"), NON_NECESSARIO("Il controllo non è necessario"),
+ ERRORE("Controllo non svolto per errore del sistema"), CERTIFICATO_ERRATO("Errore su certificato"),
+ CERTIFICATO_NON_VALIDO("Errore validità del certificato"),
+ CERTIFICATO_REVOCATO("Il certificato è stato revocato o sospeso"),
+ CERTIFICATO_SCADUTO("Il certificato è scaduto"),
CERTIFICATO_SCADUTO_3_12_2009(
"Il controllo non è svolto perché la CRL non è disponibile ed il certificato è scaduto prima del 3/12/2009"), /**/
- CRL_NON_SCARICABILE("Il controllo non è svolto perché la CRL non è scaricabile dal server",
- "CRL non scaricabile dal server perché il controllo sulla revoca avviene tramite OCSP"), /*
- * esiste anche
- * un messaggio
- * alternativo
- * derivante
- * dal caso
- * OCSP
- */
+ CRL_NON_SCARICABILE("Il controllo non è svolto perché la CRL non è scaricabile dal server"),
CRL_NON_VALIDA("Il controllo non è svolto perché la CRL non è valida"), /**/
CRL_SCADUTA("Il controllo non è svolto perché la CRL scaricata è scaduta"), SCONOSCIUTO, /**/
OCSP_NON_SCARICABILE("Il controllo non è svolto perché la risposta OCSP non è scaricabile dal server"), /**/
@@ -49,25 +54,19 @@ FORMATO_NON_CONFORME, NON_AMMESSO_DELIB_45_CNIPA, DISABILITATO("Il controllo è
"Errore sul controllo delle revoche del certificato, informazioni non scaricabili o non affidabili");
private final String message;
- private final String[] alternative;
- private EsitoControllo() {
+ private SacerIndication() {
this.message = null;
- this.alternative = null;
}
- private EsitoControllo(final String message, final String... alternative) {
+ private SacerIndication(final String message) {
this.message = message;
- this.alternative = alternative;
}
public String message() {
return this.message;
}
- public String[] alternative() {
- return this.alternative != null && alternative.length > 0 ? alternative : new String[] { this.message };
- }
}
public enum TipoRifTemporale {
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaWrapperVersamentoUtil.java b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaWrapperVersamentoUtil.java
index 398909a..c7238a4 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaWrapperVersamentoUtil.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/firma/util/VerificaFirmaWrapperVersamentoUtil.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -11,7 +28,7 @@
import org.slf4j.LoggerFactory;
import it.eng.parer.firma.dto.StatoComponente;
-import it.eng.parer.firma.util.VerificaFirmaEnums.EsitoControllo;
+import it.eng.parer.firma.util.VerificaFirmaEnums.SacerIndication;
import it.eng.parer.firma.xml.VFContrFirmaCompType;
import it.eng.parer.firma.xml.VFContrMarcaCompType;
import it.eng.parer.firma.xml.VFFirmaCompType;
@@ -121,7 +138,7 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
tmpMarcaResp.getEsitoMarca().setDettaglioControlloConformita(marcaCompType.getDsMsgEsitoContrConforme());
scriviDettagliContrMarca = true;
}
- if (esitoContrConf.equals(EsitoControllo.POSITIVO.name())) {
+ if (esitoContrConf.equals(SacerIndication.POSITIVO.name())) {
tmpMarcaResp.getEsitoMarca().setControlloConformita(ECEsitoControlloType.POSITIVO);
// Se l'esito è positivo imposto il tag di VerificaMarca
@@ -141,7 +158,7 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
tmpMarcaResp.getEsitoMarca().getVerificaMarca()
.setDettaglioControlloCrittografico(messaggioEsitoCMarca);
}
- if (!tmpTiEsitoControlloMarca.equals(EsitoControllo.POSITIVO.name())) {
+ if (!tmpTiEsitoControlloMarca.equals(SacerIndication.POSITIVO.name())) {
statoComponente.ctrlMarcheCrittNegativo = true;
// memorizzo l'anomalia relativa alla marca del componente. alla fine del ciclo
// firme-marche aggiungerò un warning
@@ -153,7 +170,7 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
tmpMarcaResp.getEsitoMarca().getVerificaMarca()
.setDettaglioControlloCatenaTrusted(messaggioEsitoCMarca);
}
- if (!tmpTiEsitoControlloMarca.equals(EsitoControllo.POSITIVO.name())) {
+ if (!tmpTiEsitoControlloMarca.equals(SacerIndication.POSITIVO.name())) {
statoComponente.ctrlMarcheCatenaNegativo = true;
// memorizzo l'anomalia relativa alla marca del componente. alla fine del ciclo
// firme-marche aggiungerò un warning
@@ -165,7 +182,7 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
tmpMarcaResp.getEsitoMarca().getVerificaMarca()
.setDettaglioControlloCertificato(messaggioEsitoCMarca);
}
- if (!tmpTiEsitoControlloMarca.equals(EsitoControllo.POSITIVO.name())) {
+ if (!tmpTiEsitoControlloMarca.equals(SacerIndication.POSITIVO.name())) {
statoComponente.ctrlMarcheCertificatoNegativo = true;
// memorizzo l'anomalia relativa alla marca del componente. alla fine del ciclo
// firme-marche aggiungerò un warning
@@ -176,8 +193,8 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
if (scriviDettagliContrMarca) {
tmpMarcaResp.getEsitoMarca().getVerificaMarca().setDettaglioControlloCRL(messaggioEsitoCMarca);
}
- if (!tmpTiEsitoControlloMarca.equals(EsitoControllo.POSITIVO.name())
- && !tmpTiEsitoControlloMarca.equals(EsitoControllo.NON_NECESSARIO.name())) {
+ if (!tmpTiEsitoControlloMarca.equals(SacerIndication.POSITIVO.name())
+ && !tmpTiEsitoControlloMarca.equals(SacerIndication.NON_NECESSARIO.name())) {
statoComponente.ctrlMarcheCrlNegativo = true;
// memorizzo l'anomalia relativa alla marca del componente. alla fine del ciclo
// firme-marche aggiungerò un warning
@@ -190,8 +207,8 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
if (scriviDettagliContrMarca) {
tmpMarcaResp.getEsitoMarca().getVerificaMarca().setDettaglioControlloOCSP(messaggioEsitoCMarca);
}
- if (!tmpTiEsitoControlloMarca.equals(EsitoControllo.OCSP_VALIDO.name())
- && !tmpTiEsitoControlloMarca.equals(EsitoControllo.NON_NECESSARIO.name())) {
+ if (!tmpTiEsitoControlloMarca.equals(SacerIndication.OCSP_VALIDO.name())
+ && !tmpTiEsitoControlloMarca.equals(SacerIndication.NON_NECESSARIO.name())) {
statoComponente.ctrlMarcheOcspNegativo = true;
// memorizzo l'anomalia relativa alla marca del componente. alla fine del ciclo
// firme-marche aggiungerò un warning
@@ -200,7 +217,7 @@ private static void buildECMarcaType(AbsVersamentoExt versamento, ComponenteVers
}
// Quindi valorizzo VerificaMarca.CodiceEsito
- if (marcaCompType.getTiEsitoVerifMarca().equals(EsitoControllo.POSITIVO.name())) {
+ if (marcaCompType.getTiEsitoVerifMarca().equals(SacerIndication.POSITIVO.name())) {
tmpMarcaResp.getEsitoMarca().getVerificaMarca().setCodiceEsito(ECEsitoPosNegWarType.POSITIVO);
} else {
tmpMarcaResp.getEsitoMarca().getVerificaMarca().setCodiceEsito(ECEsitoPosNegWarType.WARNING);
@@ -254,20 +271,20 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
// ControlloConformità
String esitoContrConf = firmaCompType.getTiEsitoContrConforme();
- if (esitoContrConf.equals(EsitoControllo.FORMATO_NON_CONOSCIUTO.name())) {
+ if (esitoContrConf.equals(SacerIndication.FORMATO_NON_CONOSCIUTO.name())) {
tmpFirmatarioResp.getEsitoFirma().setControlloConformita(ECEsitoControlloType.FORMATO_NON_CONOSCIUTO);
firmaVerificabile = false; // nota bene: SOLO in questo caso, viene considerato come NON FIRMATO
statoComponente.ctrlConfFirmeHasFormatoNonConosciuto = true;
// memorizzo l'anomalia relativa alla firma del componente.
// alla fine del ciclo firme-marche aggiungerò un warning o un errore in
// funzione di forzature varie
- } else if (esitoContrConf.equals(EsitoControllo.FORMATO_NON_CONFORME.name())) {
+ } else if (esitoContrConf.equals(SacerIndication.FORMATO_NON_CONFORME.name())) {
tmpFirmatarioResp.getEsitoFirma().setControlloConformita(ECEsitoControlloType.FORMATO_NON_CONFORME);
statoComponente.ctrlConfFirmeHasFormatoNonConforme = true;
// memorizzo l'anomalia relativa alla firma del componente.
// alla fine del ciclo firme-marche aggiungerò un warning o un errore in
// funzione di forzature varie
- } else if (esitoContrConf.equals(EsitoControllo.NON_AMMESSO_DELIB_45_CNIPA.name())) {
+ } else if (esitoContrConf.equals(SacerIndication.NON_AMMESSO_DELIB_45_CNIPA.name())) {
tmpFirmatarioResp.getEsitoFirma().setControlloConformita(ECEsitoControlloType.NON_AMMESSO_DELIB_45_CNIPA);
statoComponente.ctrlConfFirmeHasNonAmmessoDelib45 = true;
// memorizzo l'anomalia relativa alla firma del componente.
@@ -303,7 +320,7 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
esitoControlloFirma = contrFirmaCompType.getTiEsitoContrFirma();
messaggioEsitoCFirma = contrFirmaCompType.getDsMsgEsitoContrFirma();
- final boolean esitoControlloPositivo = esitoControlloFirma.equals(EsitoControllo.POSITIVO.name());
+ final boolean esitoControlloPositivo = esitoControlloFirma.equals(SacerIndication.POSITIVO.name());
if (contrFirmaCompType.getTiContr().name().equals(VFTipoControlloType.CRITTOGRAFICO.name())) {
// imposto il valore e l'eventuale messaggio di dettaglio nell'esito
@@ -316,16 +333,16 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
// valuto gli esiti negativi o warning
if (!esitoControlloPositivo) {
// verifico lo stato:
- if (esitoControlloFirma.equals(EsitoControllo.NON_ESEGUITO.name())) {
+ if (esitoControlloFirma.equals(SacerIndication.NON_ESEGUITO.name())) {
// se non eseguito la firma è in warn e aggiungo il warn alla lista
statoComponente.ctrlFirmeCrittWarning = true;
firmaWarn = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.ERRORE.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.ERRORE.name())) {
// se è andato in errore, la firma è in err, il componente è in err e aggiungo
// l'errore alla lista
statoComponente.ctrlFirmeCrittErrore = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.NEGATIVO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.NEGATIVO.name())) {
statoComponente.ctrlFirmeCrittNegativo = true;
firmaErr = true;
} else {
@@ -343,16 +360,16 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
// valuto gli esiti negativi o warning
if (!esitoControlloPositivo) {
// verifico lo stato:
- if (esitoControlloFirma.equals(EsitoControllo.NON_ESEGUITO.name())) {
+ if (esitoControlloFirma.equals(SacerIndication.NON_ESEGUITO.name())) {
// se non eseguito la firma è in warn e aggiungo il warn alla lista
statoComponente.ctrlFirmeCatenaWarning = true;
firmaWarn = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.ERRORE.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.ERRORE.name())) {
// se è andato in errore, la firma è in err, il componente è in err e aggiungo
// l'errore alla lista
statoComponente.ctrlFirmeCatenaErrore = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.NEGATIVO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.NEGATIVO.name())) {
statoComponente.ctrlFirmeCatenaNegativo = true;
firmaErr = true;
} else {
@@ -370,23 +387,24 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
// valuto gli esiti negativi o warning
if (!esitoControlloPositivo) {
// verifico lo stato:
- if (esitoControlloFirma.equals(EsitoControllo.NON_ESEGUITO.name())) {
+ if (esitoControlloFirma.equals(SacerIndication.NON_ESEGUITO.name())) {
// se non eseguito la firma è in warn e aggiungo il warn alla lista
statoComponente.ctrlFirmeCertificatoWarning = true;
firmaWarn = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.ERRORE.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.ERRORE.name())) {
// se è andato in errore, la firma è in err, il componente è in err e aggiungo
// l'errore alla lista
statoComponente.ctrlFirmeCertificatoErrore = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CERTIFICATO_SCADUTO.name())
- || esitoControlloFirma.equals(EsitoControllo.REVOCHE_NON_CONSISTENTI.name())) {
- statoComponente.ctrlFirmeCertificatoScad = true;
+ } else if (esitoControlloFirma.equals(SacerIndication.CERTIFICATO_SCADUTO.name())
+ || esitoControlloFirma.equals(SacerIndication.REVOCHE_NON_CONSISTENTI.name())
+ || esitoControlloFirma.equals(SacerIndication.CERTIFICATO_REVOCATO.name())) {
+ statoComponente.ctrlFirmeCertificatoScadRev = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CERTIFICATO_NON_VALIDO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.CERTIFICATO_NON_VALIDO.name())) {
statoComponente.ctrlFirmeCertificatoNoValid = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CERTIFICATO_ERRATO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.CERTIFICATO_ERRATO.name())) {
statoComponente.ctrlFirmeCertificatoErrato = true;
firmaErr = true;
} else {
@@ -404,23 +422,23 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
// valuto gli esiti negativi o warning
if (!esitoControlloPositivo) {
// verifico lo stato:
- if (esitoControlloFirma.equals(EsitoControllo.NON_ESEGUITO.name())
- || esitoControlloFirma.equals(EsitoControllo.CERTIFICATO_SCADUTO_3_12_2009.name())) {
+ if (esitoControlloFirma.equals(SacerIndication.NON_ESEGUITO.name())
+ || esitoControlloFirma.equals(SacerIndication.CERTIFICATO_SCADUTO_3_12_2009.name())) {
statoComponente.ctrlFirmeCRLWarning = true;
firmaWarn = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.ERRORE.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.ERRORE.name())) {
statoComponente.ctrlFirmeCRLErrore = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CERTIFICATO_REVOCATO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.CERTIFICATO_REVOCATO.name())) {
statoComponente.ctrlFirmeCRLCertRev = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CRL_SCADUTA.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.CRL_SCADUTA.name())) {
statoComponente.ctrlFirmeCRLScad = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CRL_NON_VALIDA.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.CRL_NON_VALIDA.name())) {
statoComponente.ctrlFirmeCRLNoValid = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.CRL_NON_SCARICABILE.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.CRL_NON_SCARICABILE.name())) {
statoComponente.ctrlFirmeCRLNoScaric = true;
firmaErr = true;
} else {
@@ -440,17 +458,17 @@ private static void buildECFirmatarioType(AbsVersamentoExt versamento, Component
// valuto gli esiti negativi o warning
if (!esitoControlloPositivo) {
// verifico lo stato:
- if (esitoControlloFirma.equals(EsitoControllo.NON_ESEGUITO.name())
- || esitoControlloFirma.equals(EsitoControllo.OCSP_NON_AGGIORNATO.name())) {
+ if (esitoControlloFirma.equals(SacerIndication.NON_ESEGUITO.name())
+ || esitoControlloFirma.equals(SacerIndication.OCSP_NON_AGGIORNATO.name())) {
statoComponente.ctrlFirmeOCSPWarning = true;
firmaWarn = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.OCSP_SCONOSCIUTO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.OCSP_SCONOSCIUTO.name())) {
statoComponente.ctrlFirmeOCSPNoValid = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.OCSP_REVOCATO.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.OCSP_REVOCATO.name())) {
statoComponente.ctrlFirmeOCSPRev = true;
firmaErr = true;
- } else if (esitoControlloFirma.equals(EsitoControllo.OCSP_NON_SCARICABILE.name())) {
+ } else if (esitoControlloFirma.equals(SacerIndication.OCSP_NON_SCARICABILE.name())) {
statoComponente.ctrlFirmeOCSPNoScaric = true;
firmaErr = true;
} else {
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/util/Constants.java b/sacerws-ejb/src/main/java/it/eng/parer/util/Constants.java
index 2dc3d7d..8de1732 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/util/Constants.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/util/Constants.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -10,31 +27,10 @@
*/
public class Constants {
- public final static int PASSWORD_EXPIRATION_DAYS = 90;
- public final static String SACER = "SACER";
- public final static String SACERWS = "SACERWS";
- // Constants for Transformer
- public final static String ENTITY_PACKAGE_NAME = "it.eng.parer.entity";
- public final static String GRANTED_ENTITY_PACKAGE_NAME = "it.eng.parer.grantedEntity";
- public final static String VIEWENTITY_PACKAGE_NAME = "it.eng.parer.viewEntity";
- public final static String GRANTED_VIEWENTITY_PACKAGE_NAME = "it.eng.parer.grantedViewEntity";
- public final static String ROWBEAN_PACKAGE_NAME = "it.eng.parer.slite.gen.tablebean";
- public final static String VIEWROWBEAN_PACKAGE_NAME = "it.eng.parer.slite.gen.viewbean";
- // Costanti per lista "Totale Definito Da" nella gestione dei dati specifici
- public final static String TI_UNI_DOC = "Tipo unità doc.";
- public final static String TI_DOC = "Tipo doc.";
- public final static String TI_SIS_MIGR_UD = "Migraz. unità doc.";
- public final static String TI_SIS_MIGR_DOC = "Migraz. doc.";
- // Costanti per dati specifici
- public final static String TI_USO_XSD_VERS = "VERS";
- public final static String TI_USO_XSD_MIGR = "MIGRAZ";
-
- // Formato data/ora
- public static final String DATE_FORMAT_TIMESTAMP_TYPE = "dd/MM/yyyy HH:mm:ss";
- public static final String DATE_FORMAT_DATE_TYPE = "dd/MM/yyyy";
- public static final String DATE_FORMAT_HOUR_MINUTE_TYPE = "dd/MM/yyyy HH:mm";
- public static final String DATE_FORMAT_DAY_MONTH_TYPE = "dd/MM";
- public static final String DATE_FORMAT_DATE_COMPACT_TYPE = "dd/MM/yy";
+ public static final String SACERWS = "SACERWS";
+ public static final String JAVAX_PERSISTENCE_LOCK_TIMEOUT = "javax.persistence.lock.timeout";
+ public static final String FLAG_TRUE = "1";
+ public static final String FLAG_FALSE = "0";
// Enum per tipo sessione
public enum TipoSessione {
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/util/DateUtilsConverter.java b/sacerws-ejb/src/main/java/it/eng/parer/util/DateUtilsConverter.java
index d155d0c..ae27ee0 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/util/DateUtilsConverter.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/util/DateUtilsConverter.java
@@ -1,5 +1,23 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.util;
+import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
@@ -33,6 +51,22 @@ public static Date convert(ZonedDateTime zdt) {
return null;
}
+ /**
+ * Conversione della data espressa con il fuso orario in data locale.
+ *
+ * @param zdt
+ * data in input
+ *
+ * @return oggetto java.time.LocalDate oppure null
+ */
+ public static LocalDate convertLocal(ZonedDateTime zdt) {
+ LocalDate localDate = null;
+ if (zdt != null) {
+ return zdt.toLocalDate();
+ }
+ return localDate;
+ }
+
/**
* Conversione della data locale ad una data con fuso orario.
*
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/util/FlagUtilsConverter.java b/sacerws-ejb/src/main/java/it/eng/parer/util/FlagUtilsConverter.java
new file mode 100644
index 0000000..94798fe
--- /dev/null
+++ b/sacerws-ejb/src/main/java/it/eng/parer/util/FlagUtilsConverter.java
@@ -0,0 +1,33 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
+package it.eng.parer.util;
+
+import static it.eng.parer.util.Constants.FLAG_FALSE;
+import static it.eng.parer.util.Constants.FLAG_TRUE;
+
+public class FlagUtilsConverter {
+
+ private FlagUtilsConverter() {
+ throw new IllegalStateException("Classe di utility");
+ }
+
+ public static String booleanToFlag(Boolean b) {
+ return Boolean.TRUE.equals(b) ? FLAG_TRUE : FLAG_FALSE;
+ }
+
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/AppServerInstance.java b/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/AppServerInstance.java
index 7a60c9a..ff04cc8 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/AppServerInstance.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/AppServerInstance.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.util.ejb;
import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
@@ -39,6 +56,7 @@ public class AppServerInstance {
private static final Logger LOG = LoggerFactory.getLogger(AppServerInstance.class);
String servername = null;
+ @SuppressWarnings("unchecked")
@PostConstruct
protected void initSingleton() {
try {
@@ -102,8 +120,8 @@ private InetAddress getMyHostAddress() throws UnknownHostException {
for (Enumeration> ifaces = NetworkInterface.getNetworkInterfaces(); ifaces.hasMoreElements();) {
NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
// Scorri su tutti gli indirizzi IP associati ad una scheda di rete
- for (Enumeration inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
- InetAddress inetAddr = (InetAddress) inetAddrs.nextElement();
+ for (Enumeration inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
+ InetAddress inetAddr = inetAddrs.nextElement();
LOG.debug("Verifico l'indirizzo {}", inetAddr.getHostAddress());
AddressTypes tipo = decodeAddrType(inetAddr);
// se è già presente un indirizzo di questo tipo (per esempio se
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/ConfigurationHelper.java b/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/ConfigurationHelper.java
index 087edd4..6b25a7c 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/ConfigurationHelper.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/ConfigurationHelper.java
@@ -1,10 +1,33 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.util.ejb.help;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
+import it.eng.parer.entity.AplParamApplic;
+import it.eng.parer.entity.constraint.AplValoreParamApplic.TiAppart;
+import it.eng.parer.exception.ParamApplicNotFoundException;
+import it.eng.parer.util.ejb.help.dto.AplVGetValParamDto;
+import it.eng.parer.ws.utils.FlagConverter;
+import it.eng.parer.ws.utils.ParametroApplDB;
+import it.eng.parer.ws.utils.ParametroApplDB.TipoAplVGetValAppart;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringSubstitutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
@@ -13,20 +36,13 @@
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.text.StrSubstitutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import it.eng.parer.entity.AplParamApplic;
-import it.eng.parer.entity.constraint.AplValoreParamApplic.TiAppart;
-import it.eng.parer.exception.ParamApplicNotFoundException;
-import it.eng.parer.util.ejb.help.dto.AplVGetValParamDto;
-import it.eng.parer.ws.utils.FlagConverter;
-import it.eng.parer.ws.utils.ParametroApplDB;
-import it.eng.parer.ws.utils.ParametroApplDB.TipoAplVGetValAppart;
-
+@SuppressWarnings("unchecked")
@Stateless
@LocalBean
public class ConfigurationHelper {
@@ -46,33 +62,87 @@ public Map getConfiguration() {
String queryStr = "SELECT config FROM AplParamApplic config";
// CREO LA QUERY ATTRAVERSO L'ENTITY MANAGER
Query query = entityManager.createQuery(queryStr);
-
List configurazioni = query.getResultList();
- Map config = new HashMap();
+ Map config = new HashMap<>();
for (AplParamApplic configurazione : configurazioni) {
- config.put(configurazione.getNmParamApplic(), me.getParamApplicValue(configurazione.getNmParamApplic()));
+ config.put(configurazione.getNmParamApplic(),
+ me.getValoreParamApplicByApplic(configurazione.getNmParamApplic()));
}
return config;
}
- public String getParamApplicValue(String nmParamApplic) {
+ /**
+ * Ottieni il valore del parametro indicato dal codice in input. Il valore viene ottenuto filtrando per tipologia
+ * APPLIC {@link TipoAplVGetValAppart#APPLIC}
+ *
+ * @param nmParamApplic
+ * codice del parametro
+ *
+ * @return valore del parametro filtrato per tipologia APPLIC .
+ */
+ public String getValoreParamApplicByApplic(String nmParamApplic) {
return getParamApplicValue(nmParamApplic, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE,
Integer.MIN_VALUE, TipoAplVGetValAppart.APPLIC);
}
- public String getParamApplicValue(String nmParamApplic, long idStrut, long idAmbiente) {
+ /**
+ * Ottieni il valore del parametro indicato dal codice in input. Il valore viene ottenuto filtrando per tipologia
+ * STRUT {@link TipoAplVGetValAppart#STRUT}
+ *
+ * @param nmParamApplic
+ * codice del parametro
+ * @param idAmbiente
+ * id ambiente
+ * @param idStrut
+ * id struttura
+ *
+ *
+ * @return valore del parametro filtrato per tipologia STRUT .
+ */
+ public String getValoreParamApplicByStrut(String nmParamApplic, long idStrut, long idAmbiente) {
return getParamApplicValue(nmParamApplic, idStrut, idAmbiente, Integer.MIN_VALUE, Integer.MIN_VALUE,
TipoAplVGetValAppart.STRUT);
}
- public String getParamApplicValue(String nmParamApplic, long idStrut, long idAmbiente, long idTipoUnitaDoc) {
+ /**
+ * Ottieni il valore del parametro indicato dal codice in input. Il valore viene ottenuto filtrando per tipologia
+ * TIPOUNITADOC {@link TipoAplVGetValAppart#TIPOUNITADOC}
+ *
+ * @param nmParamApplic
+ * codice del parametro
+ * @param idAmbiente
+ * id ambiente
+ * @param idStrut
+ * id struttura
+ * @param idTipoUnitaDoc
+ * id tipologia unità documentaria
+ *
+ * @return valore del parametro filtrato per tipologia TIPOUNITADOC .
+ */
+ public String getValoreParamApplicByTipoUd(String nmParamApplic, long idStrut, long idAmbiente,
+ long idTipoUnitaDoc) {
return getParamApplicValue(nmParamApplic, idStrut, idAmbiente, idTipoUnitaDoc, Integer.MIN_VALUE,
TipoAplVGetValAppart.TIPOUNITADOC);
}
- public String getParamApplicValue(String nmParamApplic, long idStrut, long idAmbiente, long idTipoUnitaDoc,
+ /**
+ * Ottieni il valore del parametro indicato dal codice in input. Il valore viene ottenuto filtrando per tipologia
+ * AATIPOFASCICOLO {@link TipoAplVGetValAppart#AATIPOFASCICOLO}
+ *
+ * @param nmParamApplic
+ * codice del parametro
+ * @param idAmbiente
+ * id ambiente
+ * @param idStrut
+ * id struttura
+ * @param idAaTipoFascicolo
+ * id tipologia anno fascicolo
+ *
+ * @return valore del parametro filtrato per tipologia AATIPOFASCICOLO .
+ */
+ public String getValoreParamApplicByAaTipoFasc(String nmParamApplic, long idStrut, long idAmbiente,
long idAaTipoFascicolo) {
- return getParamApplicValue(nmParamApplic, idStrut, idAmbiente, idTipoUnitaDoc, idAaTipoFascicolo,
+ return getParamApplicValue(nmParamApplic, idStrut, idAmbiente, Integer.MIN_VALUE, idAaTipoFascicolo,
TipoAplVGetValAppart.AATIPOFASCICOLO);
}
@@ -82,7 +152,7 @@ public String getParamApplicValue(String nmParamApplic, long idStrut, long idAmb
private static final String IDAPLVGETVALPARAMBY = "idAplVGetvalParamBy";
/**
- *
+ *
* @param nmParamApplic
* nome parametro
* @param idStrut
@@ -98,7 +168,6 @@ public String getParamApplicValue(String nmParamApplic, long idStrut, long idAmb
*
* @return Valore del parametro indicato secondo nome
*/
- @SuppressWarnings("unchecked")
private String getParamApplicValue(String nmParamApplic, long idStrut, long idAmbiente, long idTipoUnitaDoc,
long idAaTipoFascicolo, TipoAplVGetValAppart tipoAplVGetValAppart) {
@@ -131,7 +200,7 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
queryData.put(FLAPLPARAMAPPLICAPPART, "flAppartAaTipoFascicolo");
queryData.put(IDAPLVGETVALPARAMBY, "AND getvalParam.idAaTipoFascicolo = :id");
// replace
- queryStr = StrSubstitutor.replace(queryStrTempl, queryData);
+ queryStr = StringSubstitutor.replace(queryStrTempl, queryData);
break;
case TIPOUNITADOC:
//
@@ -144,7 +213,7 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
queryData.put(FLAPLPARAMAPPLICAPPART, "flAppartTipoUnitaDoc");
queryData.put(IDAPLVGETVALPARAMBY, "AND getvalParam.idTipoUnitaDoc = :id");
// replace
- queryStr = StrSubstitutor.replace(queryStrTempl, queryData);
+ queryStr = StringSubstitutor.replace(queryStrTempl, queryData);
break;
case STRUT:
//
@@ -157,7 +226,7 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
queryData.put(FLAPLPARAMAPPLICAPPART, "flAppartStrut");
queryData.put(IDAPLVGETVALPARAMBY, "AND getvalParam.idStrut = :id");
// replace
- queryStr = StrSubstitutor.replace(queryStrTempl, queryData);
+ queryStr = StringSubstitutor.replace(queryStrTempl, queryData);
break;
case AMBIENTE:
//
@@ -170,7 +239,7 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
queryData.put(FLAPLPARAMAPPLICAPPART, "flAppartAmbiente");
queryData.put(IDAPLVGETVALPARAMBY, "AND getvalParam.idAmbiente = :id");
// replace
- queryStr = StrSubstitutor.replace(queryStrTempl, queryData);
+ queryStr = StringSubstitutor.replace(queryStrTempl, queryData);
break;
default:
//
@@ -181,7 +250,7 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
queryData.put(FLAPLPARAMAPPLICAPPART, "flAppartApplic");
queryData.put(IDAPLVGETVALPARAMBY, "");
// replace
- queryStr = StrSubstitutor.replace(queryStrTempl, queryData);
+ queryStr = StringSubstitutor.replace(queryStrTempl, queryData);
break;
}
@@ -191,7 +260,7 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
query.setParameter("flAppart", "1");// fixed
// solo nel caso in cui contenga la condition sull'ID
if (StringUtils.isNotBlank(queryData.get(IDAPLVGETVALPARAMBY))) {
- query.setParameter("id", id);
+ query.setParameter("id", new BigDecimal(id));
}
// get result
result = query.getResultList();
@@ -230,7 +299,6 @@ private String getParamApplicValue(String nmParamApplic, long idStrut, long idAm
}
}
- @SuppressWarnings("unchecked")
private String getDsValoreParamApplicByTiAppart(String nmParamApplic, List result,
final TiAppart tiAppart) {
// get entity from list
@@ -269,10 +337,6 @@ private String getDsValoreParamApplicByTiAppart(String nmParamApplic, List getValoreParamApplicByTiParamApplicAsMap(String tiParamApplic) {
- return getValoreParamApplicByTiParamApplicAsMap(Arrays.asList(tiParamApplic));
- }
-
public Map getValoreParamApplicByTiParamApplicAsMap(List tiParamApplics) {
Map config = new HashMap<>();
@@ -284,7 +348,7 @@ public Map getValoreParamApplicByTiParamApplicAsMap(List
List result = query.getResultList();
for (AplParamApplic cfg : result) {
- config.put(cfg.getNmParamApplic(), me.getParamApplicValue(cfg.getNmParamApplic()));
+ config.put(cfg.getNmParamApplic(), me.getValoreParamApplicByApplic(cfg.getNmParamApplic()));
}
return config;
@@ -292,15 +356,15 @@ public Map getValoreParamApplicByTiParamApplicAsMap(List
/**
*
- * Gestione FLAG true -gt; 1, false -> 0
+ * Gestione FLAG true = 1, false = 0
*
* @param nmParamApplic
* nome parametro applicativo
*
* @return Valore del flag indicato secondo nome
*/
- public String getParamApplicValueAsFl(String nmParamApplic) {
- return FlagConverter.fromBoolToFl(me.getParamApplicValue(nmParamApplic));
+ public String getValoreParamApplicByApplicAsFl(String nmParamApplic) {
+ return FlagConverter.fromBoolToFl(me.getValoreParamApplicByApplic(nmParamApplic));
}
/**
@@ -318,8 +382,10 @@ public String getParamApplicValueAsFl(String nmParamApplic) {
*
* @return Valore del flag indicato secondo nome
*/
- public String getParamApplicValueAsFl(String nmParamApplic, long idStrut, long idAmbiente, long idTipoUnitaDoc) {
- return FlagConverter.fromBoolToFl(me.getParamApplicValue(nmParamApplic, idStrut, idAmbiente, idTipoUnitaDoc));
+ public String getValoreParamApplicByTipoUdAsFl(String nmParamApplic, long idStrut, long idAmbiente,
+ long idTipoUnitaDoc) {
+ return FlagConverter
+ .fromBoolToFl(me.getValoreParamApplicByTipoUd(nmParamApplic, idStrut, idAmbiente, idTipoUnitaDoc));
}
/**
@@ -332,16 +398,14 @@ public String getParamApplicValueAsFl(String nmParamApplic, long idStrut, long i
* id struttura
* @param idAmbiente
* id ambiente
- * @param idTipoUnitaDoc
- * id tipo unita doc
* @param idAaTipoFascicolo
* id anno tipo fascicolo
*
* @return Valore del flag indicato secondo nome
*/
- public String getParamApplicValueAsFl(String nmParamApplic, long idStrut, long idAmbiente, long idTipoUnitaDoc,
+ public String getValoreParamApplicByAaTipoFascAsFl(String nmParamApplic, long idStrut, long idAmbiente,
long idAaTipoFascicolo) {
return FlagConverter.fromBoolToFl(
- me.getParamApplicValue(nmParamApplic, idStrut, idAmbiente, idTipoUnitaDoc, idAaTipoFascicolo));
+ me.getValoreParamApplicByAaTipoFasc(nmParamApplic, idStrut, idAmbiente, idAaTipoFascicolo));
}
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/dto/AplVGetValParamDto.java b/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/dto/AplVGetValParamDto.java
index bcd023f..5170ec4 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/dto/AplVGetValParamDto.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/util/ejb/help/dto/AplVGetValParamDto.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.util.ejb.help.dto;
import java.io.Serializable;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiave.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiave.java
index 54ad97f..69c7fc9 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiave.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiave.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -86,4 +103,4 @@ public boolean equals(Object obj) {
return false;
return true;
}
-}
\ No newline at end of file
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveFasc.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveFasc.java
index b255c14..0a6d26c 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveFasc.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveFasc.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -10,6 +27,7 @@
*/
public class CSChiaveFasc implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
private String numero;
private Integer anno;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveSottFasc.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveSottFasc.java
index 9c9a040..e0e019c 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveSottFasc.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSChiaveSottFasc.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSVersatore.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSVersatore.java
index 1d46b11..9ddc925 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSVersatore.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/CSVersatore.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -10,6 +27,7 @@
*/
public class CSVersatore implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
private String sistemaConservazione;
private String ambiente;
private String ente;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IErroriMultipli.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IErroriMultipli.java
index 42a22a0..e4367c7 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IErroriMultipli.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IErroriMultipli.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,9 +22,10 @@
*/
package it.eng.parer.ws.dto;
-import it.eng.parer.ws.versamento.dto.VoceDiErrore;
import java.util.List;
+import it.eng.parer.ws.versamento.dto.VoceDiErrore;
+
/**
*
* @author fioravanti_f
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRestWSBase.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRestWSBase.java
index 01b2ad3..56db42b 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRestWSBase.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRestWSBase.java
@@ -1,11 +1,29 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.ws.dto;
+import java.util.Set;
+
import it.eng.parer.ws.utils.Costanti;
-import java.util.EnumSet;
/**
*
@@ -35,6 +53,6 @@ public interface IRestWSBase {
public String getVersioneCalc();
- public EnumSet getModificatoriWSCalc();
+ public Set getModificatoriWSCalc();
//
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRispostaWS.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRispostaWS.java
index 14ed389..a8cde06 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRispostaWS.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IRispostaWS.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IWSDesc.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IWSDesc.java
index 7f9756d..7aa3bdc 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IWSDesc.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/IWSDesc.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/RispostaControlli.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/RispostaControlli.java
index f1564e2..628f9d8 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/RispostaControlli.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/dto/RispostaControlli.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.ws.dto;
import java.util.Date;
@@ -10,6 +27,7 @@
*/
public class RispostaControlli implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
private long rLong = -1;
private long rLongExtended = -1;
private int rInt = -1;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliMM.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliMM.java
index 266f9aa..7663342 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliMM.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliMM.java
@@ -1,13 +1,26 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.ws.ejb;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
@@ -17,10 +30,10 @@
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import it.eng.parer.entity.AplParamApplic;
import it.eng.parer.util.ejb.help.ConfigurationHelper;
import it.eng.parer.ws.dto.RispostaControlli;
import it.eng.parer.ws.utils.MessaggiWSBundle;
@@ -40,7 +53,7 @@ public class ControlliMM {
private EntityManager entityManager;
@EJB
- ConfigurationHelper config;
+ private ConfigurationHelper configurationHelper;
public enum TipiRootPath {
@@ -53,71 +66,34 @@ public RispostaControlli caricaRootPath(String appVersante, TipiRootPath tipoRoo
rispostaControlli.setrLong(-1);
rispostaControlli.setrBoolean(false);
- Properties props = new Properties();
- boolean useDb = false;
- boolean prosegui = true;
- String rootftp = null;
+ try {
+ String paramName = StringUtils.EMPTY;
- try (InputStream tmpStream = this.getClass().getClassLoader().getResourceAsStream("/sacerEjb.properties")) {
- props.load(tmpStream);
- if (props.getProperty("rootFtp.overrideDbUrl").equals("true")) {
- switch (tipoRootPath) {
- case In:
- rootftp = props.getProperty("rootFtp.url." + ParametroApplDB.PATH_MM_IN_ + appVersante);
- break;
- case Out:
- rootftp = props.getProperty("rootFtp.url." + ParametroApplDB.PATH_MM_OUT_ + appVersante);
- break;
- default:
- break;
- }
- rispostaControlli.setrString(rootftp);
- rispostaControlli.setrBoolean(true);
- } else {
- useDb = true;
+ switch (tipoRootPath) {
+ case In:
+ paramName = ParametroApplDB.PATH_MM_IN + appVersante;
+ break;
+ case Out:
+ paramName = ParametroApplDB.PATH_MM_OUT + appVersante;
+ break;
+ default:
+ break;
}
- } catch (IOException ex) {
- prosegui = false;
+ rispostaControlli.setrString(configurationHelper.getValoreParamApplicByApplic(paramName));
+ rispostaControlli.setrBoolean(true);
+ } catch (NoResultException e) {
+ rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
+ rispostaControlli
+ .setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666, "ControlliMM.caricaRootPath - "
+ + "Applicativo chiamante non correttamente configurato nella tabella AplParamApplic"));
+ } catch (Exception e) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "ControlliMM.caricaRootPath - properties: " + ex.getMessage()));
- log.error("Eccezione nella lettura del file di properties ", ex);
- }
-
- if (prosegui && useDb) {
- try {
- // carico i parametri applicativi
- String queryStr = "select tpa " + "from AplParamApplic tpa "
- + "where tpa.tiParamApplic = :tiParamApplicIn " + "and tpa.nmParamApplic = :nmParamAppliciN ";
-
- javax.persistence.Query query = entityManager.createQuery(queryStr, AplParamApplic.class);
- query.setParameter("tiParamApplicIn", ParametroApplDB.TipoParametroAppl.PATH);
- switch (tipoRootPath) {
- case In:
- query.setParameter("nmParamAppliciN", ParametroApplDB.PATH_MM_IN_ + appVersante);
- break;
- case Out:
- query.setParameter("nmParamAppliciN", ParametroApplDB.PATH_MM_OUT_ + appVersante);
- break;
- default:
- break;
- }
- AplParamApplic tud = (AplParamApplic) query.getSingleResult();
- rispostaControlli.setrString(config.getParamApplicValue(tud.getNmParamApplic()));
- rispostaControlli.setrBoolean(true);
- } catch (NoResultException e) {
- rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli
- .setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666, "ControlliMM.caricaRootPath - "
- + "Applicativo chiamante non correttamente configurato nella tabella AplParamApplic"));
- } catch (Exception e) {
- rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "ControlliMM.caricaRootPath - AplParamApplic: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella AplParamApplic", e);
- }
+ "ControlliMM.caricaRootPath - AplParamApplic: " + e.getMessage()));
+ log.error("Eccezione nella lettura della tabella AplParamApplic", e);
}
return rispostaControlli;
}
+
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliSemantici.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliSemantici.java
index 3c037f2..7df962b 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliSemantici.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliSemantici.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -23,10 +40,12 @@
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.paginator.util.HibernateUtils;
import it.eng.parer.entity.AroCompDoc;
import it.eng.parer.entity.AroDoc;
import it.eng.parer.entity.AroUnitaDoc;
@@ -47,7 +66,7 @@
import it.eng.parer.entity.OrgEnte;
import it.eng.parer.entity.OrgStrut;
import it.eng.parer.util.ejb.help.ConfigurationHelper;
-import it.eng.parer.viewEntity.AroVDtVersMaxByUnitaDoc;
+import it.eng.parer.view_entity.AroVDtVersMaxByUnitaDoc;
import it.eng.parer.ws.dto.CSChiave;
import it.eng.parer.ws.dto.CSVersatore;
import it.eng.parer.ws.dto.RispostaControlli;
@@ -64,13 +83,13 @@
import it.eng.parer.ws.versamento.dto.DatiRegistroFiscale;
import it.eng.parer.ws.versamento.dto.DatoSpecifico;
import it.eng.parer.ws.versamento.dto.RispostaControlliAttSpec;
-import org.apache.commons.lang3.StringUtils;
/**
*
* @author Pagani_S (iniziata)
* @author Fioravanti_F
*/
+@SuppressWarnings("unchecked")
@Stateless(mappedName = "ControlliSemantici")
@LocalBean
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
@@ -81,7 +100,7 @@ public class ControlliSemantici {
private EntityManager entityManager;
@EJB
- ConfigurationHelper config;
+ private ConfigurationHelper config;
public enum TipologieComponente {
@@ -116,8 +135,9 @@ public RispostaControlli caricaDefaultDaDB(String[] tipoPars) {
"ControlliSemantici.caricaDefaultDaDB: "
+ "Parametri applicativi non correttamente configurati per "
+ String.join(",", tipoPars)));
- log.error("ControlliSemantici.caricaDefaultDaDB: "
- + "Parametri applicativi non correttamente configurati per " + String.join(",", tipoPars));
+ log.atError().setMessage(
+ "ControlliSemantici.caricaDefaultDaDB: Parametri applicativi non correttamente configurati per {}.")
+ .addArgument(() -> String.join(",", tipoPars)).log();
}
} catch (Exception e) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
@@ -160,6 +180,7 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
if (orgAmbienteS.isEmpty()) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_001);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_001, amb));
break;
@@ -171,10 +192,6 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_001_001);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_001_001, amb));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_001);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_001, amb));
- break;
}
return rispostaControlli;
}
@@ -201,6 +218,7 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
if (orgEnteS.isEmpty()) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_002);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_002, ente));
break;
@@ -212,10 +230,6 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_001_002);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_001_002, ente));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_002);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_002, ente));
- break;
}
return rispostaControlli;
}
@@ -242,6 +256,7 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
if (orgStrutS.isEmpty()) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_003);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_003, strut));
break;
@@ -253,10 +268,6 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_001_003);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_001_003, strut));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_003);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_003, strut));
- break;
}
return rispostaControlli;
}
@@ -302,10 +313,6 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
} else if (orgStrutS.get(0).getDtIniValStrut() != null && orgStrutS.get(0).getDtFineValStrut() != null) {
// In tutta l'applicazione viene utilizzato joda time solo per questo metodo. refactor senza usare la
// libreria
- // hasDateErr = !new Interval(
- // DateUtils.truncate(orgStrutS.get(0).getDtIniValStrut(), Calendar.DATE).getTime(),
- // DateUtils.truncate(orgStrutS.get(0).getDtFineValStrut(), Calendar.DATE).getTime())
- // .contains(DateUtils.truncate(dataVersamento, Calendar.DATE).getTime());
long dtIni = DateUtils.truncate(orgStrutS.get(0).getDtIniValStrut(), Calendar.DATE).getTime();
long dtFine = DateUtils.truncate(orgStrutS.get(0).getDtFineValStrut(), Calendar.DATE).getTime();
long dtVers = DateUtils.truncate(dataVersamento, Calendar.DATE).getTime();
@@ -329,7 +336,7 @@ public RispostaControlli checkIdStrut(CSVersatore vers, Costanti.TipiWSPerContro
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkIdStrut: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -358,7 +365,7 @@ public RispostaControlli checkSistemaMigraz(String sistemaMig) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkSistemaMigraz: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -388,13 +395,13 @@ public RispostaControlli checkChiave(CSChiave key, long idStruttura, TipiGestion
javax.persistence.Query query = entityManager.createQuery(queryStr, AroUnitaDoc.class);
query.setParameter("idStrutIn", idStruttura);
query.setParameter("cdKeyUnitaDocIn", numero);
- query.setParameter("aaKeyUnitaDocIn", anno);
+ query.setParameter("aaKeyUnitaDocIn", new BigDecimal(anno));
query.setParameter("cdRegistroKeyUnitaDocIn", tipoReg);
unitaDocS = query.getResultList();
// chiave già presente (uno o più righe trovate, mi interessa solo l'ultima -
// più recente)
- if (unitaDocS.size() > 0) {
+ if (!unitaDocS.isEmpty()) {
StatoConservazioneUnitaDoc scud = StatoConservazioneUnitaDoc
.valueOf(unitaDocS.get(0).getTiStatoConservazione());
if (scud == StatoConservazioneUnitaDoc.ANNULLATA
@@ -452,7 +459,7 @@ public RispostaControlli checkChiave(CSChiave key, long idStruttura, TipiGestion
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkChiave: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -509,7 +516,7 @@ public RispostaControlli checkTipologiaUD(String tipologiaUD, String descKey, lo
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipologiaUD: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -534,7 +541,7 @@ public RispostaControlli checkTipoRegistro(String nomeTipoRegistro, String descK
// STRETTAMENTE
// MAGGIORE della
// data di
- // riferimento!!!;
+ // riferimento!!!
javax.persistence.Query query = entityManager.createQuery(queryStr, DecRegistroUnitaDoc.class);
query.setParameter("idStrutIn", idStruttura);
@@ -563,7 +570,7 @@ public RispostaControlli checkTipoRegistro(String nomeTipoRegistro, String descK
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoRegistro: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
}
@@ -590,7 +597,7 @@ public RispostaControlli checkTipoRegistroTipoUD(String nomeTipoRegistro, String
// STRETTAMENTE
// MAGGIORE della
// data di
- // riferimento!!!;
+ // riferimento!!!
javax.persistence.Query query = entityManager.createQuery(queryStr, DecRegistroUnitaDoc.class);
query.setParameter("idStrutIn", idStruttura);
@@ -636,7 +643,7 @@ public RispostaControlli checkTipoRegistroTipoUD(String nomeTipoRegistro, String
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoRegistroTipoUD: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -661,14 +668,14 @@ public RispostaControlli caricaRegistroAnno(String nomeTipoRegistro, String desc
javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("idRegistroUnitaDocIn", idRegistroUnitaDoc);
- query.setParameter("annoUDIn", anno);
- query.setParameter("annoCorrenteIn", new GregorianCalendar().get(Calendar.YEAR));
+ query.setParameter("annoUDIn", new BigDecimal(anno));
+ query.setParameter("annoCorrenteIn", new BigDecimal(new GregorianCalendar().get(Calendar.YEAR)));
- List tmpLst = (List) query.getResultList();
+ List tmpLst = query.getResultList();
if (tmpLst.size() == 1) {
DecAaRegistroUnitaDoc tmpAaRegistroUnitaDoc = tmpLst.get(0);
ConfigRegAnno tmpConfAnno = this.caricaPartiAARegistro(tmpAaRegistroUnitaDoc.getIdAaRegistroUnitaDoc());
- if (tmpConfAnno.getParti().size() > 0) {
+ if (!tmpConfAnno.getParti().isEmpty()) {
rispostaControlli.setrObject(tmpConfAnno);
rispostaControlli.setrBoolean(true);
} else {
@@ -700,7 +707,7 @@ public RispostaControlli caricaRegistroAnno(String nomeTipoRegistro, String desc
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoRegistroAnno: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -716,7 +723,7 @@ public ConfigRegAnno caricaPartiAARegistro(long idAaRegistroUnitaDoc) {
+ "order by t.niParteNumeroRegistro";
javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("idAaRegistroUnitaDoc", idAaRegistroUnitaDoc);
- List tmpLstP = (List) query.getResultList();
+ List tmpLstP = query.getResultList();
for (DecParteNumeroRegistro tmpParte : tmpLstP) {
ConfigRegAnno.ParteRegAnno tmpPRanno = tmpConfAnno.aggiungiParte();
@@ -815,7 +822,7 @@ public RispostaControlli checkTipoDocumento(String nomeTipoDoc, long idStruttura
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoDocumento: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -866,7 +873,7 @@ public RispostaControlli checkTipoStruttura(String nomeTipoStruttura, long idStr
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoStruttura: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -954,7 +961,7 @@ public RispostaControlli checkTipoComponente(String nomeTipoComponente, long idT
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoComponente: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -997,49 +1004,12 @@ public RispostaControlli checkTipoRappComponente(String nomeTipoRapprComponente,
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkTipoRappComponente: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
}
- // public RispostaControlli checkFlagFC(long idTipologiaUD) {
- // RispostaControlli rispostaControlli;
- // rispostaControlli = new RispostaControlli();
- //
- // rispostaControlli.setrInt(1);
- //
- // // lista entity JPA ritornate dalle Query
- // List tipoUnitaDocS = null;
- //
- // // lancio query di controllo
- // try {
- //
- // // ricavo le ud presenti in base ai parametri impostati
- // String queryStr = "select tud "
- // + "from DecTipoUnitaDoc tud "
- // + "where tud.idTipoUnitaDoc = :idTipoUnitaDocIn ";
- //
- // javax.persistence.Query query = entityManager.createQuery(queryStr, DecTipoUnitaDoc.class);
- // query.setParameter("idTipoUnitaDocIn", idTipologiaUD);
- // tipoUnitaDocS = query.getResultList();
- //
- // for (DecTipoUnitaDoc tud : tipoUnitaDocS) {
- // if (tud.getFlForzaCollegamento().equals("0")) {
- // rispostaControlli.setrInt(0);
- // }
- // }
- // } catch (Exception e) {
- // rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- // rispostaControlli.setDsErr(
- // MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- // "ControlliSemantici.checkFlagFC: " + e.getMessage()));
- // log.error("Eccezione nella lettura della tabella di decodifica ", e);
- // }
- //
- // return rispostaControlli;
- // }
-
public RispostaControlli checkPresenzaDatiSpec(TipiUsoDatiSpec tiUsoXsd, TipiEntitaSacer tipoEntitySacer,
String sistemaMig, long idStruttura, long idTipoEntitySacer, Date dataRiferimento) {
RispostaControlli rispostaControlli;
@@ -1090,7 +1060,7 @@ public RispostaControlli checkPresenzaDatiSpec(TipiUsoDatiSpec tiUsoXsd, TipiEnt
// da notare STRETTAMENTE MAGGIORE della data di riferimento!!!
tmpTipoEntita);
- javax.persistence.Query query = entityManager.createQuery(queryStr, DecXsdDatiSpec.class);
+ javax.persistence.Query query = entityManager.createQuery(queryStr, Long.class);
query.setParameter("idStrutIn", idStruttura);
query.setParameter("tiUsoXsdIn", tiUsoXsd.name());
query.setParameter("idTipoEntitySacerIn", idTipoEntitySacer);
@@ -1108,7 +1078,7 @@ public RispostaControlli checkPresenzaDatiSpec(TipiUsoDatiSpec tiUsoXsd, TipiEnt
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkPresenzaDatiSpec: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -1188,7 +1158,7 @@ public RispostaControlli checkXSDDatiSpec(TipiUsoDatiSpec tiUsoXsd, TipiEntitaSa
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkXSDDatiSpec: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -1239,7 +1209,7 @@ public RispostaControlli checkPresenzaVersioneDatiSpec(TipiUsoDatiSpec tiUsoXsd,
+ " and %s = :idTipoEntitySacerIn " + " and t.tiEntitaSacer = :tiEntitaSacerIn "
+ " and t.cdVersioneXsd = :cdVersioneXsdIn ", tmpTipoEntita);
- javax.persistence.Query query = entityManager.createQuery(queryStr, DecXsdDatiSpec.class);
+ javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("idStrutIn", idStruttura);
query.setParameter("tiUsoXsdIn", tiUsoXsd.name());
query.setParameter("idTipoEntitySacerIn", idTipoEntitySacer);
@@ -1257,7 +1227,7 @@ public RispostaControlli checkPresenzaVersioneDatiSpec(TipiUsoDatiSpec tiUsoXsd,
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkPresenzaVersioneDatiSpec: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
@@ -1268,7 +1238,7 @@ public RispostaControlliAttSpec checkDatiSpecifici(TipiUsoDatiSpec tipoUsoAttr,
RispostaControlliAttSpec rispostaControlli;
rispostaControlli = new RispostaControlliAttSpec();
rispostaControlli.setrBoolean(false);
- rispostaControlli.setDatiSpecifici(new LinkedHashMap());
+ rispostaControlli.setDatiSpecifici(new LinkedHashMap<>());
DatoSpecifico tmpDatoSpecifico;
List lstAttribDatiSpecs = null;
@@ -1287,7 +1257,7 @@ public RispostaControlliAttSpec checkDatiSpecifici(TipiUsoDatiSpec tipoUsoAttr,
query.setParameter("idXsdDatiSpecIn", idXsdDatiSpec);
lstAttribDatiSpecs = query.getResultList();
- if (lstAttribDatiSpecs.size() > 0) {
+ if (!lstAttribDatiSpecs.isEmpty()) {
rispostaControlli.setrBoolean(true);
for (DecAttribDatiSpec td : lstAttribDatiSpecs) {
tmpDatoSpecifico = new DatoSpecifico();
@@ -1328,7 +1298,7 @@ public RispostaControlliAttSpec checkDatiSpecifici(TipiUsoDatiSpec tipoUsoAttr,
query.setParameter("idXsdDatiSpecIn", idXsdDatiSpec);
lstAttribDatiSpecs = query.getResultList();
- if (lstAttribDatiSpecs.size() > 0) {
+ if (!lstAttribDatiSpecs.isEmpty()) {
rispostaControlli.setrBoolean(true);
for (DecAttribDatiSpec td : lstAttribDatiSpecs) {
tmpDatoSpecifico = new DatoSpecifico();
@@ -1343,14 +1313,14 @@ public RispostaControlliAttSpec checkDatiSpecifici(TipiUsoDatiSpec tipoUsoAttr,
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkDatiSpecifici: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
}
- public RispostaControlli checkRiferimentoUD(CSChiave key, long idUnitaDoc, long idStrutturaVersante,
- TipologieComponente tComp, String descChiaveComp) {
+ public RispostaControlli checkRiferimentoUD(CSChiave key, long idStrutturaVersante, TipologieComponente tComp,
+ String descChiaveComp) {
RispostaControlli rispostaControlli;
rispostaControlli = new RispostaControlli();
@@ -1377,11 +1347,11 @@ public RispostaControlli checkRiferimentoUD(CSChiave key, long idUnitaDoc, long
javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("idStrutIn", idStrutturaVersante);
query.setParameter("cdRegistroKeyUnitaDocIn", tipoReg);
- query.setParameter("aaKeyUnitaDocIn", anno);
+ query.setParameter("aaKeyUnitaDocIn", new BigDecimal(anno));
query.setParameter("cdKeyUnitaDocIn", numero);
query.setParameter("dataDiOggiIn", new Date());
- aroCompDocs = (List) query.getResultList();
+ aroCompDocs = query.getResultList();
if (aroCompDocs == null || aroCompDocs.isEmpty()) {
if (tComp == TipologieComponente.COMPONENTE) {
// Nel documento PRINCIPALE dell?unit� documentaria indicata dal riferimento,
@@ -1447,7 +1417,7 @@ public RispostaControlli checkRiferimentoUD(CSChiave key, long idUnitaDoc, long
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.checkRiferimentoUD: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica ", e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
}
@@ -1552,7 +1522,6 @@ public RispostaControlli trovaNuovoProgDocumento(long idUnitaDoc, String categor
rispostaControlli.setrBoolean(false);
BigDecimal max = null;
// lista entity JPA ritornate dalle Query
- List aroDocs = null;
// lancio query di controllo
try {
@@ -1709,7 +1678,7 @@ private RispostaControlli checkCdKeyNormalized(long idRegistro, CSChiave key, St
javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("idRegistro", idRegistro);
- query.setParameter("aaKeyUnitaDoc", key.getAnno());
+ query.setParameter("aaKeyUnitaDoc", HibernateUtils.bigDecimalFrom(key.getAnno()));
query.setParameter("cdKeyUnitaDoc", key.getNumero());
query.setParameter("cdKeyUnitaDocNormaliz", cdKeyUnitaDocNormaliz);
@@ -1781,7 +1750,7 @@ private RispostaControlli getDtMaxVersMaxByUd(long idUnitaDoc) {
try {
Query query = entityManager
.createQuery("SELECT aro FROM AroVDtVersMaxByUnitaDoc aro WHERE aro.idUnitaDoc = :idUnitaDoc ");
- query.setParameter("idUnitaDoc", idUnitaDoc);
+ query.setParameter("idUnitaDoc", HibernateUtils.bigDecimalFrom(idUnitaDoc));
aroVDtVersMaxByUnitaDoc = (AroVDtVersMaxByUnitaDoc) query.getSingleResult();
if (aroVDtVersMaxByUnitaDoc == null) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666P);
@@ -1794,7 +1763,7 @@ private RispostaControlli getDtMaxVersMaxByUd(long idUnitaDoc) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.getDtMaxVersMaxByUd: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica " + e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
}
@@ -1808,7 +1777,7 @@ public RispostaControlli getDtCalcInizioNuoviUrn() {
// recupero parametro
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date dtInizioCalcNuoviUrn = dateFormat
- .parse(config.getParamApplicValue(ParametroApplDB.DATA_INIZIO_CALC_NUOVI_URN));
+ .parse(config.getValoreParamApplicByApplic(ParametroApplDB.DATA_INIZIO_CALC_NUOVI_URN));
rispostaControlli.setrDate(dtInizioCalcNuoviUrn);
} catch (Exception e) {
@@ -1816,7 +1785,7 @@ public RispostaControlli getDtCalcInizioNuoviUrn() {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
"ControlliSemantici.getDtCalcInizioNuoviUrn: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella di decodifica " + e);
+ log.error("Eccezione nella lettura della tabella di decodifica ", e);
}
return rispostaControlli;
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliTpi.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliTpi.java
index 74b14cc..5226c74 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliTpi.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliTpi.java
@@ -1,32 +1,42 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.ws.ejb;
-import it.eng.parer.entity.AplParamApplic;
-import it.eng.parer.util.ejb.help.ConfigurationHelper;
-import it.eng.parer.ws.dto.RispostaControlli;
-import it.eng.parer.ws.utils.CostantiDB;
-import it.eng.parer.ws.utils.MessaggiWSBundle;
-import it.eng.parer.ws.utils.ParametroApplDB;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
-import org.apache.commons.io.IOUtils;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.parer.util.ejb.help.ConfigurationHelper;
+import it.eng.parer.ws.dto.RispostaControlli;
+import it.eng.parer.ws.utils.MessaggiWSBundle;
+import it.eng.parer.ws.utils.ParametroApplDB;
+
/**
*
* @author Fioravanti_F
@@ -41,7 +51,7 @@ public class ControlliTpi {
private EntityManager entityManager;
@EJB
- ConfigurationHelper config;
+ private ConfigurationHelper configurationHelper;
public RispostaControlli caricaRootPath() {
RispostaControlli rispostaControlli;
@@ -49,57 +59,17 @@ public RispostaControlli caricaRootPath() {
rispostaControlli.setrLong(-1);
rispostaControlli.setrBoolean(false);
- Properties props = new Properties();
- boolean useDb = false;
- boolean prosegui = true;
- InputStream tmpStream = null;
- String rootftp = null;
-
try {
- tmpStream = this.getClass().getClassLoader().getResourceAsStream("/sacerEjb.properties");
- props.load(tmpStream);
- if (props.getProperty("tpiFs.overrideDbUrl").equals("true")) {
- rootftp = props.getProperty("tpiFs.url." + ParametroApplDB.TPI_ROOT_SACER);
- rispostaControlli.setrString(rootftp);
- rispostaControlli.setrBoolean(true);
- } else {
- useDb = true;
- }
- } catch (IOException ex) {
- prosegui = false;
+ rispostaControlli
+ .setrString(configurationHelper.getValoreParamApplicByApplic(ParametroApplDB.TPI_ROOT_SACER));
+ rispostaControlli.setrBoolean(true);
+ } catch (Exception e) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "ControlliTpi.caricaRootPath - properties: " + ex.getMessage()));
- log.error("Eccezione nella lettura del file di properties ", ex);
- } finally {
- IOUtils.closeQuietly(tmpStream);
+ "ControlliTpi.caricaRootPath - AplParamApplic: " + e.getMessage()));
+ log.error("Eccezione nella lettura della tabella AplParamApplic ", e);
}
- if (prosegui && useDb) {
- try {
- // carico i parametri applicativi
- String queryStr = "select tpa " + "from AplParamApplic tpa " + "where "
- + "tpa.tiParamApplic = :tiParamApplicIn " + "and tpa.nmParamApplic = :nmParamAppliciN ";
-
- javax.persistence.Query query = entityManager.createQuery(queryStr, AplParamApplic.class);
- query.setParameter("tiParamApplicIn", ParametroApplDB.TipoParametroAppl.TPI);
- query.setParameter("nmParamAppliciN", ParametroApplDB.TPI_ROOT_SACER);
-
- AplParamApplic tud = (AplParamApplic) query.getSingleResult();
- rispostaControlli.setrString(config.getParamApplicValue(tud.getNmParamApplic()));
- rispostaControlli.setrBoolean(true);
- } catch (NoResultException e) {
- rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli
- .setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666, "ControlliTpi.caricaRootPath - "
- + "Applicativo chiamante non correttamente configurato nella tabella AplParamApplic"));
- } catch (Exception e) {
- rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "ControlliTpi.caricaRootPath - AplParamApplic: " + e.getMessage()));
- log.error("Eccezione nella lettura della tabella AplParamApplic " + e);
- }
- }
return rispostaControlli;
}
@@ -114,25 +84,9 @@ public RispostaControlli verificaAbilitazioneTpi() {
rispostaControlli.setrLong(-1);
rispostaControlli.setrBoolean(false);
- Properties props = new Properties();
- InputStream tmpStream = null;
-
- try {
- tmpStream = this.getClass().getClassLoader().getResourceAsStream("/sacerEjb.properties");
- props.load(tmpStream);
- if (props.getProperty("tpi.TPIAbilitato").equals("true")) {
- rispostaControlli.setrBoolean(true);
- } else {
- rispostaControlli.setrBoolean(false);
- }
- } catch (IOException ex) {
- rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "ControlliTpi.verificaAbilitazioneTpi - properties: " + ex.getMessage()));
- log.error("Eccezione nella lettura del file di properties ", ex);
- } finally {
- IOUtils.closeQuietly(tmpStream);
- }
+ boolean isTpiEnable = Boolean
+ .parseBoolean(configurationHelper.getValoreParamApplicByApplic(ParametroApplDB.TPI_ENABLE));
+ rispostaControlli.setrBoolean(isTpiEnable);
return rispostaControlli;
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliWS.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliWS.java
index 769399f..07e7d06 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliWS.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/ControlliWS.java
@@ -1,12 +1,31 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.ws.ejb;
+import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
@@ -15,13 +34,14 @@
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+import javax.persistence.TypedQuery;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import it.eng.parer.entity.IamUser;
-import it.eng.parer.grantedEntity.UsrUser;
+import it.eng.parer.granted_entity.UsrUser;
import it.eng.parer.idpjaas.logutils.LogDto;
import it.eng.parer.ws.dto.IWSDesc;
import it.eng.parer.ws.dto.RispostaControlli;
@@ -37,23 +57,25 @@
*
* @author Fioravanti_F
*/
+@SuppressWarnings("unchecked")
@Stateless(mappedName = "ControlliWS")
@LocalBean
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
public class ControlliWS {
+ private static final String ERRORE_AUTENTICAZIONE = "Eccezione nella fase di autenticazione del EJB ";
@EJB
- WsIdpLogger idpLogger;
+ private WsIdpLogger idpLogger;
@EJB
- ControlliSemantici controlliSemantici;
+ private ControlliSemantici controlliSemantici;
private static final Logger log = LoggerFactory.getLogger(ControlliWS.class);
//
@PersistenceContext(unitName = "ParerJPA")
private EntityManager entityManager;
- public RispostaControlli checkVersione(String versione, String versioniWsKey, HashMap xmlDefaults,
+ public RispostaControlli checkVersione(String versione, String versioniWsKey, Map xmlDefaults,
TipiWSPerControlli tipows) {
RispostaControlli rispostaControlli;
rispostaControlli = new RispostaControlli();
@@ -62,10 +84,8 @@ public RispostaControlli checkVersione(String versione, String versioniWsKey, Ha
if (versione == null || versione.isEmpty()) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_010);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_010));
- break;
case ANNULLAMENTO:
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_010);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_010));
break;
@@ -73,10 +93,6 @@ public RispostaControlli checkVersione(String versione, String versioniWsKey, Ha
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_003_001);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_003_001));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_010);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_010));
- break;
}
return rispostaControlli;
@@ -98,6 +114,7 @@ public RispostaControlli checkVersione(String versione, String versioniWsKey, Ha
if (!rispostaControlli.isrBoolean()) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_011);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_011, versione));
break;
@@ -110,10 +127,6 @@ public RispostaControlli checkVersione(String versione, String versioniWsKey, Ha
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_003_002);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_003_002, versione));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_011);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_011, versione));
- break;
}
}
@@ -127,16 +140,13 @@ public RispostaControlli checkCredenziali(String loginName, String password, Str
rispostaControlli = new RispostaControlli();
rispostaControlli.setrBoolean(false);
- log.info("Indirizzo IP del chiamante - access: ws - IP: " + indirizzoIP);
- // log.debug("Indirizzo IP del chiamante: " + indirizzoIP);
+ log.info("Indirizzo IP del chiamante - access: ws - IP: {}", indirizzoIP);
if (loginName == null || loginName.isEmpty()) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_004);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_004));
- break;
case ANNULLAMENTO:
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_004);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_004));
break;
@@ -144,10 +154,6 @@ public RispostaControlli checkCredenziali(String loginName, String password, Str
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_002_007);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_002_007));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_004);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_004));
- break;
}
return rispostaControlli;
}
@@ -168,7 +174,7 @@ public RispostaControlli checkCredenziali(String loginName, String password, Str
UsrUser usrUser;
String queryStr = "select iu, usr from IamUser iu, UsrUser usr "
+ "where iu.nmUserid = :nmUseridIn and iu.idUserIam = usr.idUserIam";
- javax.persistence.Query query = entityManager.createQuery(queryStr, IamUser.class);
+ javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("nmUseridIn", loginName);
Object[] result = (Object[]) query.getSingleResult();
iamUser = (IamUser) result[0]; // IamUser
@@ -190,9 +196,9 @@ public RispostaControlli checkCredenziali(String loginName, String password, Str
rispostaControlli.setrObject(utente);
rispostaControlli.setrBoolean(true);
} catch (AuthWSException e) {
- log.warn("ERRORE DI AUTENTICAZIONE WS." + " Funzionalità: " + tipows.name() + " Utente: " + loginName
- + " Tipo errore: " + e.getCodiceErrore().name() + " Indirizzo IP: " + indirizzoIP + " Descrizione: "
- + e.getDescrizioneErrore());
+ log.warn(
+ "ERRORE DI AUTENTICAZIONE WS. Funzionalità: {} Utente: {} Tipo errore: {} Indirizzo IP: {} Descrizione: {}",
+ tipows.name(), loginName, e.getCodiceErrore().name(), indirizzoIP, e.getDescrizioneErrore());
switch (tipows) {
case VERSAMENTO_RECUPERO:
if (e.getCodiceErrore().equals(AuthWSException.CodiceErrore.UTENTE_SCADUTO)) {
@@ -258,7 +264,7 @@ public RispostaControlli checkCredenziali(String loginName, String password, Str
String queryStr = "select count(iu) from IamUser iu where iu.nmUserid = :nmUseridIn";
javax.persistence.Query query = entityManager.createQuery(queryStr);
query.setParameter("nmUseridIn", loginName);
- long tmpNumUtenti = (Long) query.getSingleResult();
+ long tmpNumUtenti = (long) query.getSingleResult();
if (tmpNumUtenti > 0) {
tmpLogDto.setTipoEvento(LogDto.TipiEvento.BAD_PASS);
tmpLogDto.setDsEvento("WS, bad password");
@@ -269,9 +275,9 @@ public RispostaControlli checkCredenziali(String loginName, String password, Str
}
} catch (Exception e) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "Eccezione nella fase di autenticazione del EJB " + e.getMessage()));
- log.error("Eccezione nella fase di autenticazione del EJB ", e);
+ rispostaControlli.setDsErr(
+ MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666, ERRORE_AUTENTICAZIONE + e.getMessage()));
+ log.error(ERRORE_AUTENTICAZIONE, e);
}
// scrittura log
@@ -291,8 +297,8 @@ public RispostaControlli checkUtente(String loginName) {
String queryStr = "select iu from IamUser iu where iu.nmUserid = :nmUseridIn";
javax.persistence.Query query = entityManager.createQuery(queryStr, IamUser.class);
query.setParameter("nmUseridIn", loginName);
- List tmpUsers = (List) query.getResultList();
- if (tmpUsers != null && tmpUsers.size() > 0) {
+ List tmpUsers = query.getResultList();
+ if (tmpUsers != null && !tmpUsers.isEmpty()) {
iamUser = tmpUsers.get(0);
if (!iamUser.getFlAttivo().equals("1")) {
@@ -321,9 +327,9 @@ public RispostaControlli checkUtente(String loginName) {
}
} catch (Exception e) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "Eccezione nella fase di autenticazione del EJB " + e.getMessage()));
- log.error("Eccezione nella fase di autenticazione del EJB ", e);
+ rispostaControlli.setDsErr(
+ MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666, ERRORE_AUTENTICAZIONE + e.getMessage()));
+ log.error(ERRORE_AUTENTICAZIONE, e);
}
return rispostaControlli;
@@ -334,7 +340,6 @@ public RispostaControlli checkAuthWS(User utente, IWSDesc descrizione, TipiWSPer
rispostaControlli = new RispostaControlli();
rispostaControlli.setrBoolean(false);
boolean checkOrgVersAuth = false;
- long numAbil = 0;
Integer tmpIdOrganizz = utente.getIdOrganizzazioneFoglia() != null
? utente.getIdOrganizzazioneFoglia().intValue() : null;
try {
@@ -344,6 +349,7 @@ public RispostaControlli checkAuthWS(User utente, IWSDesc descrizione, TipiWSPer
checkOrgVersAuth = true;
switch (tipows) {
case VERSAMENTO_RECUPERO:
+ case AGGIORNAMENTO_VERSAMENTO:
// L''utente {0} non è abilitato entro la struttura versante
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_009);
rispostaControlli
@@ -358,11 +364,6 @@ public RispostaControlli checkAuthWS(User utente, IWSDesc descrizione, TipiWSPer
rispostaControlli.setDsErr(
MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_002_006, utente.getUsername()));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_009);
- rispostaControlli
- .setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_009, utente.getUsername()));
- break;
}
} catch (Exception ex) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
@@ -375,14 +376,14 @@ public RispostaControlli checkAuthWS(User utente, IWSDesc descrizione, TipiWSPer
try {
String queryStr = "select count(t) from IamAbilOrganiz t where " + "t.iamUser.idUserIam = :idUserIamIn "
+ "and t.idOrganizApplic = :idOrganizApplicIn";
- javax.persistence.Query query = entityManager.createQuery(queryStr, IamUser.class);
+ TypedQuery query = entityManager.createQuery(queryStr, Long.class);
query.setParameter("idUserIamIn", utente.getIdUtente());
- query.setParameter("idOrganizApplicIn", tmpIdOrganizz);
- numAbil = (long) query.getSingleResult();
- if (numAbil > 0) {
+ query.setParameter("idOrganizApplicIn", new BigDecimal(tmpIdOrganizz));
+ Long numAbil = query.getSingleResult();
+ if (numAbil != null && numAbil > 0) {
switch (tipows) {
case VERSAMENTO_RECUPERO:
- // L''utente {0} non è autorizzato alla funzione {1}
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_008);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_008,
utente.getUsername(), descrizione.getNomeWs()));
@@ -392,16 +393,10 @@ public RispostaControlli checkAuthWS(User utente, IWSDesc descrizione, TipiWSPer
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.RICH_ANN_VERS_008));
break;
case VERSAMENTO_FASCICOLO:
- // L''utente {0} non è autorizzato alla funzione {1}
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_002_005);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_002_005,
utente.getUsername(), descrizione.getNomeWs()));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_008);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_008,
- utente.getUsername(), descrizione.getNomeWs()));
- break;
}
}
} catch (Exception ex) {
@@ -432,7 +427,7 @@ public RispostaControlli checkAuthWSNoOrg(User utente, IWSDesc descrizione, Tipi
} else {
switch (tipows) {
case VERSAMENTO_RECUPERO:
- // L''utente {0} non è autorizzato alla funzione {1}
+ case AGGIORNAMENTO_VERSAMENTO:
rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_008);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_008,
utente.getUsername(), descrizione.getNomeWs()));
@@ -442,24 +437,17 @@ public RispostaControlli checkAuthWSNoOrg(User utente, IWSDesc descrizione, Tipi
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.RICH_ANN_VERS_008));
break;
case VERSAMENTO_FASCICOLO:
- // L''utente {0} non è autorizzato alla funzione {1}
rispostaControlli.setCodErr(MessaggiWSBundle.FAS_CONFIG_002_005);
rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.FAS_CONFIG_002_005,
utente.getUsername(), descrizione.getNomeWs()));
break;
- case AGGIORNAMENTO_VERSAMENTO:
- // L''utente {0} non è autorizzato alla funzione {1}
- rispostaControlli.setCodErr(MessaggiWSBundle.UD_001_008);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.UD_001_008,
- utente.getUsername(), descrizione.getNomeWs()));
- break;
}
}
} catch (Exception e) {
rispostaControlli.setCodErr(MessaggiWSBundle.ERR_666);
- rispostaControlli.setDsErr(MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666,
- "Eccezione nella fase di autenticazione del EJB " + e.getMessage()));
- log.error("Eccezione nella fase di autenticazione del EJB ", e);
+ rispostaControlli.setDsErr(
+ MessaggiWSBundle.getString(MessaggiWSBundle.ERR_666, ERRORE_AUTENTICAZIONE + e.getMessage()));
+ log.error(ERRORE_AUTENTICAZIONE, e);
}
return rispostaControlli;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/WsIdpLogger.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/WsIdpLogger.java
index 915fc56..452b404 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/WsIdpLogger.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/WsIdpLogger.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,17 +22,10 @@
*/
package it.eng.parer.ws.ejb;
-import it.eng.parer.idpjaas.logutils.IdpConfigLog;
-import it.eng.parer.idpjaas.logutils.IdpLogger;
-import it.eng.parer.idpjaas.logutils.LogDto;
-import it.eng.parer.util.ejb.AppServerInstance;
-import it.eng.parer.ws.dto.RispostaControlli;
-import it.eng.parer.ws.utils.CostantiDB;
-import it.eng.parer.ws.utils.ParametroApplDB;
-
import java.net.UnknownHostException;
import java.sql.SQLException;
import java.util.HashMap;
+
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
@@ -23,13 +33,23 @@
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.parer.idpjaas.logutils.IdpConfigLog;
+import it.eng.parer.idpjaas.logutils.IdpLogger;
+import it.eng.parer.idpjaas.logutils.LogDto;
+import it.eng.parer.util.ejb.AppServerInstance;
+import it.eng.parer.ws.dto.RispostaControlli;
+import it.eng.parer.ws.utils.ParametroApplDB;
+import it.eng.spagoCore.util.JpaUtils;
+
/**
*
* @author fioravanti_f
*/
+@SuppressWarnings("unchecked")
@Stateless(mappedName = "WsIdpLogger")
@LocalBean
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
@@ -67,6 +87,7 @@ public void scriviLog(LogDto logDto) {
&& !iamDefaults.get(ParametroApplDB.IDP_MAX_GIORNI).isEmpty()
&& iamDefaults.get(ParametroApplDB.IDP_MAX_TENTATIVI_FALLITI) != null
&& !iamDefaults.get(ParametroApplDB.IDP_MAX_TENTATIVI_FALLITI).isEmpty()) {
+ java.sql.Connection connection = null;
try {
IdpConfigLog icl = new IdpConfigLog();
icl.setQryRegistraEventoUtente(iamDefaults.get(ParametroApplDB.IDP_QRY_REGISTRA_EVENTO_UTENTE));
@@ -78,7 +99,7 @@ public void scriviLog(LogDto logDto) {
logDto.setServername(asi.getName());
- java.sql.Connection connection = entityManager.unwrap(java.sql.Connection.class);
+ connection = JpaUtils.provideConnectionFrom(entityManager);
IdpLogger.EsitiLog risposta = (new IdpLogger(icl).scriviLog(logDto, connection));
@@ -107,6 +128,14 @@ public void scriviLog(LogDto logDto) {
throw new RuntimeException("WsIdpLogger: Errore nell'accesso ai dati di log: " + ex.getMessage());
} catch (Exception ex) {
throw new RuntimeException("WsIdpLogger: Errore: " + ex.getMessage());
+ } finally {
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException ex) {
+ throw new RuntimeException("WsIdpLogger: Errore: " + ex.getMessage());
+ }
+ }
}
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlFascCache.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlFascCache.java
index 1c11766..4d2d01f 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlFascCache.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlFascCache.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,9 +22,8 @@
*/
package it.eng.parer.ws.ejb;
-import it.eng.parer.ws.xml.versfascicolo.IndiceSIPFascicolo;
-import it.eng.parer.ws.xml.versfascicoloresp.EsitoVersamentoFascicolo;
import java.io.InputStream;
+
import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Lock;
@@ -19,10 +35,14 @@
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.parer.ws.xml.versfascicolo.IndiceSIPFascicolo;
+import it.eng.parer.ws.xml.versfascicoloresp.EsitoVersamentoFascicolo;
+
/**
*
* @author fioravanti_f
@@ -34,7 +54,7 @@ public class XmlFascCache {
private static final Logger log = LoggerFactory.getLogger(XmlFascCache.class);
- private final String URL_SCHEMA_REQUEST_FASCICOLO = "/it/eng/parer/ws/xml/versfascicolo/WSRequestIndiceSIPFascicolo_1.0.xsd";
+ private final String URL_SCHEMA_REQUEST_FASCICOLO = "/it/eng/parer/ws/xml/versfascicolo/WSRequestIndiceSIPFascicolo.xsd";
//
JAXBContext versReqFascicoloCtx;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlUpdVersCache.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlUpdVersCache.java
index afd0e5a..12ecf0a 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlUpdVersCache.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlUpdVersCache.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.ws.ejb;
import javax.annotation.PostConstruct;
@@ -102,4 +119,4 @@ public Schema getSchemaOfAggVersReq() {
public Schema getSchemaOfAggVersResp() {
return aggVersRespSchema;
}
-}
\ No newline at end of file
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlVersCache.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlVersCache.java
index 82be01d..0cb14a1 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlVersCache.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/ejb/XmlVersCache.java
@@ -1,16 +1,22 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.ws.ejb;
-import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
-import it.eng.parer.exception.SacerWsRuntimeException;
-import it.eng.parer.ws.xml.versReq.DatiSpecificiType;
-import it.eng.parer.ws.xml.versReq.UnitaDocAggAllegati;
-import it.eng.parer.ws.xml.versReq.UnitaDocumentaria;
-import it.eng.parer.ws.xml.versReqMultiMedia.IndiceMM;
-import it.eng.parer.ws.xml.versResp.EsitoVersAggAllegati;
-import it.eng.parer.ws.xml.versResp.EsitoVersamento;
-import it.eng.parer.ws.xml.versResp.RapportoVersamento;
-import it.eng.parerxml.xsd.FileXSD;
-import it.eng.parerxml.xsd.FileXSDUtil;
import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Lock;
@@ -22,10 +28,23 @@
import javax.xml.bind.JAXBException;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
+import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
+import it.eng.parer.exception.SacerWsRuntimeException;
+import it.eng.parer.ws.xml.versReq.DatiSpecificiType;
+import it.eng.parer.ws.xml.versReq.UnitaDocAggAllegati;
+import it.eng.parer.ws.xml.versReq.UnitaDocumentaria;
+import it.eng.parer.ws.xml.versReqMultiMedia.IndiceMM;
+import it.eng.parer.ws.xml.versResp.EsitoVersAggAllegati;
+import it.eng.parer.ws.xml.versResp.EsitoVersamento;
+import it.eng.parer.ws.xml.versResp.RapportoVersamento;
+import it.eng.parerxml.xsd.FileXSD;
+import it.eng.parerxml.xsd.FileXSDUtil;
+
/**
* Contains the JAXBContext for versamento ws
*
@@ -126,4 +145,4 @@ public Schema getSchemaOfVersReq() {
public Schema getSchemaOfVersResp() {
return versRespSchema;
}
-}
\ No newline at end of file
+}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/AvanzamentoWs.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/AvanzamentoWs.java
index 737573c..48af1ba 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/AvanzamentoWs.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/AvanzamentoWs.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
*/
package it.eng.parer.ws.utils;
@@ -11,6 +28,7 @@
*/
public class AvanzamentoWs implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory.getLogger(AvanzamentoWs.class);
public enum Funzioni {
@@ -23,8 +41,8 @@ public enum Funzioni {
public enum CheckPoints {
Inizio, TrasferimentoPayloadIn, VerificaStrutturaChiamataWs, VerificaSemantica, VerificaCoerenzaComponentiFile,
- VerificaFirmeComponenti, VerificaFormatoFileComponenti, SalvataggioDatiVersati, SalvataggioSessioneWS,
- InvioMessaggioCodaJMS, CreazioneRisposta, InvioRisposta, Pulizia, Fine
+ VerificaFirmeComponenti, VerificaFormatoFileComponenti, CopiaBackendStaging, SalvataggioDatiVersati,
+ SalvataggioSessioneWS, InvioMessaggioCodaJMS, CreazioneRisposta, InvioRisposta, Pulizia, Fine
}
//
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/BinEncUtility.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/BinEncUtility.java
index 71c8c3f..dbc7518 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/BinEncUtility.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/BinEncUtility.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,13 +22,18 @@
*/
package it.eng.parer.ws.utils;
-import java.io.UnsupportedEncodingException;
-import org.apache.commons.codec.DecoderException;
+import java.nio.charset.StandardCharsets;
+
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
+import it.eng.parer.exception.SacerWsRuntimeException;
+
/**
*
* @author fioravanti_f
@@ -20,6 +42,10 @@ public class BinEncUtility {
private static final Logger logger = LoggerFactory.getLogger(BinEncUtility.class);
+ private BinEncUtility() {
+ throw new IllegalStateException("Utility class");
+ }
+
public static boolean isBase64String(String utf8str) {
return Base64.isBase64(utf8str);
}
@@ -27,22 +53,23 @@ public static boolean isBase64String(String utf8str) {
public static String encodeUTF8Base64String(byte[] barray) {
if (barray != null && barray.length > 0) {
try {
- return new String(Base64.encodeBase64(barray), "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- logger.error("Encoding UTF-8 non supportato");
- throw new RuntimeException(ex.getMessage());
+ return new String(Base64.encodeBase64(barray), StandardCharsets.UTF_8.name());
+ } catch (Exception ex) {
+ /* critical error */
+ throw new SacerWsRuntimeException(ex, SacerWsErrorCategory.INTERNAL_ERROR);
}
} else {
- return "";
+ return StringUtils.EMPTY;
}
}
public static byte[] decodeUTF8Base64String(String utf8str) {
try {
- return Base64.decodeBase64(utf8str.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- logger.error("Encoding UTF-8 non supportato");
- throw new RuntimeException(ex.getMessage());
+ return Base64.decodeBase64(utf8str.getBytes(StandardCharsets.UTF_8.name()));
+ } catch (Exception ex) {
+ /* managed error */
+ logger.warn("Encoding UTF-8 non supportato", ex);
+ return ArrayUtils.EMPTY_BYTE_ARRAY;
}
}
@@ -54,16 +81,17 @@ public static String encodeUTF8HexString(byte[] barray) {
if (barray != null && barray.length > 0) {
return Hex.encodeHexString(barray);
} else {
- return "";
+ return StringUtils.EMPTY;
}
}
public static byte[] decodeUTF8HexString(String hexstr) {
try {
return Hex.decodeHex(hexstr.toCharArray());
- } catch (DecoderException ex) {
- logger.error("La stringa non rappresenta un numero in base 16");
- throw new RuntimeException(ex.getMessage());
+ } catch (Exception ex) {
+ /* managed error */
+ logger.warn("La stringa non rappresenta un numero in base 16", ex);
+ return ArrayUtils.EMPTY_BYTE_ARRAY;
}
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CollectionUtility.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CollectionUtility.java
index 262276c..42ac801 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CollectionUtility.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CollectionUtility.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSBundle.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSBundle.java
index 38ad945..5a9d0c3 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSBundle.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSBundle.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -11,9 +28,9 @@
import javax.naming.NamingException;
import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
+import it.eng.parer.exception.SacerWsRuntimeException;
import it.eng.parer.ws.versamentoUpd.dto.ControlloWSResp;
/**
@@ -23,8 +40,6 @@
public class ControlliWSBundle {
- private static Logger log = LoggerFactory.getLogger(ControlliWSBundle.class);
-
public static final String DEFAULT_LOCALE = "it";
/*
@@ -61,9 +76,9 @@ private static ControlliWSCache lookupCacheRef() {
try {
return (ControlliWSCache) new InitialContext().lookup("java:app/sacerws-ejb/ControlliWSCache");
} catch (NamingException ex) {
- log.error("Errore lookup dei messaggi " + ExceptionUtils.getRootCauseMessage(ex), ex);
- throw new RuntimeException(
- "Errore lookup singleton dei messaggi " + ExceptionUtils.getRootCauseMessage(ex));
+ throw new SacerWsRuntimeException(
+ "Errore lookup singleton dei messaggi " + ExceptionUtils.getRootCauseMessage(ex),
+ SacerWsErrorCategory.INTERNAL_ERROR);
}
}
@@ -127,6 +142,8 @@ private static ControlliWSCache lookupCacheRef() {
public static final String CTRL_UD_PROFILOUD = "controlloProfiloUnitaDoc";
+ public static final String CTRL_UD_PROFILONORMATIVO = "controlloProfiloNormativo";
+
public static final String CTRL_UD_DATISPECIFICI = "controlloDatiSpecUnitaDoc";
public static final String CTRL_UD_DATISPECIFICIMIGRAZ = "controlloDatiSpecUnitaDocMigraz";
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSCache.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSCache.java
index 6aad550..e51cf43 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSCache.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSCache.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,11 +22,8 @@
*/
package it.eng.parer.ws.utils;
-import java.math.BigDecimal;
import java.text.MessageFormat;
-import java.util.Comparator;
import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -26,6 +40,8 @@
import org.slf4j.LoggerFactory;
import it.eng.parer.entity.DecControlloWs;
+import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
+import it.eng.parer.exception.SacerWsRuntimeException;
import it.eng.parer.ws.versamentoUpd.dto.ControlloWSResp;
/**
@@ -57,9 +73,7 @@ public void initSingleton() {
cnt.getCdFamigliaControllo(), cnt.getDsControlloWs(), cnt.getNiOrdControllo()));
}
} catch (RuntimeException ex) {
- // log.fatal("Inizializzazione singleton ControlliWSCache fallita! ", ex);
- log.error("Inizializzazione singleton ControlliWSCache fallita! ", ex);
- throw ex;
+ throw new SacerWsRuntimeException(ex, SacerWsErrorCategory.INTERNAL_ERROR);
}
log.info("Inizializzazione singleton ControlliWSCache... completata.");
}
@@ -71,7 +85,7 @@ public String getString(String cdControllo) {
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public String getString(String cdControllo, Object... params) {
- return StringEscapeUtils.unescapeJava(MessageFormat.format(controlliMap.get(controlliMap).toString(), params));
+ return StringEscapeUtils.unescapeJava(MessageFormat.format(controlliMap.get(cdControllo).toString(), params));
}
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSHelper.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSHelper.java
index fd65a14..831a8a1 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSHelper.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/ControlliWSHelper.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -21,11 +38,10 @@
import org.slf4j.LoggerFactory;
import it.eng.parer.entity.DecControlloWs;
+import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
+import it.eng.parer.exception.SacerWsRuntimeException;
-/**
- *
- * @author sinatti_s
- */
+@SuppressWarnings("unchecked")
@Stateless(mappedName = "ControlliWSHelper")
@LocalBean
@TransactionManagement(TransactionManagementType.CONTAINER)
@@ -52,9 +68,7 @@ public DecControlloWs caricaCdControlloWs(String cdControlloWs) {
query.setParameter("cdControlloWs", cdControlloWs);
tmperr = (DecControlloWs) query.getSingleResult();
} catch (RuntimeException ex) {
- // log.fatal("ControlliWSHelper.caricaDecControlloWs fallita! ", ex);
- log.error("ControlliWSHelper.caricaDecControlloWs fallita! ", ex);
- throw ex;
+ throw new SacerWsRuntimeException(ex, SacerWsErrorCategory.INTERNAL_ERROR);
}
return tmperr;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Costanti.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Costanti.java
index 33d8859..cd28a67 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Costanti.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Costanti.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -17,16 +34,10 @@ public class Costanti {
public static final String WS_VERSAMENTO_VRSN = "1.5";
public static final String WS_AGGIUNTA_VRSN = "1.4";
public static final String WS_VERS_FASCICOLO_VRSN = "1.0";
- public static final String WS_AGGIORNAMENTO_VERS_VRSN = "1.4";
+ public static final String WS_AGGIORNAMENTO_VERS_VRSN = "1.5";
/**
* Si reperiscono da DB (parametri applicativi)
*/
- // public static final String[] WS_VERSAMENTO_COMP = {"1.1", "1.2", "1.25",
- // "1.3", "1.4", "1.5"};
- // public static final String[] WS_AGGIUNTA_COMP = {"1.3", "1.4","1.5"};
- // public static final String[] WS_VERS_FASCICOLO_COMP = {"1.0"};
- // public static final String[] WS_AGGIORNAMENTO_VERS_COMP = {"1.4"};
- //
public static final String WS_VERSAMENTO_NOME = "VersamentoSync";
public static final String WS_AGGIUNTA_DOC_NOME = "AggiuntaAllegatiSync";
@@ -46,7 +57,7 @@ public class Costanti {
public class UrnFormatter {
private UrnFormatter() {
- throw new IllegalStateException("Utility class");
+ throw new IllegalStateException("UrnFormatter Utility class");
}
public static final char URN_STD_SEPARATOR = ':';
@@ -168,24 +179,53 @@ private UrnFormatter() {
// AWS
public class AwsFormatter {
+
+ private AwsFormatter() {
+ throw new IllegalStateException("AwsFormatter Utility class");
+ }
+
public static final String COMP_CD_KEY_FILE_FMT = "{0}/{1}/{2}/{3}/{4}/{5}";
public static final String COMP_REPORTVF_CD_KEY_FILE_FMT = COMP_CD_KEY_FILE_FMT + "/{6}";
}
+ //
+ public class AwsConstants {
+
+ private AwsConstants() {
+ throw new IllegalStateException("AwsS3Constants Utility class");
+ }
+
+ // custom tags
+ public static final String TAG_KEY_VRSOBJ_TYPE = "vrs-object-type";
+ public static final String TAG_VALUE_VRSOBJ_FILE_COMP = "file_componente_uddoc";
+ public static final String TAG_VALUE_VRSOBJ_METADATI = "xml_metadati_uddoc";
+ public static final String TAG_VALUE_VRSOBJ_TMP = "temporany";
+
+ public static final String TAG_KEY_RVF_CDSERV = "rvf-cd-service";
+ public static final String TAG_KEY_RVF_NMVERS = "rvf-nm-version";
+
+ // custom metadata
+ public static final String MEATADATA_INGEST_NODE = "ingest-node";
+ public static final String MEATADATA_INGEST_TIME = "ingest-time";
+
+ }
+
//
public class JMSMsgProperties {
+ private JMSMsgProperties() {
+ throw new IllegalStateException("JMSMsgProperties Utility class");
+ }
+
// msg properties
- public final static String MSG_K_PAYLOADTYPE = "tipoPayload";
- public final static String MSG_K_STATUS = "statoElenco";
- public final static String MSG_K_APP = "fromApplication";
+ public static final String MSG_K_PAYLOADTYPE = "tipoPayload";
+ public static final String MSG_K_STATUS = "statoElenco";
+ public static final String MSG_K_APP = "fromApplication";
}
- //
- //
//
public enum ModificatoriWS {
@@ -215,8 +255,13 @@ public enum ModificatoriWS {
// end MEV#23176
TAG_PROFILI_1_5,
// MEV#25288
- TAG_URN_SIP_FASC_1_1 // tag per urn dei sip in Esito Versamento e Rapporto di Versamento dei Fascicoli
+ TAG_URN_SIP_FASC_1_1, // tag per urn dei sip in Esito Versamento e Rapporto di Versamento dei
+ // Fascicoli
// end MEV#25288
+ // MEV#26423
+ TAG_PROFILI_UPD_1_6, // tag per ProfiloNormativo servizio aggiornamento versamento
+ // MEV#28309
+ TAG_DATISPEC_DEL_1_6 // tag per eliminazione DatiSpecifici servizio aggiornamento versamento
}
@@ -225,18 +270,18 @@ public enum CategoriaDocumento {
Principale(CostantiDB.TipoDocumento.PRINCIPALE, 1), Allegato(CostantiDB.TipoDocumento.ALLEGATO, 2),
Annotazione(CostantiDB.TipoDocumento.ANNOTAZIONE, 3), Annesso(CostantiDB.TipoDocumento.ANNESSO, 4),
Documento(Costanti.UrnFormatter.URN_DOC_PREFIX);// "categoria"
- // speciale,
- // in
- // quanto
- // utilizzata
- // esclusivamente
- // per
- // il
- // supporto
- // legato
- // alla
- // composizione
- // dell'URN
+ // speciale,
+ // in
+ // quanto
+ // utilizzata
+ // esclusivamente
+ // per
+ // il
+ // supporto
+ // legato
+ // alla
+ // composizione
+ // dell'URN
private String valore;
private int ordine;
@@ -286,7 +331,8 @@ public enum TipiWSPerControlli {
*/
public enum VersioneWS {
- V_EMPTY(""), V1_0("1.0"), V1_1("1.1"), V1_2("1.2"), V1_25("1.25"), V1_3("1.3"), V1_4("1.4"), V1_5("1.5");
+ V_EMPTY(""), V1_0("1.0"), V1_1("1.1"), V1_2("1.2"), V1_25("1.25"), V1_3("1.3"), V1_4("1.4"), V1_5("1.5"),
+ V1_6("1.6");
private String version;
@@ -312,10 +358,12 @@ public static VersioneWS evalute(String versione) {
}
public static final String VERIFICA_FIRMA_METADATI_REPORT_NOVERSION = "NO_VERSION"; // VERS_FMT_STRING +
- // UD_FMT_STRING
+ // UD_FMT_STRING
public enum GenReportVerificaFirma {
OFF, ON, ALL;
}
+ public static final String ERRORE_CLIENT_ERRATO = "QUESTO E' UN ERRORE PROVOCATO DA UN CLIENT SCRITTO MALE: SQLIntegrityConstraintViolationException ";
+
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CostantiDB.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CostantiDB.java
index 1e2b6b4..7c2ae01 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CostantiDB.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/CostantiDB.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -16,6 +33,9 @@ public class CostantiDB {
//
public class DatiCablati {
+ private DatiCablati() {
+ throw new IllegalStateException("DatiCablati Utility class");
+ }
public static final String TPI_PATH_LISTA_FILE = "ListaFile";
public static final String VERS_TIPO_CONSERVAZIONE_DEFAULT = "VERSAMENTO_ANTICIPATO";
@@ -23,6 +43,9 @@ public class DatiCablati {
//
public class TipoDocumento {
+ private TipoDocumento() {
+ throw new IllegalStateException("TipoDocumento Utility class");
+ }
public static final String PRINCIPALE = "PRINCIPALE";
public static final String ALLEGATO = "ALLEGATO";
@@ -33,6 +56,10 @@ public class TipoDocumento {
//
public class TipiXmlDati {
+ private TipiXmlDati() {
+ throw new IllegalStateException("TipiXmlDati Utility class");
+ }
+
public static final String INDICE_FILE = "INDICE_FILE";
public static final String RICHIESTA = "RICHIESTA";
public static final String RISPOSTA = "RISPOSTA";
@@ -42,6 +69,10 @@ public class TipiXmlDati {
//
public class TipoUsoComponente {
+ private TipoUsoComponente() {
+ throw new IllegalStateException("TipoUsoComponente Utility class");
+ }
+
public static final String CONTENUTO = "CONTENUTO";
public static final String CONVERTITORE = "CONVERTITORE";
public static final String FIRMA = "FIRMA";
@@ -53,6 +84,10 @@ public class TipoUsoComponente {
public class SubStruttura {
+ private SubStruttura() {
+ throw new IllegalStateException("SubStruttura Utility class");
+ }
+
public static final String DEFAULT_NAME = "DEFAULT";
public static final String DEFAULT_DESC = "Sub struttura di default per la struttura ";
public static final String DEFAULT_TEMPLATE_DESC = "Sub struttura di default";
@@ -659,8 +694,8 @@ public enum TipoModLacuna {
DESCRIZIONE, RANGE_PROGRESSIVI
}
- public static final BigDecimal NUM_SERIE_36 = new BigDecimal(0.3);
- public static final BigDecimal NUM_SERIE_24 = new BigDecimal(0.5);
+ public static final BigDecimal NUM_SERIE_36 = BigDecimal.valueOf(0.3);
+ public static final BigDecimal NUM_SERIE_24 = BigDecimal.valueOf(0.5);
public static final BigDecimal NUM_SERIE_12 = new BigDecimal(1);
public static final BigDecimal NUM_SERIE_6 = new BigDecimal(2);
public static final BigDecimal NUM_SERIE_4 = new BigDecimal(3);
@@ -831,11 +866,9 @@ public static String[] getStatiControlloItem() {
// DA MODIFICARE IN CASO DI
// AGGIUNTE
- String[] stati = new String[] { CostantiDB.TipoErrRichAnnulVers.ITEM_IN_CORSO_DI_ANNUL.name(),
- CostantiDB.TipoErrRichAnnulVers.ITEM_RIFERITO.name(),
- CostantiDB.TipoErrRichAnnulVers.ITEM_VERSATA_IN_DATA_RICH.name(),
- CostantiDB.TipoErrRichAnnulVers.STATO_CONSERV_NON_AMMESSO.name() };
- return stati;
+ return new String[] { TipoErrRichAnnulVers.ITEM_IN_CORSO_DI_ANNUL.name(),
+ TipoErrRichAnnulVers.ITEM_RIFERITO.name(), TipoErrRichAnnulVers.ITEM_VERSATA_IN_DATA_RICH.name(),
+ TipoErrRichAnnulVers.STATO_CONSERV_NON_AMMESSO.name() };
}
}
@@ -899,6 +932,10 @@ public enum TiParte {
ANNO, CLASSIF, PROGR_FASC, PROGR_SUB_FASC
}
+ public enum TiStatoSesioneVers {
+ CHIUSA_OK, CHIUSA_ERR
+ }
+
//
public class Flag {
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/FlagConverter.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/FlagConverter.java
index e4bc2a9..cfad3e4 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/FlagConverter.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/FlagConverter.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.ws.utils;
/**
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashCalculator.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashCalculator.java
index cda833b..be1c46f 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashCalculator.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashCalculator.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -12,6 +29,7 @@
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashUtility.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashUtility.java
index 296ad3c..39a4d82 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashUtility.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/HashUtility.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,15 +22,17 @@
*/
package it.eng.parer.ws.utils;
-import it.eng.parer.ws.utils.CostantiDB.TipiHash;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.parer.ws.utils.CostantiDB.TipiHash;
+
/**
*
* @author fioravanti_f
@@ -22,6 +41,10 @@ public class HashUtility {
private static final Logger logger = LoggerFactory.getLogger(HashUtility.class);
+ private HashUtility() {
+ throw new IllegalStateException("Utility class");
+ }
+
public static Hashresult calculate(InputStream is) throws NoSuchAlgorithmException, IOException {
MessageDigest mdMd5 = MessageDigest.getInstance(TipiHash.MD5.descrivi());
MessageDigest mdSha1 = MessageDigest.getInstance(TipiHash.SHA_1.descrivi());
@@ -35,12 +58,12 @@ public static Hashresult calculate(InputStream is) throws NoSuchAlgorithmExcepti
int BUFFER_SIZE = 10 * 1024 * 1024;
try {
- logger.debug("Provider md5" + mdMd5.getProvider());
- logger.debug("Provider sha1" + mdSha1.getProvider());
- logger.debug("Provider sha224" + mdSha224.getProvider());
- logger.debug("Provider sha256" + mdSha256.getProvider());
- logger.debug("Provider sha384" + mdSha384.getProvider());
- logger.debug("Provider sha512" + mdSha512.getProvider());
+ logger.debug("Provider md5 {}", mdMd5.getProvider());
+ logger.debug("Provider sha1 {}", mdSha1.getProvider());
+ logger.debug("Provider sha224 {}", mdSha224.getProvider());
+ logger.debug("Provider sha256 {}", mdSha256.getProvider());
+ logger.debug("Provider sha384 {}", mdSha384.getProvider());
+ logger.debug("Provider sha512 {}", mdSha512.getProvider());
byte[] buffer = new byte[BUFFER_SIZE];
while ((letti = is.read(buffer)) != -1) {
mdMd5.update(buffer, 0, letti);
@@ -49,7 +72,7 @@ public static Hashresult calculate(InputStream is) throws NoSuchAlgorithmExcepti
mdSha256.update(buffer, 0, letti);
mdSha384.update(buffer, 0, letti);
mdSha512.update(buffer, 0, letti);
- logger.trace("Letti " + letti + " bytes");
+ logger.trace("Letti {} bytes", letti);
}
} finally {
IOUtils.closeQuietly(is);
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Hashresult.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Hashresult.java
index 0b4d03f..f1ff952 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Hashresult.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/Hashresult.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/JAXBUtils.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/JAXBUtils.java
index 671b387..56d07c5 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/JAXBUtils.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/JAXBUtils.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
package it.eng.parer.ws.utils;
import javax.xml.bind.JAXBElement;
@@ -10,7 +27,12 @@
*/
public class JAXBUtils {
- // standard di estrazione valore stringa di un elemento opzionale con nillable=true
+ private JAXBUtils() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ // standard di estrazione valore stringa di un elemento opzionale con
+ // nillable=true
// default null if black or null or not present
public static String getStringValFromJAXBElement(JAXBElement node) {
return node != null && !node.isNil() && StringUtils.isNotBlank(node.getValue()) ? node.getValue() : null;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeyOrdUtility.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeyOrdUtility.java
index 3b10410..d94bc09 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeyOrdUtility.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeyOrdUtility.java
@@ -1,12 +1,26 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.eng.parer.ws.utils;
-import it.eng.parer.ws.dto.CSChiave;
-import it.eng.parer.ws.dto.RispostaControlli;
-import it.eng.parer.ws.versamento.dto.ConfigRegAnno;
import java.util.Arrays;
import java.util.Objects;
import java.util.regex.Matcher;
@@ -14,6 +28,10 @@
import org.apache.commons.lang3.StringUtils;
+import it.eng.parer.ws.dto.CSChiave;
+import it.eng.parer.ws.dto.RispostaControlli;
+import it.eng.parer.ws.versamento.dto.ConfigRegAnno;
+
/**
*
* @author Fioravanti_F
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeySizeUtility.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeySizeUtility.java
index 140e3ca..a899b6e 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeySizeUtility.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/KeySizeUtility.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,13 +22,12 @@
*/
package it.eng.parer.ws.utils;
-import it.eng.parer.entity.constraint.AroCompUrnCalc.TiUrn;
+import java.util.Date;
+
import it.eng.parer.ws.dto.CSChiave;
import it.eng.parer.ws.dto.CSVersatore;
import it.eng.parer.ws.utils.Costanti.CategoriaDocumento;
-import java.util.Date;
-
/**
*
* @author fioravanti_f
@@ -46,11 +62,11 @@ public void setTpiRootArkVers(String tpiRootArkVers) {
}
- public final static int MAX_LEN_REGISTRO_IN_CHIAVEORD = 75;
+ public static final int MAX_LEN_REGISTRO_IN_CHIAVEORD = 75;
//
- public final static int MAX_LEN_CHIAVEORD = 100;
- public final static int MAX_LEN_URN = 254;
- public final static int MAX_LEN_FILENAME_ARK = 254;
+ public static final int MAX_LEN_CHIAVEORD = 100;
+ public static final int MAX_LEN_URN = 254;
+ public static final int MAX_LEN_FILENAME_ARK = 254;
//
private int maxLenNumero = 0;
private int lenURN = 0;
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/LogSessioneUtils.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/LogSessioneUtils.java
index 69ad222..c8ff5b1 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/LogSessioneUtils.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/LogSessioneUtils.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -17,7 +34,11 @@
public class LogSessioneUtils {
//
- private final static int DS_ERR_MAX_LEN = 1024;
+ private static final int DS_ERR_MAX_LEN = 1024;
+
+ private LogSessioneUtils() {
+ throw new IllegalStateException("Utility class");
+ }
public static Date getDatePart(Date date) {
Calendar cal = Calendar.getInstance();
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSBundle.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSBundle.java
index b07d69e..96e5118 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSBundle.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSBundle.java
@@ -1,3 +1,19 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
/*
* (written by Francesco Fioravanti)
@@ -58,7 +74,6 @@ private static MessaggiWSCache lookupCacheRef() {
try {
return (MessaggiWSCache) new InitialContext().lookup("java:app/sacerws-ejb/MessaggiWSCache");
} catch (NamingException ex) {
- log.error("Errore lookup dei messaggi {}", ExceptionUtils.getRootCauseMessage(ex), ex);
throw new SacerWsRuntimeException(
"Errore lookup singleton dei messaggi " + ExceptionUtils.getRootCauseMessage(ex),
SacerWsErrorCategory.INTERNAL_ERROR);
@@ -1213,6 +1228,11 @@ private static String getDefaultErrorMessage(String key, Object... params) {
*/
public static final String DATISPEC_003_001 = "DATISPEC-003-001";
+ /**
+ * {0} {1}: I dati specifici attesi non coincidono con l''XSD
+ */
+ public static final String DATISPEC_003_002 = "DATISPEC-003-002";
+
/**
* {0} {1}: La versione di dati specifici {2} indicata per il tipo {0} {3} non esiste.
*/
@@ -1271,6 +1291,20 @@ private static String getDefaultErrorMessage(String key, Object... params) {
*/
public static final String PROFNORM_001_004 = "PROFNORM-001-004";
+ /**
+ * {0} {1}: Esiste un xsd di profilo normativo associato a {2} attivo alla data di versamento. Eliminazione non
+ * consentita per l''elemento ProfiloNormativo.
+ */
+ public static final String PROFNORM_001_005 = "PROFNORM-001-005";
+ /**
+ * {0} {1}: Profilo Normativo non presente nell''xml del SIP per l''Unità Documentaria. Eliminazione non consentita
+ * per l''elemento ProfiloNormativo.
+ */
+ public static final String PROFNORM_001_006 = "PROFNORM-001-006";
+ /**
+ * Necessario valorizzare xml del Profilo Normativo per la versione specificata
+ */
+ public static final String PROFNORM_001_007 = "PROFNORM-001-007";
/**
* Componente {0}: per questo componente è obbligatorio indicare l''hash
*/
@@ -1704,5 +1738,4 @@ private static String getDefaultErrorMessage(String key, Object... params) {
public static final String SERVIZI_USR_005 = "SERVIZI-USR-005";
//
-
}
diff --git a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSCache.java b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSCache.java
index fbc3278..b5558c3 100644
--- a/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSCache.java
+++ b/sacerws-ejb/src/main/java/it/eng/parer/ws/utils/MessaggiWSCache.java
@@ -1,3 +1,20 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of
+ * the GNU Affero General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License along with this program.
+ * If not, see .
+ */
+
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -5,14 +22,14 @@
*/
package it.eng.parer.ws.utils;
-import it.eng.parer.entity.DecErrSacer;
-import it.eng.parer.exception.SacerWsRuntimeException;
-import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
-
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Stream;
+
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Singleton;
@@ -24,6 +41,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import it.eng.parer.entity.DecErrSacer;
+import it.eng.parer.exception.ParerErrorCategory.SacerWsErrorCategory;
+import it.eng.parer.exception.SacerWsRuntimeException;
+
/**
*
* @author fioravanti_f
@@ -47,7 +68,8 @@ public void initSingleton() {
List list = messaggiWSHelper.caricaListaErrori();
errorMap = new HashMap<>();
for (DecErrSacer err : list) {
- errorMap.put(err.getCdErr(), err.getDsErr());
+ errorMap.put(err.getCdErr(), StringEscapeUtils.unescapeJava(err.getDsErr())); // Unescape java-like
+ // every message
}
} catch (RuntimeException ex) {
throw new SacerWsRuntimeException(ex, SacerWsErrorCategory.INTERNAL_ERROR);
@@ -57,12 +79,31 @@ public void initSingleton() {
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public String getString(String key) {
- return StringEscapeUtils.unescapeJava(errorMap.get(key));
+ return errorMap.get(key);
}
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public String getString(String key, Object... params) {
- return StringEscapeUtils.unescapeJava(MessageFormat.format(errorMap.get(key), params));
+ return MessageFormat.format(errorMap.get(key), cleanTextContent(params));
+ }
+
+ /*
+ * Clean up placeholder (from XML)
+ */
+ private Object[] cleanTextContent(Object... params) {
+ List