From e69cfbc923f720e48dccf80ef576b8a4b64085a0 Mon Sep 17 00:00:00 2001 From: Julien Gribonvald Date: Thu, 31 Oct 2024 13:47:09 +0100 Subject: [PATCH 1/2] feat: main app initial import --- .gitignore | 3 + .sdkmanrc | 3 + NOTICE | 25 +- README.md | 4 +- doc/dev.md | 22 +- etc/header.template | 4 +- pom.xml | 48 ++- .../ws/config/PronoteWSConfiguration.java | 154 -------- .../ws/config/WebSecurityConfiguration.java | 47 --- .../bean/AppIndexEducationProperties.java | 55 --- .../ws/config/bean/AppSecurityProperties.java | 40 -- .../fr/recia/pronote/ws/dao/ILdapDao.java | 40 -- .../ws/dao/impl/EleveAttributesMapper.java | 126 ------- .../impl/EtablissementAttributesMapper.java | 83 ---- .../pronote/ws/dao/impl/LdapAttributes.java | 48 --- .../pronote/ws/dao/impl/LdapDaoImpl.java | 145 ------- .../dao/impl/PersonnelAttributesMapper.java | 69 ---- .../dao/impl/ProfesseurAttributesMapper.java | 69 ---- .../dao/impl/ResponsableAttributesMapper.java | 95 ----- .../conteneurimportchiffre/ImportChiffre.java | 122 ------ .../conteneurimportchiffre/ObjectFactory.java | 62 --- .../conteneurimportchiffre/package-info.java | 27 -- .../ws/model/rapprochementsso/Civilite.java | 57 --- .../ws/model/rapprochementsso/Civilites.java | 72 ---- .../ws/model/rapprochementsso/Eleve.java | 160 -------- .../ws/model/rapprochementsso/Eleves.java | 104 ------ .../model/rapprochementsso/Etablissement.java | 100 ----- .../rapprochementsso/Etablissements.java | 87 ----- .../rapprochementsso/EtablissementsGeres.java | 103 ----- .../model/rapprochementsso/Nomenclatures.java | 81 ---- .../model/rapprochementsso/ObjectFactory.java | 198 ---------- .../rapprochementsso/PartenaireIndex.java | 353 ------------------ .../ws/model/rapprochementsso/Personnel.java | 89 ----- .../ws/model/rapprochementsso/Personnels.java | 83 ---- .../ws/model/rapprochementsso/Professeur.java | 96 ----- .../model/rapprochementsso/Professeurs.java | 84 ----- .../model/rapprochementsso/Responsable.java | 135 ------- .../model/rapprochementsso/Responsables.java | 94 ----- .../model/rapprochementsso/package-info.java | 24 -- .../ws/service/PronoteExportService.java | 28 -- .../ws/service/PronoteExportServiceImpl.java | 292 --------------- .../pronote/ws/service/bean/Civilite.java | 47 --- .../pronote/ws/service/bean/IIDMapper.java | 35 -- .../ws/service/bean/impl/IDMapperImpl.java | 56 --- .../ws/service/util/CertificateUtils.java | 89 ----- .../ws/service/util/XmlValidatorImpl.java | 55 --- .../recia/pronote/ws/service/util/Zlib.java | 71 ---- .../ws/web/rest/PronoteAPIResource.java | 143 ------- .../ent/api/SIENTAPIApplication.java} | 40 +- .../ent/api/config/SIENTAPIConfiguration.java | 106 ++++++ .../ent/api/config/SecurityConfiguration.java | 73 ++++ .../si/ent/api/config/bean/APIClient.java | 87 +++++ .../ent/api/config/bean/ApiEndpoints.java} | 27 +- .../api}/config/bean/AppConfProperties.java | 40 +- .../api}/config/bean/AppInfosProperties.java | 14 +- .../ent/api}/config/bean/Cleaner.java | 8 +- .../ent/api}/config/bean/LDAPProperties.java | 33 +- .../config/security/ApiKeyAuthentication.java | 41 ++ .../config/security/AuthenticationFilter.java | 57 +++ .../security/AuthenticationService.java | 75 ++++ .../fr/recia/si/ent/api/dao/ILdapDao.java | 33 ++ .../si/ent/api/dao/impl/LdapAttributes.java | 129 +++++++ .../si/ent/api/dao/impl/LdapDaoImpl.java | 85 +++++ .../api/dao/impl/PersonAttributesMapper.java | 81 ++++ .../ent/api}/model/erreur/Erreur.java | 8 +- .../ent/api}/model/erreur/ErreurWrapper.java | 8 +- .../api}/model/util/ZonedDateTimeAdapter.java | 8 +- .../ent/api/service/SIENTAPIService.java} | 30 +- .../ent/api/service/SIENTAPIServiceImpl.java | 106 ++++++ .../api}/service/bean/IExtractOpaqueId.java | 14 +- .../api}/service/bean/IExtractUIDFromDN.java | 8 +- .../ent/api}/service/bean/IStringCleaner.java | 8 +- .../bean/impl/ExtractOpaqueIdImpl.java | 46 ++- .../bean/impl/ExtractUIDFromDNImpl.java | 10 +- .../impl/RegexGroupReplacementCleaner.java | 12 +- .../AuthorizedResourceException.java | 8 +- .../exception/CustomRestRequestException.java | 8 +- .../exception/ListRequestErrorException.java | 8 +- .../exception/NotFoundIdException.java | 10 +- .../ws => si/ent/api}/service/util/Pair.java | 8 +- .../ent/api}/web/rest/HealthCheck.java | 8 +- .../si/ent/api/web/rest/SIENTAPIResource.java | 71 ++++ .../exception/GlobalExceptionHandler.java | 16 +- src/main/resources/application.properties | 2 +- src/main/resources/application.yml | 10 +- src/main/resources/logback-spring.xml | 5 +- src/main/resources/logback.xml | 4 +- .../resources/xsd/ConteneurImportChiffre.xsd | 51 --- src/main/resources/xsd/RapprochementSSO.xsd | 211 ----------- .../ent/api/SIENTAPIApplicationTests.java} | 10 +- .../ent/api}/web/rest/HealthCheckTest.java | 20 +- .../ws => si/ent/api}/web/rest/TestUtil.java | 14 +- src/test/resources/application-test.yml | 37 ++ 93 files changed, 1263 insertions(+), 4452 deletions(-) create mode 100644 .sdkmanrc delete mode 100644 src/main/java/fr/recia/pronote/ws/config/PronoteWSConfiguration.java delete mode 100644 src/main/java/fr/recia/pronote/ws/config/WebSecurityConfiguration.java delete mode 100644 src/main/java/fr/recia/pronote/ws/config/bean/AppIndexEducationProperties.java delete mode 100644 src/main/java/fr/recia/pronote/ws/config/bean/AppSecurityProperties.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/ILdapDao.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/EleveAttributesMapper.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/EtablissementAttributesMapper.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/LdapAttributes.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/LdapDaoImpl.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/PersonnelAttributesMapper.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/ProfesseurAttributesMapper.java delete mode 100644 src/main/java/fr/recia/pronote/ws/dao/impl/ResponsableAttributesMapper.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ImportChiffre.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ObjectFactory.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/package-info.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilite.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilites.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleve.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleves.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissement.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissements.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/EtablissementsGeres.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Nomenclatures.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/ObjectFactory.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/PartenaireIndex.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnel.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnels.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeur.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeurs.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsable.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsables.java delete mode 100644 src/main/java/fr/recia/pronote/ws/model/rapprochementsso/package-info.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/PronoteExportService.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/PronoteExportServiceImpl.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/bean/Civilite.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/bean/IIDMapper.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/bean/impl/IDMapperImpl.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/util/CertificateUtils.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/util/XmlValidatorImpl.java delete mode 100644 src/main/java/fr/recia/pronote/ws/service/util/Zlib.java delete mode 100644 src/main/java/fr/recia/pronote/ws/web/rest/PronoteAPIResource.java rename src/main/java/fr/recia/{pronote/ws/PronoteWsApplication.java => si/ent/api/SIENTAPIApplication.java} (70%) create mode 100644 src/main/java/fr/recia/si/ent/api/config/SIENTAPIConfiguration.java create mode 100644 src/main/java/fr/recia/si/ent/api/config/SecurityConfiguration.java create mode 100644 src/main/java/fr/recia/si/ent/api/config/bean/APIClient.java rename src/main/java/fr/recia/{pronote/ws/service/bean/Sexe.java => si/ent/api/config/bean/ApiEndpoints.java} (50%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/config/bean/AppConfProperties.java (52%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/config/bean/AppInfosProperties.java (87%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/config/bean/Cleaner.java (85%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/config/bean/LDAPProperties.java (75%) create mode 100644 src/main/java/fr/recia/si/ent/api/config/security/ApiKeyAuthentication.java create mode 100644 src/main/java/fr/recia/si/ent/api/config/security/AuthenticationFilter.java create mode 100644 src/main/java/fr/recia/si/ent/api/config/security/AuthenticationService.java create mode 100644 src/main/java/fr/recia/si/ent/api/dao/ILdapDao.java create mode 100644 src/main/java/fr/recia/si/ent/api/dao/impl/LdapAttributes.java create mode 100644 src/main/java/fr/recia/si/ent/api/dao/impl/LdapDaoImpl.java create mode 100644 src/main/java/fr/recia/si/ent/api/dao/impl/PersonAttributesMapper.java rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/model/erreur/Erreur.java (93%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/model/erreur/ErreurWrapper.java (91%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/model/util/ZonedDateTimeAdapter.java (88%) rename src/main/java/fr/recia/{pronote/ws/config/bean/Filter.java => si/ent/api/service/SIENTAPIService.java} (51%) create mode 100644 src/main/java/fr/recia/si/ent/api/service/SIENTAPIServiceImpl.java rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/bean/IExtractOpaqueId.java (80%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/bean/IExtractUIDFromDN.java (81%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/bean/IStringCleaner.java (82%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/bean/impl/ExtractOpaqueIdImpl.java (52%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/bean/impl/ExtractUIDFromDNImpl.java (88%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/bean/impl/RegexGroupReplacementCleaner.java (89%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/exception/AuthorizedResourceException.java (83%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/exception/CustomRestRequestException.java (83%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/exception/ListRequestErrorException.java (90%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/exception/NotFoundIdException.java (78%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/service/util/Pair.java (81%) rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/web/rest/HealthCheck.java (89%) create mode 100644 src/main/java/fr/recia/si/ent/api/web/rest/SIENTAPIResource.java rename src/main/java/fr/recia/{pronote/ws => si/ent/api}/web/rest/exception/GlobalExceptionHandler.java (90%) delete mode 100644 src/main/resources/xsd/ConteneurImportChiffre.xsd delete mode 100644 src/main/resources/xsd/RapprochementSSO.xsd rename src/test/java/fr/recia/{pronote/ws/PronoteWsApplicationTests.java => si/ent/api/SIENTAPIApplicationTests.java} (83%) rename src/test/java/fr/recia/{pronote/ws => si/ent/api}/web/rest/HealthCheckTest.java (90%) rename src/test/java/fr/recia/{pronote/ws => si/ent/api}/web/rest/TestUtil.java (93%) create mode 100644 src/test/resources/application-test.yml diff --git a/.gitignore b/.gitignore index 356d551..001f1c7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ target/ !**/src/main/** !**/src/test/** logs +**/application-*.yml +!**/application-ci.yml +**.orig ### STS ### .apt_generated diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 0000000..b8a16ed --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1,3 @@ +# Enable auto-env through the sdkman_auto_env config +# Add key=value pairs of SDKs to use below +java=11.0.22-tem diff --git a/NOTICE b/NOTICE index 5c25b34..d510362 100644 --- a/NOTICE +++ b/NOTICE @@ -17,23 +17,20 @@ under the License. This project includes: Apache Commons Codec under Apache License, Version 2.0 - Apache HttpClient under Apache License, Version 2.0 - Apache HttpCore under Apache License, Version 2.0 Apache Log4j API under Apache License, Version 2.0 Apache Log4j to SLF4J Adapter under Apache License, Version 2.0 + asm under BSD-3-Clause ASM based accessors helper used by json-smart under The Apache Software License, Version 2.0 - ASM Core under BSD - AspectJ weaver under Eclipse Public License - v 1.0 AssertJ fluent assertions under Apache License, Version 2.0 Byte Buddy (without dependencies) under Apache License, Version 2.0 Byte Buddy agent under Apache License, Version 2.0 ClassMate under Apache License, Version 2.0 - esco-pronote-ws under Apache License, Version 2.0 + esco-si-ent-api under Apache License, Version 2.0 Hamcrest under BSD License 3 Hibernate Validator Engine under Apache License 2.0 Jackson datatype: jdk8 under The Apache Software License, Version 2.0 Jackson datatype: JSR310 under The Apache Software License, Version 2.0 - Jackson module: JAXB Annotations under The Apache Software License, Version 2.0 + Jackson module: Jakarta XML Bind Annotations (jakarta.xml.bind) under The Apache Software License, Version 2.0 Jackson-annotations under The Apache Software License, Version 2.0 Jackson-core under The Apache Software License, Version 2.0 jackson-databind under The Apache Software License, Version 2.0 @@ -42,8 +39,8 @@ This project includes: Jakarta Activation API jar under EDL 1.0 Jakarta Annotations API under EPL 2.0 or GPL2 w/ CPE Jakarta Bean Validation API under Apache License 2.0 - Jakarta Expression Language 3.0 under EPL 2.0 or GPL2 w/ CPE Jakarta XML Binding API under Eclipse Distribution License - v 1.0 + Java Servlet API under CDDL + GPLv2 with classpath exception JBoss Logging 3 under Apache License, version 2.0 JSON library from Android SDK under Apache License 2.0 JSON Small and Fast Parser under The Apache Software License, Version 2.0 @@ -81,10 +78,7 @@ This project includes: Spring Web MVC under Apache License, Version 2.0 spring-boot under Apache License, Version 2.0 spring-boot-autoconfigure under Apache License, Version 2.0 - spring-boot-configuration-processor under Apache License, Version 2.0 - spring-boot-devtools under Apache License, Version 2.0 spring-boot-starter under Apache License, Version 2.0 - spring-boot-starter-aop under Apache License, Version 2.0 spring-boot-starter-data-ldap under Apache License, Version 2.0 spring-boot-starter-json under Apache License, Version 2.0 spring-boot-starter-logging under Apache License, Version 2.0 @@ -95,12 +89,15 @@ This project includes: spring-boot-starter-web under Apache License, Version 2.0 spring-boot-test under Apache License, Version 2.0 spring-boot-test-autoconfigure under Apache License, Version 2.0 - spring-ldap-core under The Apache Software License, Version 2.0 - spring-security-config under The Apache Software License, Version 2.0 - spring-security-core under The Apache Software License, Version 2.0 - spring-security-web under The Apache Software License, Version 2.0 + spring-ldap-core under Apache License, Version 2.0 + spring-security-config under Apache License, Version 2.0 + spring-security-core under Apache License, Version 2.0 + spring-security-crypto under Apache License, Version 2.0 + spring-security-test under Apache License, Version 2.0 + spring-security-web under Apache License, Version 2.0 Stax2 API under The BSD License tomcat-embed-core under Apache License, Version 2.0 + tomcat-embed-el under Apache License, Version 2.0 tomcat-embed-websocket under Apache License, Version 2.0 Woodstox under The Apache License, Version 2.0 diff --git a/README.md b/README.md index d1d735b..650a685 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# Pronote-WS -Application serveur REST produisant les flux XML d'alimentation de pronote +# SI-ENT-API +Application serveur REST fournissant des accès API sur les données du SI ENT diff --git a/doc/dev.md b/doc/dev.md index 330143d..f6874b5 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -1,18 +1,24 @@ -# to add NOTICE +## to add NOTICE 'mvn notice:check' Checks that a NOTICE file exists and that its content match what would be generated. 'mvn notice:generate' Generates a new NOTICE file, replacing any existing NOTICE file. -# to add licence headers +## to add licence headers 'mvn license:check' verify if some files miss license header 'mvn license:format' add the license header when missing. If a header is existing, it is updated to the new one. 'mvn license:remove' remove existing license header -# Actions on RSA public key provided by Index Education -# Le certificat fourni est au format SSH2 et sans doute généré par Putty - une conversion permet de le rendre lisible plus facilement -ssh-keygen -i -f /PATH/ClePubIndexEducation.pub -m RFC4716> /PATH/ClePubIndexEducation.id_rsa.pub -# in production mainly set in system properties the property for log directory else it will log in $catalina_base +## in production mainly set in system properties the property for log directory else it will log in $catalina_base -Dlogback.logfileDirectory=/PATH/ -# using local profile -'./mvnw clean -Dspring.profiles.active=local -Dspring.config.import="./src/main/resources/application-local.yml" clean package' +## Compile and Deploy +'./mvnw clean package deploy -Dspring.profiles.active=local -Dspring.config.import="$PATH/application-local.yml"' + +## Running with spring-boot locally +'./mvnw clean compile spring-boot:run -Dspring-boot.run.profiles=local -Dspring.config.import="$PATH/application-local.yml"' + +## Exemples de commandes +### curl pour test +`curl --location --request GET 'http://127.0.0.1:8080/si-ent-api/api/childrensOf/ID' --header 'X-API-KEY: xxxxxxxxxxx' -H "Accept: application/json"` +### génération d'une clé +`node -e "console.log(require('node:crypto').randomBytes(128).toString('hex'))"` \ No newline at end of file diff --git a/etc/header.template b/etc/header.template index 2284dee..6bcd7a4 100644 --- a/etc/header.template +++ b/etc/header.template @@ -1,5 +1,5 @@ -Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ -@Author (C) 2020 Julien Gribonvald +Copyright (C) ${license.git.copyrightExistenceYears} GIP-RECIA https://www.recia.fr/ +@Author (C) ${license.git.copyrightCreationYear} Julien Gribonvald Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pom.xml b/pom.xml index 0ca8bb0..3fcdac6 100644 --- a/pom.xml +++ b/pom.xml @@ -7,16 +7,17 @@ 2.7.18 - fr.recia.pronote.ws - esco-pronote-ws - 0.0.5-SNAPSHOT + fr.recia.api + esco-si-ent-api + 0.0.1-SNAPSHOT war - esco-pronote-ws - Application REST Web-service permettant de transmettre un export utile à l'alimentation des identifiants ENT dans pronote + esco-si-ent-api + API REST permettant de fournir des données issues du SI ENT, configurable par properties et accès sécurisés UTF-8 11 + 4.5 @@ -31,9 +32,9 @@ - scm:git:ssh://git@github.com/GIP-RECIA/Pronote-WS.git - scm:git:ssh://git@github.com/GIP-RECIA/Pronote-WS.git - https://github.com/GIP-RECIA/Pronote-WS.git + scm:git:ssh://git@github.com/GIP-RECIA/SI-ENT-API.git + scm:git:ssh://git@github.com/GIP-RECIA/SI-ENT-API.git + https://github.com/GIP-RECIA/SI-ENT-API.git HEAD @@ -95,6 +96,11 @@ spring-boot-starter-tomcat provided + + org.apache.tomcat.embed + tomcat-embed-el + provided + org.springframework.boot spring-boot-starter-test @@ -107,6 +113,7 @@ + @@ -157,6 +164,9 @@ license-maven-plugin 4.5 + + 2020 +
etc/header.template
@@ -174,11 +184,18 @@
true
+ + + com.mycila + license-maven-plugin-git + ${license-maven-plugin.version} + + org.jasig.maven - maven-notice-plugin - 1.1.0 + notice-maven-plugin + 2.0.0 etc/NOTICE.template @@ -198,6 +215,7 @@ maven-war-plugin + 3.4.0 **/application-*.yml true @@ -206,6 +224,16 @@ org.springframework.boot spring-boot-maven-plugin + + -Djava.rmi.server.hostname=localhost -Xdebug -Duser.timezone="Europe/Paris" + -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms2G -Xmx3G + + + org.projectlombok + lombok + + +
diff --git a/src/main/java/fr/recia/pronote/ws/config/PronoteWSConfiguration.java b/src/main/java/fr/recia/pronote/ws/config/PronoteWSConfiguration.java deleted file mode 100644 index 9f58870..0000000 --- a/src/main/java/fr/recia/pronote/ws/config/PronoteWSConfiguration.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.config; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.InvalidKeyException; -import java.security.PublicKey; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import fr.recia.pronote.ws.config.bean.AppConfProperties; -import fr.recia.pronote.ws.config.bean.AppIndexEducationProperties; -import fr.recia.pronote.ws.config.bean.LDAPProperties; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; -import fr.recia.pronote.ws.service.bean.IExtractUIDFromDN; -import fr.recia.pronote.ws.service.bean.IStringCleaner; -import fr.recia.pronote.ws.service.bean.impl.ExtractOpaqueIdImpl; -import fr.recia.pronote.ws.service.bean.impl.ExtractUIDFromDNImpl; -import fr.recia.pronote.ws.service.bean.impl.RegexGroupReplacementCleaner; -import fr.recia.pronote.ws.service.util.CertificateUtils; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; -import org.springframework.core.io.ClassPathResource; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.core.support.LdapContextSource; - -@Configuration -@Slf4j -public class PronoteWSConfiguration { - - @Autowired - private LDAPProperties ldapProperties; - - @Autowired - private AppIndexEducationProperties indexEducationProperties; - - @Autowired - private AppConfProperties appConfProperties; - - @Bean - public IExtractOpaqueId opaqueIdExtractor() { - return new ExtractOpaqueIdImpl(ldapProperties.getUserOpaqueIdPattern()); - } - - @Bean - public IExtractUIDFromDN uidFromDNExtractor() { - return new ExtractUIDFromDNImpl(ldapProperties.getUserUidExtractorPattern()); - } - - @Bean - public List etablissementNameCleaner() { - final List cleaners = new ArrayList<>(); - ldapProperties.getEtablissementNameProcessors().forEach(cleaner -> cleaners.add(new RegexGroupReplacementCleaner(cleaner))); - return cleaners; - } - - @Bean - public LdapContextSource contextSource() { - final LdapContextSource contextSource = new LdapContextSource(); - - contextSource.setAnonymousReadOnly(ldapProperties.isAnonimousReadOnly()); - contextSource.setBase(ldapProperties.getBase()); - contextSource.setUrl(ldapProperties.getUrl()); - contextSource.setUserDn(ldapProperties.getUserDn()); - contextSource.setPassword(ldapProperties.getPassword()); - contextSource.setPooled(ldapProperties.isPooled()); - - return contextSource; - } - - @Bean - public LdapTemplate ldapTemplate() throws Exception{ - final LdapTemplate ldapTemplate = new LdapTemplate(); - ldapTemplate.setContextSource(contextSource()); - ldapTemplate.setDefaultCountLimit(ldapProperties.getCountLimit()); - ldapTemplate.setDefaultTimeLimit(ldapProperties.getTimeout()); - - return ldapTemplate; - } - - @Bean - @Lazy - public PublicKey publicKey() { - try { - final File file = Paths.get(indexEducationProperties.getPublicKeyPath()).toFile(); - final String content = Files.readString(file.toPath()); - log.debug("key read: {}", content); - return CertificateUtils.parseSSHPublicKey(content); - } catch (IOException | InvalidKeyException e) { - log.error("Impossible de lire la clé publique d'Index Education sous le chemin {}", indexEducationProperties.getPublicKeyPath(), e); - throw new IllegalStateException( - String.format("Impossible de lire la clé publique d'Index Education sous le chemin %s", indexEducationProperties.getPublicKeyPath()), e); - } - } - - @Bean - public File debugDataPath() { - final File fs = Paths.get(appConfProperties.getDebugDataFilePath()).toFile(); - if (fs.isDirectory() && fs.canWrite()) return fs; - - throw new IllegalStateException("Le chemin spécifié pour générer les fichiers de débug n'est pas un répertoire autorisé en écriture."); - } - - @Bean - public Map> regroupementStructures() { - Map> grouped = new HashMap<>(); - appConfProperties.getStructuresRegroupees().forEach((key, values) -> { - values.replaceAll(String::toUpperCase); - Set concatened = new HashSet<>(values); - concatened.add(key.toUpperCase()); - grouped.put(key.toUpperCase(), concatened); - }); - return grouped; - } - - @Bean - public File importChiffreXSD() throws IOException { - final File fs = new ClassPathResource("xsd/ConteneurImportChiffre.xsd").getFile(); - if (fs.exists() && fs.isFile() && fs.canRead()) return fs; - - throw new IllegalStateException("Le fichier xsd/RapprochementSSO.xsd n'a pas été trouvé."); - } - - @Bean - public File rapprochementSSOXSD() throws IOException { - final File fs = new ClassPathResource("xsd/RapprochementSSO.xsd").getFile(); - if (fs.exists() && fs.isFile() && fs.canRead()) return fs; - - throw new IllegalStateException("Le fichier xsd/RapprochementSSO.xsd n'a pas été trouvé."); - } -} diff --git a/src/main/java/fr/recia/pronote/ws/config/WebSecurityConfiguration.java b/src/main/java/fr/recia/pronote/ws/config/WebSecurityConfiguration.java deleted file mode 100644 index 3134416..0000000 --- a/src/main/java/fr/recia/pronote/ws/config/WebSecurityConfiguration.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.config; - -import fr.recia.pronote.ws.config.bean.AppSecurityProperties; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -@Configuration -@EnableWebSecurity -@Slf4j -public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { - - @Autowired - private AppSecurityProperties securityProperties; - - @Override - protected void configure(HttpSecurity http) throws Exception { - String hasIpAddress = "hasIpAddress('127.0.0.1') or hasIpAddress('::1')"; - for (String ip: securityProperties.getAuthorizedIPAccess()) { - hasIpAddress += " or hasIpAddress('" + ip + "')"; - } - - log.debug("WebSecurity configuration: autorize access on '/api/**' for {}", hasIpAddress); - - http.csrf().disable().exceptionHandling().and().authorizeRequests().antMatchers("/**").access(hasIpAddress) - .and().httpBasic().disable(); - - } -} diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/AppIndexEducationProperties.java b/src/main/java/fr/recia/pronote/ws/config/bean/AppIndexEducationProperties.java deleted file mode 100644 index 0ba2945..0000000 --- a/src/main/java/fr/recia/pronote/ws/config/bean/AppIndexEducationProperties.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.config.bean; - -import javax.annotation.PostConstruct; -import javax.validation.constraints.NotBlank; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; - - -@ConfigurationProperties(prefix = "app.index-education-params") -@Data -@Validated -@Slf4j -public class AppIndexEducationProperties { - - @NotBlank - private String partenaireName; - - @NotBlank - private String partenaireId; - - @NotBlank - private String description; - - @NotBlank - private String publicKeyPath; - - @NotBlank - private String versionConteneur; - - @NotBlank - private String protocol = "CAS"; - - @PostConstruct - public void debug() { - log.debug("AppIndexEducationProperties {}", this); - } -} diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/AppSecurityProperties.java b/src/main/java/fr/recia/pronote/ws/config/bean/AppSecurityProperties.java deleted file mode 100644 index 6d7c508..0000000 --- a/src/main/java/fr/recia/pronote/ws/config/bean/AppSecurityProperties.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.config.bean; - -import java.util.List; - -import javax.annotation.PostConstruct; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.validation.annotation.Validated; - - -@ConfigurationProperties(prefix = "app.security") -@Validated -@Data -@Slf4j -public class AppSecurityProperties { - - private List authorizedIPAccess; - - @PostConstruct - public void debug() { - log.debug("AppSecurityProperties {}", this); - } -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/ILdapDao.java b/src/main/java/fr/recia/pronote/ws/dao/ILdapDao.java deleted file mode 100644 index 00c4779..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/ILdapDao.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.dao; - -import java.util.List; - -import javax.validation.constraints.NotBlank; - -import fr.recia.pronote.ws.model.rapprochementsso.Eleve; -import fr.recia.pronote.ws.model.rapprochementsso.Etablissement; -import fr.recia.pronote.ws.model.rapprochementsso.Personnel; -import fr.recia.pronote.ws.model.rapprochementsso.Professeur; -import fr.recia.pronote.ws.model.rapprochementsso.Responsable; -import fr.recia.pronote.ws.service.bean.IIDMapper; - -public interface ILdapDao { - - List findAllEleves(@NotBlank final String idEtablissement, final IIDMapper userMapper); - - List findAllPersonnels(@NotBlank final String idEtablissement, final IIDMapper userMapper); - - List findAllProfesseurs(@NotBlank final String idEtablissement, final IIDMapper userMapper); - - List finadAllResponsables(@NotBlank final String idEtablissement, final IIDMapper userMapper); - - Etablissement findOneEtablissementById(@NotBlank final String id, final IIDMapper structMapper); -} \ No newline at end of file diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/EleveAttributesMapper.java b/src/main/java/fr/recia/pronote/ws/dao/impl/EleveAttributesMapper.java deleted file mode 100644 index a09a7b5..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/EleveAttributesMapper.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -/** - * - */ -package fr.recia.pronote.ws.dao.impl; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -import javax.naming.NamingException; -import javax.validation.constraints.NotNull; - -import fr.recia.pronote.ws.model.rapprochementsso.Eleve; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; -import fr.recia.pronote.ws.service.bean.IExtractUIDFromDN; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import fr.recia.pronote.ws.service.exception.NotFoundIdException; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.util.Assert; - -@Data -@AllArgsConstructor -@Slf4j -public class EleveAttributesMapper implements ContextMapper { - - @NotNull - private IIDMapper userMapper; - - @NotNull - private IExtractOpaqueId extractOpaqueId; - - @NotNull - private IExtractUIDFromDN extractUIDFromDN; - - @NotNull - private Pattern responsablePattern; - - @Override - public Eleve mapFromContext(Object ctx) throws NamingException { - Eleve eleve = new Eleve(); - - DirContextAdapter context = (DirContextAdapter) ctx; - - final String uid = context.getStringAttribute(LdapAttributes.UID); - log.debug("Ldap to Object Mapping for uid '{}'", uid); - Assert.hasText(uid, "L'uid ne peut pas être vide !"); - eleve.setIdent(userMapper.getPronoteID(uid)); - Assert.isTrue(eleve.getIdent() >= 0, "Le pronote Id ne peut pas être vide !"); - - eleve.setIdPartenaire(extractOpaqueId.getOpaqueId(context)); - Assert.hasText(eleve.getIdPartenaire(), "L'id Opaque ne peut être vide !"); - - eleve.setNom(context.getStringAttribute(LdapAttributes.SN)); - Assert.hasText(eleve.getNom(), "Le sn ne peut être vide !"); - eleve.setPrenom(context.getStringAttribute(LdapAttributes.GIVEN_NAME)); - Assert.hasText(eleve.getNom(), "Le givenName ne peut être vide !"); - - String date = context.getStringAttribute(LdapAttributes.ENT_PERSON_DATE_NAISSANCE); - Assert.hasText(date, "La date de naissance ne peut être vide"); - SimpleDateFormat formatterFrom = new SimpleDateFormat("dd/MM/yyyy"); - SimpleDateFormat formatterTo = new SimpleDateFormat("yyyy-MM-dd"); - try { - eleve.setDateNaissance(formatterTo.format(formatterFrom.parse(date))); - } catch (ParseException e) { - log.error("Impossible de parser la date", e); - } - - final String[] parents = context.getStringAttributes(LdapAttributes.ENT_ELEVE_PERS_REL_ELEVE); - List resp = new ArrayList<>(); - if (parents != null) { - for (String parent : parents) { - if (responsablePattern.matcher(parent).matches()) { - final String parentUid = extractUIDFromDN.getUidFromDN(parent); - try { - resp.add(new Eleve.Responsable(userMapper.findPronoteID(parentUid))); - } catch (NotFoundIdException e) { - log.warn("Personne en relation avec l'uid {} non trouvée dans les références", parentUid); - } - } - } - } - eleve.setResponsable(resp); - - /* - eleve.setCodePostal(context.getStringAttribute(ENT_PERSON_POSTAL_CODE)); - eleve.setVille(context.getStringAttribute(ENT_PERSON_VILLE)); - final String adresse = (context.getStringAttribute(LdapAttributes.ENT_PERSON_ADRESSE)); - if (StringUtils.hasText(adresse)) { - final String[] addr = adresse.split("\\$"); - eleve.setAdresse1(addr[0]); - if (addr.length > 1) - eleve.setAdresse2(addr[1]); - if (addr.length > 2) - eleve.setAdresse3(addr[2]); - if (addr.length > 3) - eleve.setAdresse4(addr[3]); - } - eleve.setPays(context.getStringAttribute(ENT_PERSON_PAYS)); - eleve.setSexe(); - */ - - return eleve; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/EtablissementAttributesMapper.java b/src/main/java/fr/recia/pronote/ws/dao/impl/EtablissementAttributesMapper.java deleted file mode 100644 index 6ed5a95..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/EtablissementAttributesMapper.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -/** - * - */ -package fr.recia.pronote.ws.dao.impl; - -import java.util.List; - -import javax.naming.NamingException; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -import fr.recia.pronote.ws.model.rapprochementsso.Etablissement; -import fr.recia.pronote.ws.model.rapprochementsso.ObjectFactory; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import fr.recia.pronote.ws.service.bean.IStringCleaner; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.util.Assert; - -@Data -@AllArgsConstructor -@Slf4j -public class EtablissementAttributesMapper implements ContextMapper { - - @NotNull - private IIDMapper structMapper; - - @NotEmpty - private List structNameCleaner; - - private static final ObjectFactory objectFactory = new ObjectFactory(); - - @Override - public Etablissement mapFromContext(Object ctx) throws NamingException { - Etablissement struct = new Etablissement(); - - DirContextAdapter context = (DirContextAdapter) ctx; - - final String siren = context.getStringAttribute(LdapAttributes.ENTSTRUCTURE_IDENT_ATTRIBUTE); - log.debug("Ldap to Object Mapping for siren '{}'", siren); - Assert.hasText(siren, "Le siren ne peut pas être vide !"); - struct.setIdent(structMapper.getPronoteID(siren)); - Assert.isTrue(struct.getIdent() >= 0, "Le pronote Id ne peut pas être vide !"); - - struct.setNumero(context.getStringAttribute(LdapAttributes.ENTSTRUCTURE_UAI).toUpperCase()); - Assert.hasText(struct.getNumero(), "L'UAI ne peut pas être vide !"); - - String cleanedName = null; - for (IStringCleaner cleaner : structNameCleaner) { - final String toClean = cleanedName != null ? cleanedName : context.getStringAttribute(LdapAttributes.ENTSTRUCTURE_NOM_COURANT); - cleanedName = cleaner.clean(toClean); - } - struct.setNom(cleanedName); - - struct.setCodePostal(context.getStringAttribute(LdapAttributes.POSTAL_CODE)); - struct.setVille(context.getStringAttribute(LdapAttributes.VILLE)); - struct.setAdresse1(context.getStringAttribute(LdapAttributes.STREET)); - - Assert.isTrue(struct.getIdent() >= 0, "No ident attribute found in LDAP for UniteAdministrativeImmatriculee !"); - Assert.hasText(struct.getNumero(), "No numero attribute found in LDAP for UniteAdministrativeImmatriculee !"); - Assert.hasText(struct.getNom(), "No nom attribute found in LDAP for UniteAdministrativeImmatriculee !"); - return struct; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/LdapAttributes.java b/src/main/java/fr/recia/pronote/ws/dao/impl/LdapAttributes.java deleted file mode 100644 index df4f57d..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/LdapAttributes.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.dao.impl; - -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class LdapAttributes { - public static final String POSTAL_CODE = "postalCode"; - public static final String VILLE = "l"; - public static final String STREET = "street"; - - public static final String ENTSTRUCTURE_IDENT_ATTRIBUTE = "ENTStructureSIREN"; - public static final String ENTSTRUCTURE_UAI = "ENTStructureUAI"; - public static final String ENTSTRUCTURE_NOM_COURANT = "ENTStructureNomCourant"; - public static final String UID = "uid"; - public static final String SN = "sn"; - public static final String GIVEN_NAME = "givenName"; - public static final String ENT_PERSON_ADRESSE = "ENTPersonAdresse"; - public static final String ENT_PERSON_CODE_POSTAL = "ENTPersonCodePostal"; - public static final String ENT_PERSON_VILLE = "ENTPersonVille"; - public static final String ENT_PERSON_PAYS = "ENTPersonPays"; - public static final String ENT_PERSON_DATE_NAISSANCE = "ENTPersonDateNaissance"; - public static final String ENT_ELEVE_PERS_REL_ELEVE = "ENTElevePersRelEleve"; - public static final String PERSONAL_TITLE = "personalTitle"; - public static final String ESCO_PERSON_EXTERNAL_IDS = "ESCOPersonExternalIds"; - - public static final Set STRUCTURE_ATTRS = - Stream.of(POSTAL_CODE, VILLE, STREET, ENTSTRUCTURE_IDENT_ATTRIBUTE, ENTSTRUCTURE_NOM_COURANT, ENTSTRUCTURE_UAI).collect(Collectors.toSet()); - - public static final Set PERSON_ATTRS = - Stream.of(UID, SN, GIVEN_NAME, PERSONAL_TITLE, ENT_PERSON_CODE_POSTAL, ENT_PERSON_VILLE, ENT_PERSON_ADRESSE, ENT_PERSON_DATE_NAISSANCE, ENT_PERSON_PAYS, ENT_ELEVE_PERS_REL_ELEVE, ESCO_PERSON_EXTERNAL_IDS) - .collect(Collectors.toSet()); -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/LdapDaoImpl.java b/src/main/java/fr/recia/pronote/ws/dao/impl/LdapDaoImpl.java deleted file mode 100644 index 3f4a10f..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/LdapDaoImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.dao.impl; - -import java.util.List; -import java.util.regex.Pattern; - -import javax.annotation.PostConstruct; - -import fr.recia.pronote.ws.config.bean.LDAPProperties; -import fr.recia.pronote.ws.dao.ILdapDao; -import fr.recia.pronote.ws.model.rapprochementsso.Eleve; -import fr.recia.pronote.ws.model.rapprochementsso.Etablissement; -import fr.recia.pronote.ws.model.rapprochementsso.Personnel; -import fr.recia.pronote.ws.model.rapprochementsso.Professeur; -import fr.recia.pronote.ws.model.rapprochementsso.Responsable; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; -import fr.recia.pronote.ws.service.bean.IExtractUIDFromDN; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import fr.recia.pronote.ws.service.bean.IStringCleaner; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.LdapTemplate; -import org.springframework.ldap.filter.Filter; -import org.springframework.ldap.filter.HardcodedFilter; -import org.springframework.ldap.query.LdapQuery; -import org.springframework.ldap.query.LdapQueryBuilder; -import org.springframework.stereotype.Service; - -@Service -@Data -@AllArgsConstructor -@NoArgsConstructor -@Slf4j -public class LdapDaoImpl implements ILdapDao { - - @Autowired - private LdapTemplate ldapTemplate; - - @Autowired - private LDAPProperties ldapProperties; - - @Autowired - private IExtractOpaqueId extractOpaqueId; - - @Autowired - private IExtractUIDFromDN extractUIDFromDN; - - @Autowired - private List structNameCleaner; - - private Pattern responsablePattern; - - @PostConstruct - private void setUp(){ - this.responsablePattern = Pattern.compile(this.ldapProperties.getAutorizedResponsablePattern()); - } - - @Override - public List findAllEleves(final String idEtablissement, IIDMapper userMapper) { - final Filter filter= new HardcodedFilter(String.format(ldapProperties.getFilters().getEleve(), idEtablissement)); - if (log.isDebugEnabled()) { - log.debug("LDAP filter applied : " + filter); - } - ContextMapper mapper = new EleveAttributesMapper(userMapper, extractOpaqueId, extractUIDFromDN, responsablePattern); - LdapQuery query = LdapQueryBuilder.query() - .attributes(LdapAttributes.PERSON_ATTRS.toArray(new String[LdapAttributes.PERSON_ATTRS.size()])) - .base(ldapProperties.getPeopleRootDn()).filter(filter); - - return ldapTemplate.search(query, mapper); - } - - @Override - public List findAllPersonnels(final String idEtablissement, IIDMapper userMapper) { - final Filter filter= new HardcodedFilter(String.format(ldapProperties.getFilters().getPersonnel(), idEtablissement)); - if (log.isDebugEnabled()) { - log.debug("LDAP filter applied : " + filter); - } - ContextMapper mapper = new PersonnelAttributesMapper(userMapper, extractOpaqueId); - LdapQuery query = LdapQueryBuilder.query() - .attributes(LdapAttributes.PERSON_ATTRS.toArray(new String[LdapAttributes.PERSON_ATTRS.size()])) - .base(ldapProperties.getPeopleRootDn()).filter(filter); - - return ldapTemplate.search(query, mapper); - } - - @Override - public List findAllProfesseurs(final String idEtablissement, IIDMapper userMapper) { - final Filter filter= new HardcodedFilter(String.format(ldapProperties.getFilters().getProfesseur(), idEtablissement)); - if (log.isDebugEnabled()) { - log.debug("LDAP filter applied : " + filter); - } - ContextMapper mapper = new ProfesseurAttributesMapper(userMapper, extractOpaqueId); - LdapQuery query = LdapQueryBuilder.query() - .attributes(LdapAttributes.PERSON_ATTRS.toArray(new String[LdapAttributes.PERSON_ATTRS.size()])) - .base(ldapProperties.getPeopleRootDn()).filter(filter); - - return ldapTemplate.search(query, mapper); - } - - @Override - public List finadAllResponsables(final String idEtablissement, IIDMapper userMapper) { - final Filter filter= new HardcodedFilter(String.format(ldapProperties.getFilters().getResponsable(), idEtablissement)); - if (log.isDebugEnabled()) { - log.debug("LDAP filter applied : " + filter); - } - ContextMapper mapper = new ResponsableAttributesMapper(userMapper, extractOpaqueId); - LdapQuery query = LdapQueryBuilder.query() - .attributes(LdapAttributes.PERSON_ATTRS.toArray(new String[LdapAttributes.PERSON_ATTRS.size()])) - .base(ldapProperties.getPeopleRootDn()).filter(filter); - - return ldapTemplate.search(query, mapper); - } - - @Override - public Etablissement findOneEtablissementById(final String idEtablissement, IIDMapper structMapper) { - final Filter filter= new HardcodedFilter(String.format(ldapProperties.getFilters().getEtablissement(), idEtablissement)); - if (log.isDebugEnabled()) { - log.debug("LDAP filter applied : " + filter); - } - ContextMapper mapper = new EtablissementAttributesMapper(structMapper, structNameCleaner); - LdapQuery query = LdapQueryBuilder.query() - .attributes(LdapAttributes.STRUCTURE_ATTRS.toArray(new String[LdapAttributes.STRUCTURE_ATTRS.size()])) - .base(ldapProperties.getStructureRootDn()).filter(filter); - - return ldapTemplate.searchForObject(query, mapper); - } -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/PersonnelAttributesMapper.java b/src/main/java/fr/recia/pronote/ws/dao/impl/PersonnelAttributesMapper.java deleted file mode 100644 index db1a9dd..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/PersonnelAttributesMapper.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -/** - * - */ -package fr.recia.pronote.ws.dao.impl; - -import javax.naming.NamingException; -import javax.validation.constraints.NotNull; - -import fr.recia.pronote.ws.model.rapprochementsso.Personnel; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.util.Assert; - -@Data -@AllArgsConstructor -@Slf4j -public class PersonnelAttributesMapper implements ContextMapper { - - @NotNull - private IIDMapper userMapper; - - @NotNull - private IExtractOpaqueId extractOpaqueId; - - - @Override - public Personnel mapFromContext(Object ctx) throws NamingException { - Personnel personnel = new Personnel(); - - DirContextAdapter context = (DirContextAdapter) ctx; - - final String uid = context.getStringAttribute(LdapAttributes.UID); - log.debug("Ldap to Object Mapping for uid '{}'", uid); - Assert.hasText(uid, "L'uid ne peut pas être vide !"); - personnel.setIdent(userMapper.getPronoteID(uid)); - Assert.isTrue(personnel.getIdent() >= 0, "Le pronote Id ne peut pas être vide !"); - - personnel.setIdPartenaire(extractOpaqueId.getOpaqueId(context)); - Assert.hasText(personnel.getIdPartenaire(), "L'id Opaque ne peut être vide !"); - - personnel.setNom(context.getStringAttribute(LdapAttributes.SN)); - Assert.hasText(personnel.getNom(), "Le sn ne peut être vide !"); - personnel.setPrenom(context.getStringAttribute(LdapAttributes.GIVEN_NAME)); - Assert.hasText(personnel.getNom(), "Le givenName ne peut être vide !"); - - return personnel; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/ProfesseurAttributesMapper.java b/src/main/java/fr/recia/pronote/ws/dao/impl/ProfesseurAttributesMapper.java deleted file mode 100644 index 1bacd6e..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/ProfesseurAttributesMapper.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -/** - * - */ -package fr.recia.pronote.ws.dao.impl; - -import javax.naming.NamingException; -import javax.validation.constraints.NotNull; - -import fr.recia.pronote.ws.model.rapprochementsso.Professeur; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.util.Assert; - -@Data -@AllArgsConstructor -@Slf4j -public class ProfesseurAttributesMapper implements ContextMapper { - - @NotNull - private IIDMapper userMapper; - - @NotNull - private IExtractOpaqueId extractOpaqueId; - - - @Override - public Professeur mapFromContext(Object ctx) throws NamingException { - Professeur professeur = new Professeur(); - - DirContextAdapter context = (DirContextAdapter) ctx; - - final String uid = context.getStringAttribute(LdapAttributes.UID); - log.debug("Ldap to Object Mapping for uid '{}'", uid); - Assert.hasText(uid, "L'uid ne peut pas être vide !"); - professeur.setIdent(userMapper.getPronoteID(uid)); - Assert.isTrue(professeur.getIdent() >= 0, "Le pronote Id ne peut pas être vide !"); - - professeur.setIdPartenaire(extractOpaqueId.getOpaqueId(context)); - Assert.hasText(professeur.getIdPartenaire(), "L'id Opaque ne peut être vide !"); - - professeur.setNom(context.getStringAttribute(LdapAttributes.SN)); - Assert.hasText(professeur.getNom(), "Le sn ne peut être vide !"); - professeur.setPrenom(context.getStringAttribute(LdapAttributes.GIVEN_NAME)); - Assert.hasText(professeur.getNom(), "Le givenName ne peut être vide !"); - - return professeur; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/dao/impl/ResponsableAttributesMapper.java b/src/main/java/fr/recia/pronote/ws/dao/impl/ResponsableAttributesMapper.java deleted file mode 100644 index 6b1d57f..0000000 --- a/src/main/java/fr/recia/pronote/ws/dao/impl/ResponsableAttributesMapper.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -/** - * - */ -package fr.recia.pronote.ws.dao.impl; - -import javax.naming.NamingException; -import javax.validation.constraints.NotNull; - -import fr.recia.pronote.ws.model.rapprochementsso.ObjectFactory; -import fr.recia.pronote.ws.model.rapprochementsso.Responsable; -import fr.recia.pronote.ws.service.bean.Civilite; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.ldap.core.ContextMapper; -import org.springframework.ldap.core.DirContextAdapter; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - -@Data -@AllArgsConstructor -@Slf4j -public class ResponsableAttributesMapper implements ContextMapper { - - @NotNull - private IIDMapper userMapper; - - @NotNull - private IExtractOpaqueId extractOpaqueId; - - private static final ObjectFactory objectFactory = new ObjectFactory(); - - - @Override - public Responsable mapFromContext(Object ctx) throws NamingException { - Responsable responsable = new Responsable(); - - DirContextAdapter context = (DirContextAdapter) ctx; - - final String uid = context.getStringAttribute(LdapAttributes.UID); - log.debug("Ldap to Object Mapping for uid '{}'", uid); - Assert.hasText(uid, "L'uid ne peut pas être vide !"); - responsable.setIdent(userMapper.getPronoteID(uid)); - Assert.isTrue(responsable.getIdent() >= 0, "Le pronote Id ne peut pas être vide !"); - - responsable.setIdPartenaire(extractOpaqueId.getOpaqueId(context)); - Assert.hasText(responsable.getIdPartenaire(), "L'id Opaque ne peut être vide !"); - - responsable.setNom(context.getStringAttribute(LdapAttributes.SN)); - Assert.hasText(responsable.getNom(), "Le sn ne peut être vide !"); - responsable.setPrenom(context.getStringAttribute(LdapAttributes.GIVEN_NAME)); - Assert.hasText(responsable.getNom(), "Le givenName ne peut être vide !"); - - final String civilite = context.getStringAttribute(LdapAttributes.PERSONAL_TITLE); - if (StringUtils.hasText(civilite)) { - responsable.setCivilite(new Responsable.Civilite(Civilite.valueOf(civilite).getCode())); - } else { - responsable.setCivilite(new Responsable.Civilite(Civilite.undefined.getCode())); - } - responsable.setCodePostal(context.getStringAttribute(LdapAttributes.ENT_PERSON_CODE_POSTAL)); - responsable.setVille(context.getStringAttribute(LdapAttributes.ENT_PERSON_VILLE)); - responsable.setPays(context.getStringAttribute(LdapAttributes.ENT_PERSON_PAYS)); - final String adresse = (context.getStringAttribute(LdapAttributes.ENT_PERSON_ADRESSE)); - if (StringUtils.hasText(adresse)) { - final String[] addr = adresse.split("\\$"); - responsable.setAdresse1(addr[0]); - if (addr.length > 1) - responsable.setAdresse2(addr[1]); - if (addr.length > 2) - responsable.setAdresse3(addr[2]); - if (addr.length > 3) - responsable.setAdresse4(addr[3]); - } - - return responsable; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ImportChiffre.java b/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ImportChiffre.java deleted file mode 100644 index 02e1603..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ImportChiffre.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -// -// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 -// Voir http://java.sun.com/xml/jaxb -// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. -// Généré le : 2020.06.22 à 05:48:27 PM CEST -// - - -package fr.recia.pronote.ws.model.conteneurimportchiffre; - -import java.io.Serializable; -import java.time.ZonedDateTime; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.XmlSchemaType; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import fr.recia.pronote.ws.model.util.ZonedDateTimeAdapter; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Partenaire" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="Cle">
- *           <complexType>
- *             <simpleContent>
- *               <extension base="<http://www.w3.org/2001/XMLSchema>string">
- *               </extension>
- *             </simpleContent>
- *           </complexType>
- *         </element>
- *         <element name="Contenu" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
- *         <element name="Verification" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
- *         <element name="DateExport" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
- *         <element name="UAI" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *       <attribute name="Version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>2M1Mme9 AVENUE DE PARIS41206ROMORANTIN LANTHENAY CEDEX194100178000120410017WLGT\sCLAUDE DE FRANC\sS194100178000127282250002020124151150FRIDAY339DECEMBERISOiso8601GIPRECIACAS
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace = "http://www.index-education.com/containeurimportchiffreV1", propOrder = { - "Partenaire", - "Description", - "Cle", - "Contenu", - "Verification", - "DateExport", - "UAI" -}) -@XmlRootElement(name = "ImportChiffre", namespace = "http://www.index-education.com/containeurimportchiffreV1") -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ImportChiffre implements Serializable{ - - @JacksonXmlProperty(localName = "Partenaire") - @XmlElement(name = "Partenaire", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - protected String partenaire; - @JacksonXmlProperty(localName = "Description") - @XmlElement(name = "Description", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - protected String description; - @JacksonXmlProperty(localName = "Cle") - @XmlElement(name = "Cle", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - protected String cle; - @JacksonXmlProperty(localName = "Contenu") - @XmlElement(name = "Contenu", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - protected String contenu; - @JacksonXmlProperty(localName = "Verification") - @XmlElement(name = "Verification", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - protected byte[] verification; - @JacksonXmlProperty(localName = "DateExport") - @XmlElement(name = "DateExport", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - @XmlSchemaType(name = "dateTime") - @XmlJavaTypeAdapter(ZonedDateTimeAdapter.class) - protected ZonedDateTime dateExport; - @JacksonXmlProperty(localName = "UAI") - @XmlElement(name = "UAI", namespace = "http://www.index-education.com/containeurimportchiffreV1", required = true) - protected String uai; - @JacksonXmlProperty(localName = "Version") - @XmlAttribute(name = "Version", required = true) - protected String version; - - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ObjectFactory.java b/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ObjectFactory.java deleted file mode 100644 index d98443f..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/ObjectFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -// -// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 -// Voir http://java.sun.com/xml/jaxb -// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. -// Généré le : 2020.06.22 à 05:48:27 PM CEST -// - - -package fr.recia.pronote.ws.model.conteneurimportchiffre; - -import jakarta.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the fr.recia.pronote.ws.model.conteneurimportchiffre package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: fr.recia.pronote.ws.model.conteneurimportchiffre - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link ImportChiffre } - * - */ - public ImportChiffre createImportChiffre() { - return new ImportChiffre(); - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/package-info.java b/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/package-info.java deleted file mode 100644 index 2bb1ebb..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/conteneurimportchiffre/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -// -// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 -// Voir http://java.sun.com/xml/jaxb -// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. -// Généré le : 2020.06.22 à 05:48:27 PM CEST -// - -@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://www.index-education.com/containeurimportchiffreV1", - elementFormDefault = XmlNsForm.QUALIFIED, attributeFormDefault = XmlNsForm.UNQUALIFIED) -package fr.recia.pronote.ws.model.conteneurimportchiffre; - -import jakarta.xml.bind.annotation.XmlNsForm; \ No newline at end of file diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilite.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilite.java deleted file mode 100644 index 3b22a3d..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilite.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlType; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *       <attribute name="Libelle" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -public class Civilite { - - @XmlAttribute(name = "Ident", required = true) - protected long ident; - @XmlAttribute(name = "Libelle", required = true) - protected String libelle; - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilites.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilites.java deleted file mode 100644 index 3e00aeb..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Civilites.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Civilite" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                 <attribute name="Libelle" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "civilite" -}) -public class Civilites { - - @JacksonXmlElementWrapper(useWrapping = false) - @XmlElement(name = "Civilite", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List civilites = new ArrayList<>(); - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleve.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleve.java deleted file mode 100644 index efcbdfa..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleve.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import fr.recia.pronote.ws.service.bean.Sexe; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Responsable" maxOccurs="unbounded" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *       <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DateNaissance" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
- *       <attribute name="Sexe">
- *         <simpleType>
- *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *             <enumeration value="Masculin"/>
- *             <enumeration value="Feminin"/>
- *           </restriction>
- *         </simpleType>
- *       </attribute>
- *       <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *       <attribute name="NumeroNational" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "responsable" -}) -public class Eleve { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Responsable") - @XmlElement(name = "Responsable", namespace = "http://www.index-education.com/rapprochementssoV2.0") - protected List responsable = new ArrayList<>(); - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - @JacksonXmlProperty(localName = "Nom") - @XmlAttribute(name = "Nom", required = true) - protected String nom; - @JacksonXmlProperty(localName = "Prenom") - @XmlAttribute(name = "Prenom", required = true) - protected String prenom; - @JacksonXmlProperty(localName = "DateNaissance") - @XmlAttribute(name = "DateNaissance", required = true) - protected String dateNaissance; - @JacksonXmlProperty(localName = "Sexe") - @XmlAttribute(name = "Sexe") - protected Sexe sexe; - @JacksonXmlProperty(localName = "ID_Partenaire") - @XmlAttribute(name = "ID_Partenaire", required = true) - protected String idPartenaire; - @JacksonXmlProperty(localName = "NumeroNational") - @XmlAttribute(name = "NumeroNational") - protected String numeroNational; - @XmlAttribute(name = "Adresse1") - protected String adresse1; - @XmlAttribute(name = "Adresse2") - protected String adresse2; - @XmlAttribute(name = "Adresse3") - protected String adresse3; - @XmlAttribute(name = "Adresse4") - protected String adresse4; - @XmlAttribute(name = "CodePostal") - protected String codePostal; - @XmlAttribute(name = "Ville") - protected String ville; - @XmlAttribute(name = "Pays") - protected String pays; - - /** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @Data - @NoArgsConstructor - @AllArgsConstructor - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "") - public static class Responsable { - - @XmlAttribute(name = "Ident", required = true) - protected long ident; - - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleves.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleves.java deleted file mode 100644 index 93520bd..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Eleves.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Eleve" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Responsable" maxOccurs="unbounded" minOccurs="0">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                 <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="DateNaissance" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
- *                 <attribute name="Sexe">
- *                   <simpleType>
- *                     <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *                       <enumeration value="Masculin"/>
- *                       <enumeration value="Feminin"/>
- *                     </restriction>
- *                   </simpleType>
- *                 </attribute>
- *                 <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                 <attribute name="NumeroNational" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "eleve" -}) -public class Eleves { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Eleve") - @XmlElement(name = "Eleve", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List eleves = new ArrayList(); - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissement.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissement.java deleted file mode 100644 index b38fbc4..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissement.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *       <attribute name="Numero" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TelSecretariat" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="TelScolarite" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Fax" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="EMail" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -public class Etablissement { - - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - @JacksonXmlProperty(localName = "Numero") - @XmlAttribute(name = "Numero", required = true) - protected String numero; - @JacksonXmlProperty(localName = "Nom") - @XmlAttribute(name = "Nom", required = true) - protected String nom; - @XmlAttribute(name = "Adresse1") - protected String adresse1; - @XmlAttribute(name = "Adresse2") - protected String adresse2; - @XmlAttribute(name = "Adresse3") - protected String adresse3; - @XmlAttribute(name = "Adresse4") - protected String adresse4; - @XmlAttribute(name = "CodePostal") - protected String codePostal; - @XmlAttribute(name = "Ville") - protected String ville; - @XmlAttribute(name = "Pays") - protected String pays; - @JacksonXmlProperty(localName = "TelSecretariat") - @XmlAttribute(name = "TelSecretariat") - protected String telSecretariat; - @JacksonXmlProperty(localName = "TelScolarite") - @XmlAttribute(name = "TelScolarite") - protected String telScolarite; - @JacksonXmlProperty(localName = "Fax") - @XmlAttribute(name = "Fax") - protected String fax; - @JacksonXmlProperty(localName = "EMail") - @XmlAttribute(name = "EMail") - protected String eMail; -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissements.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissements.java deleted file mode 100644 index 74a8e82..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Etablissements.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Etablissement" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                 <attribute name="Numero" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="TelSecretariat" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="TelScolarite" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Fax" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="EMail" type="{http://www.w3.org/2001/XMLSchema}string" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "etablissement" -}) -public class Etablissements { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Etablissement") - @XmlElement(name = "Etablissement", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List etablissements = new ArrayList<>(); - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/EtablissementsGeres.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/EtablissementsGeres.java deleted file mode 100644 index 6054d1e..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/EtablissementsGeres.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Etablissement" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "etablissement" -}) -public class EtablissementsGeres { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Etablissement") - @XmlElement(name = "Etablissement", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List etablissements = new ArrayList<>(); - - /** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @Data - @NoArgsConstructor - @AllArgsConstructor - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "") - public static class Etablissement { - - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Nomenclatures.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Nomenclatures.java deleted file mode 100644 index b25c170..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Nomenclatures.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Civilites" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Civilite" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                           <attribute name="Libelle" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "civilites" -}) -public class Nomenclatures { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Civilites") - @XmlElement(name = "Civilites", namespace = "http://www.index-education.com/rapprochementssoV2.0") - protected Civilites civilites; - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/ObjectFactory.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/ObjectFactory.java deleted file mode 100644 index 2a78af2..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/ObjectFactory.java +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -// -// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 -// Voir http://java.sun.com/xml/jaxb -// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. -// Généré le : 2020.06.22 à 05:46:06 PM CEST -// - - -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the fr.recia.pronote.ws.model.rapprochementsso package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: fr.recia.pronote.ws.model.rapprochementsso - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link PartenaireIndex } - * - */ - public PartenaireIndex createPARTENAIREINDEX() { - return new PartenaireIndex(); - } - - /** - * Create an instance of {@link Eleves } - * - */ - public Eleves createPARTENAIREINDEXEleves() { - return new Eleves(); - } - - /** - * Create an instance of {@link Eleve } - * - */ - public Eleve createPARTENAIREINDEXElevesEleve() { - return new Eleve(); - } - - /** - * Create an instance of {@link Responsables } - * - */ - public Responsables createPARTENAIREINDEXResponsables() { - return new Responsables(); - } - - /** - * Create an instance of {@link Responsable } - * - */ - public Responsable createPARTENAIREINDEXResponsablesResponsable() { - return new Responsable(); - } - - /** - * Create an instance of {@link Professeurs } - * - */ - public Professeurs createPARTENAIREINDEXProfesseurs() { - return new Professeurs(); - } - - /** - * Create an instance of {@link Personnels } - * - */ - public Personnels createPARTENAIREINDEXPersonnels() { - return new Personnels(); - } - - /** - * Create an instance of {@link EtablissementsGeres } - * - */ - public EtablissementsGeres createPARTENAIREINDEXEtablissementsGeres() { - return new EtablissementsGeres(); - } - - /** - * Create an instance of {@link Etablissements } - * - */ - public Etablissements createPARTENAIREINDEXEtablissements() { - return new Etablissements(); - } - - /** - * Create an instance of {@link Nomenclatures } - * - */ - public Nomenclatures createPARTENAIREINDEXNomenclatures() { - return new Nomenclatures(); - } - - /** - * Create an instance of {@link Civilites } - * - */ - public Civilites createPARTENAIREINDEXNomenclaturesCivilites() { - return new Civilites(); - } - - /** - * Create an instance of {@link Eleve.Responsable } - * - */ - public Eleve.Responsable createPARTENAIREINDEXElevesEleveResponsable() { - return new Eleve.Responsable(); - } - - /** - * Create an instance of {@link Responsable.Civilite } - * - */ - public Responsable.Civilite createPARTENAIREINDEXResponsablesResponsableCivilite() { - return new Responsable.Civilite(); - } - - /** - * Create an instance of {@link Professeur } - * - */ - public Professeur createPARTENAIREINDEXProfesseursProfesseur() { - return new Professeur(); - } - - /** - * Create an instance of {@link Personnel } - * - */ - public Personnel createPARTENAIREINDEXPersonnelsPersonnel() { - return new Personnel(); - } - - /** - * Create an instance of {@link EtablissementsGeres.Etablissement } - * - */ - public EtablissementsGeres.Etablissement createPARTENAIREINDEXEtablissementsGeresEtablissement() { - return new EtablissementsGeres.Etablissement(); - } - - /** - * Create an instance of {@link Etablissement } - * - */ - public Etablissement createPARTENAIREINDEXEtablissementsEtablissement() { - return new Etablissement(); - } - - /** - * Create an instance of {@link Civilite } - * - */ - public Civilite createPARTENAIREINDEXNomenclaturesCivilitesCivilite() { - return new Civilite(); - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/PartenaireIndex.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/PartenaireIndex.java deleted file mode 100644 index b9126b2..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/PartenaireIndex.java +++ /dev/null @@ -1,353 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -// -// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 -// Voir http://java.sun.com/xml/jaxb -// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. -// Généré le : 2020.06.22 à 05:46:06 PM CEST -// - - -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.time.ZonedDateTime; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; -import jakarta.xml.bind.annotation.XmlSchemaType; -import jakarta.xml.bind.annotation.XmlType; -import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import fr.recia.pronote.ws.model.util.ZonedDateTimeAdapter; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Nomenclatures" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Civilites" minOccurs="0">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <sequence>
- *                             <element name="Civilite" maxOccurs="unbounded">
- *                               <complexType>
- *                                 <complexContent>
- *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                                     <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                                     <attribute name="Libelle" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                                   </restriction>
- *                                 </complexContent>
- *                               </complexType>
- *                             </element>
- *                           </sequence>
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="Etablissements">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Etablissement" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                           <attribute name="Numero" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="TelSecretariat" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="TelScolarite" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Fax" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="EMail" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="EtablissementsGeres">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Etablissement" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="Personnels" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Personnel" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                           <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                           <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="Professeurs" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Professeur" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                           <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="DateNaissance" type="{http://www.w3.org/2001/XMLSchema}date" />
- *                           <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                           <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="Responsables" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Responsable" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <sequence>
- *                             <element name="Civilite" minOccurs="0">
- *                               <complexType>
- *                                 <complexContent>
- *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                                     <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                                   </restriction>
- *                                 </complexContent>
- *                               </complexType>
- *                             </element>
- *                           </sequence>
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                           <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                           <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <element name="Eleves" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Eleve" maxOccurs="unbounded">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <sequence>
- *                             <element name="Responsable" maxOccurs="unbounded" minOccurs="0">
- *                               <complexType>
- *                                 <complexContent>
- *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                                     <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                                   </restriction>
- *                                 </complexContent>
- *                               </complexType>
- *                             </element>
- *                           </sequence>
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                           <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="DateNaissance" use="required" type="{http://www.w3.org/2001/XMLSchema}date" />
- *                           <attribute name="Sexe">
- *                             <simpleType>
- *                               <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *                                 <enumeration value="Masculin"/>
- *                                 <enumeration value="Feminin"/>
- *                               </restriction>
- *                             </simpleType>
- *                           </attribute>
- *                           <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                           <attribute name="NumeroNational" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                           <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *       <attribute name="Date" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
- *       <attribute name="Partenaire" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ProtocoleDelegationAuthentification">
- *         <simpleType>
- *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *             <enumeration value="CAS"/>
- *             <enumeration value="ADFS"/>
- *           </restriction>
- *         </simpleType>
- *       </attribute>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace = "http://www.index-education.com/rapprochementssoV2.0", - propOrder = { - "Nomenclatures", - "Etablissements", - "EtablissementsGeres", - "Personnels", - "Professeurs", - "Responsables", - "Eleves" -}) -@XmlRootElement(name = "PARTENAIRE_INDEX", namespace = "http://www.index-education.com/rapprochementssoV2.0") -@Data -@NoArgsConstructor -@AllArgsConstructor -public class PartenaireIndex { - - @XmlElement(name = "Nomenclatures", namespace = "http://www.index-education.com/rapprochementssoV2.0") - @JacksonXmlProperty( localName = "Nomenclatures") - protected Nomenclatures nomenclatures; - @XmlElement(name = "Etablissements", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - @JacksonXmlProperty( localName = "Etablissements") - protected Etablissements etablissements; - @XmlElement(name = "EtablissementsGeres", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - @JacksonXmlProperty( localName = "EtablissementsGeres") - protected EtablissementsGeres etablissementsGeres; - @XmlElement(name = "Personnels", namespace = "http://www.index-education.com/rapprochementssoV2.0") - @JacksonXmlProperty( localName = "Personnels") - protected Personnels personnels; - @XmlElement(name = "Professeurs", namespace = "http://www.index-education.com/rapprochementssoV2.0") - @JacksonXmlProperty( localName = "Professeurs") - protected Professeurs professeurs; - @XmlElement(name = "Responsables", namespace = "http://www.index-education.com/rapprochementssoV2.0") - @JacksonXmlProperty( localName = "Responsables") - protected Responsables responsables; - @XmlElement(name = "Eleves", namespace = "http://www.index-education.com/rapprochementssoV2.0") - @JacksonXmlProperty( localName = "Eleves") - protected Eleves eleves; - @XmlAttribute(name = "Date", required = true) - @XmlSchemaType(name = "dateTime") - @XmlJavaTypeAdapter(ZonedDateTimeAdapter.class) - @JacksonXmlProperty( localName = "Date") - protected ZonedDateTime date; - @XmlAttribute(name = "Partenaire", required = true) - @JacksonXmlProperty( localName = "Partenaire") - protected String partenaire; - @XmlAttribute(name = "ProtocoleDelegationAuthentification") - @JacksonXmlProperty( localName = "ProtocoleDelegationAuthentification") - protected String protocoleDelegationAuthentification; - - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnel.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnel.java deleted file mode 100644 index 92761b5..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnel.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *       <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *       <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -public class Personnel { - - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - @JacksonXmlProperty(localName = "Nom") - @XmlAttribute(name = "Nom", required = true) - protected String nom; - @JacksonXmlProperty(localName = "Prenom") - @XmlAttribute(name = "Prenom", required = true) - protected String prenom; - @JacksonXmlProperty(localName = "ID_Partenaire") - @XmlAttribute(name = "ID_Partenaire", required = true) - protected String idPartenaire; - @XmlAttribute(name = "Adresse1") - protected String adresse1; - @XmlAttribute(name = "Adresse2") - protected String adresse2; - @XmlAttribute(name = "Adresse3") - protected String adresse3; - @XmlAttribute(name = "Adresse4") - protected String adresse4; - @XmlAttribute(name = "CodePostal") - protected String codePostal; - @XmlAttribute(name = "Ville") - protected String ville; - @XmlAttribute(name = "Pays") - protected String pays; - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnels.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnels.java deleted file mode 100644 index af9f17a..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Personnels.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Personnel" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                 <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                 <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "personnel" -}) -public class Personnels { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Personnel") - @XmlElement(name = "Personnel", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List personnels = new ArrayList<>(); - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeur.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeur.java deleted file mode 100644 index cc468dc..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeur.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlSchemaType; -import jakarta.xml.bind.annotation.XmlType; -import javax.xml.datatype.XMLGregorianCalendar; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *       <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="DateNaissance" type="{http://www.w3.org/2001/XMLSchema}date" />
- *       <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *       <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -public class Professeur { - - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - @JacksonXmlProperty(localName = "Nom") - @XmlAttribute(name = "Nom", required = true) - protected String nom; - @JacksonXmlProperty(localName = "Prenom") - @XmlAttribute(name = "Prenom", required = true) - protected String prenom; - @JacksonXmlProperty(localName = "DateNaissance") - @XmlAttribute(name = "DateNaissance") - @XmlSchemaType(name = "date") - protected XMLGregorianCalendar dateNaissance; - @JacksonXmlProperty(localName = "ID_Partenaire") - @XmlAttribute(name = "ID_Partenaire", required = true) - protected String idPartenaire; - @XmlAttribute(name = "Adresse1") - protected String adresse1; - @XmlAttribute(name = "Adresse2") - protected String adresse2; - @XmlAttribute(name = "Adresse3") - protected String adresse3; - @XmlAttribute(name = "Adresse4") - protected String adresse4; - @XmlAttribute(name = "CodePostal") - protected String codePostal; - @XmlAttribute(name = "Ville") - protected String ville; - @XmlAttribute(name = "Pays") - protected String pays; - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeurs.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeurs.java deleted file mode 100644 index f7d18f4..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Professeurs.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Professeur" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                 <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="DateNaissance" type="{http://www.w3.org/2001/XMLSchema}date" />
- *                 <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                 <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "professeur" -}) -public class Professeurs { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Professeur") - @XmlElement(name = "Professeur", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List professeurs = new ArrayList<>(); - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsable.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsable.java deleted file mode 100644 index 067fb81..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsable.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Civilite" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *       <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *       <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "civilite" -}) -public class Responsable { - - @JacksonXmlProperty(localName = "Civilite") - @XmlElement(name = "Civilite", namespace = "http://www.index-education.com/rapprochementssoV2.0") - protected Civilite civilite; - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - @JacksonXmlProperty(localName = "Nom") - @XmlAttribute(name = "Nom", required = true) - protected String nom; - @JacksonXmlProperty(localName = "Prenom") - @XmlAttribute(name = "Prenom", required = true) - protected String prenom; - @JacksonXmlProperty(localName = "ID_Partenaire") - @XmlAttribute(name = "ID_Partenaire", required = true) - protected String idPartenaire; - @XmlAttribute(name = "Adresse1") - protected String adresse1; - @XmlAttribute(name = "Adresse2") - protected String adresse2; - @XmlAttribute(name = "Adresse3") - protected String adresse3; - @XmlAttribute(name = "Adresse4") - protected String adresse4; - @XmlAttribute(name = "CodePostal") - protected String codePostal; - @XmlAttribute(name = "Ville") - protected String ville; - @XmlAttribute(name = "Pays") - protected String pays; - - /** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @Data - @NoArgsConstructor - @AllArgsConstructor - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "") - public static class Civilite { - - @JacksonXmlProperty(localName = "Ident") - @XmlAttribute(name = "Ident", required = true) - protected long ident; - } - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsables.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsables.java deleted file mode 100644 index d63871c..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/Responsables.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.model.rapprochementsso; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - *

Classe Java pour anonymous complex type. - * - *

Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Responsable" maxOccurs="unbounded">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element name="Civilite" minOccurs="0">
- *                     <complexType>
- *                       <complexContent>
- *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                           <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                         </restriction>
- *                       </complexContent>
- *                     </complexType>
- *                   </element>
- *                 </sequence>
- *                 <attribute name="Ident" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}IDENT" />
- *                 <attribute name="Nom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Prenom" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="ID_Partenaire" use="required" type="{http://www.index-education.com/rapprochementssoV2.0}TypeIdentifiantPartenaire" />
- *                 <attribute name="Adresse1" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse2" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse3" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Adresse4" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="CodePostal" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Ville" type="{http://www.w3.org/2001/XMLSchema}string" />
- *                 <attribute name="Pays" type="{http://www.w3.org/2001/XMLSchema}string" />
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "responsable" -}) -public class Responsables { - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Responsable") - @XmlElement(name = "Responsable", namespace = "http://www.index-education.com/rapprochementssoV2.0", required = true) - protected List responsables = new ArrayList<>(); - -} diff --git a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/package-info.java b/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/package-info.java deleted file mode 100644 index ab3959f..0000000 --- a/src/main/java/fr/recia/pronote/ws/model/rapprochementsso/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -// -// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 -// Voir http://java.sun.com/xml/jaxb -// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. -// Généré le : 2020.06.22 à 05:46:06 PM CEST -// - -@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://www.index-education.com/rapprochementssoV2.0", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED) -package fr.recia.pronote.ws.model.rapprochementsso; diff --git a/src/main/java/fr/recia/pronote/ws/service/PronoteExportService.java b/src/main/java/fr/recia/pronote/ws/service/PronoteExportService.java deleted file mode 100644 index 4eab6f8..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/PronoteExportService.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.NoSuchAlgorithmException; - -import com.fasterxml.jackson.core.JsonProcessingException; -import fr.recia.pronote.ws.model.conteneurimportchiffre.ImportChiffre; -import org.xml.sax.SAXException; - -public interface PronoteExportService { - ImportChiffre getPronoteExport(String idEtablissement) throws IOException, NoSuchAlgorithmException, SAXException; -} diff --git a/src/main/java/fr/recia/pronote/ws/service/PronoteExportServiceImpl.java b/src/main/java/fr/recia/pronote/ws/service/PronoteExportServiceImpl.java deleted file mode 100644 index 4c814ba..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/PronoteExportServiceImpl.java +++ /dev/null @@ -1,292 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.PublicKey; -import java.security.SecureRandom; -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; -import java.util.Arrays; -import java.util.Base64; -import java.util.Map; -import java.util.Set; - -import javax.annotation.PostConstruct; -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.KeyGenerator; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.SecretKey; -import javax.crypto.spec.IvParameterSpec; - -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.dataformat.xml.XmlMapper; -import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; -import fr.recia.pronote.ws.config.bean.AppIndexEducationProperties; -import fr.recia.pronote.ws.dao.ILdapDao; -import fr.recia.pronote.ws.model.conteneurimportchiffre.ImportChiffre; -import fr.recia.pronote.ws.model.rapprochementsso.Eleves; -import fr.recia.pronote.ws.model.rapprochementsso.Etablissement; -import fr.recia.pronote.ws.model.rapprochementsso.Etablissements; -import fr.recia.pronote.ws.model.rapprochementsso.EtablissementsGeres; -import fr.recia.pronote.ws.model.rapprochementsso.Nomenclatures; -import fr.recia.pronote.ws.model.rapprochementsso.PartenaireIndex; -import fr.recia.pronote.ws.model.rapprochementsso.Personnels; -import fr.recia.pronote.ws.model.rapprochementsso.Professeurs; -import fr.recia.pronote.ws.model.rapprochementsso.Responsables; -import fr.recia.pronote.ws.service.bean.Civilite; -import fr.recia.pronote.ws.service.bean.IIDMapper; -import fr.recia.pronote.ws.service.bean.impl.IDMapperImpl; -import fr.recia.pronote.ws.service.util.Pair; -import fr.recia.pronote.ws.service.util.XmlValidatorImpl; -import fr.recia.pronote.ws.service.util.Zlib; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import org.xml.sax.SAXException; - -@Service -@Slf4j -public class PronoteExportServiceImpl implements PronoteExportService { - - /** 128 bits /8 => 16 bytes */ - final static int BYTE_SIZE = 16; - - @Autowired - private ILdapDao ldapDao; - - @Autowired - private AppIndexEducationProperties indexEducationProperties; - - @Autowired - private PublicKey publicKey; - - @Autowired - private File debugDataPath; - - @Autowired - @Qualifier("regroupementStructures") - private Map> regroupementStructures; - - @Autowired - private File rapprochementSSOXSD; - - private Nomenclatures nomenclatures; - - private XmlValidatorImpl xmlValidator; - - @PostConstruct - private void setUp() throws SAXException { - nomenclatures = new Nomenclatures(); - nomenclatures.setCivilites(Civilite.getNomenclature()); - xmlValidator = new XmlValidatorImpl(rapprochementSSOXSD); - } - - @Override - public ImportChiffre getPronoteExport(final String idEtablissement) throws IOException, NoSuchAlgorithmException, SAXException { - PartenaireIndex partenaireIndex = new PartenaireIndex(); - partenaireIndex.setPartenaire(indexEducationProperties.getPartenaireId()); - partenaireIndex.setDate(ZonedDateTime.now(ZoneId.systemDefault())); - partenaireIndex.setProtocoleDelegationAuthentification(indexEducationProperties.getProtocol()); - partenaireIndex.setNomenclatures(nomenclatures); - - final Pair> regroupement = getRegroupementStructures(idEtablissement); - Set idEtabs = regroupement.getValue(); - log.debug("Chargement des données pour les structures {}", regroupement); - - setContentInfos(partenaireIndex, idEtabs); - - // set XmlMapper to transform object to XML - XmlMapper xmlMapper = new XmlMapper(); - xmlMapper.registerModule(new JakartaXmlBindAnnotationModule()); - xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true ); - xmlMapper.configure(SerializationFeature.INDENT_OUTPUT, true ); - - final String xmlContent = xmlMapper.writeValueAsString(partenaireIndex); - - // log content - if (log.isDebugEnabled()) { - logIntoFileXmlContent(xmlContent, idEtablissement); - } - log.trace("Contenu en clair {}", xmlContent); - - // validating xml - xmlValidator.validate(xmlContent); - - - // Instanciate ImportChiffre for Pronote - ImportChiffre importChiffre = new ImportChiffre(); - // encrypt content and provide elements - encrypt(importChiffre, xmlContent); - importChiffre.setPartenaire(indexEducationProperties.getPartenaireName()); - importChiffre.setDateExport(partenaireIndex.getDate()); - importChiffre.setDescription(indexEducationProperties.getDescription()); - importChiffre.setUai(regroupement.getKey()); - importChiffre.setVersion(indexEducationProperties.getVersionConteneur()); - return importChiffre; - } - - private Pair> getRegroupementStructures(final String idEtablissement){ - for (Map.Entry> entry : regroupementStructures.entrySet()) { - if (containsIgnoreCase(entry.getValue(),idEtablissement)) return new Pair<>(entry.getKey(), entry.getValue()); - } - return new Pair<>(idEtablissement.toUpperCase(), Set.of(idEtablissement.toUpperCase())); - } - - private boolean containsIgnoreCase(final Set list, final String string) { - return list.stream().anyMatch(s -> s.equalsIgnoreCase(string)); - } - - private void setContentInfos(PartenaireIndex partenaireIndex, final Set idEtablissements) { - IIDMapper userMapper = new IDMapperImpl(); - IIDMapper structMapper = new IDMapperImpl(); - - partenaireIndex.setEtablissements(getEtablissements(idEtablissements, structMapper)); - - EtablissementsGeres etablissementsGeres = new EtablissementsGeres(); - for(Etablissement etablissement: partenaireIndex.getEtablissements().getEtablissements()) { - etablissementsGeres.getEtablissements().add( - new EtablissementsGeres.Etablissement(etablissement.getIdent())); - } - partenaireIndex.setEtablissementsGeres(etablissementsGeres); - - partenaireIndex.setProfesseurs(new Professeurs()); - partenaireIndex.setPersonnels(new Personnels()); - partenaireIndex.setResponsables(new Responsables()); - partenaireIndex.setEleves(new Eleves()); - - for (String idEtablissement: idEtablissements) { - log.debug("Recherche des données pour la structure {}", idEtablissement); - partenaireIndex.getProfesseurs().getProfesseurs().addAll(ldapDao.findAllProfesseurs(idEtablissement, userMapper)); - partenaireIndex.getPersonnels().getPersonnels().addAll(ldapDao.findAllPersonnels(idEtablissement, userMapper)); - partenaireIndex.getResponsables().getResponsables().addAll(ldapDao.finadAllResponsables(idEtablissement, userMapper)); - partenaireIndex.getEleves().getEleves().addAll(ldapDao.findAllEleves(idEtablissement, userMapper)); - } - - - } - - private Etablissements getEtablissements(final Set idEtablissements, final IIDMapper structMapper) { - Etablissements etablissements = new Etablissements(); - for(String idEtablissement: idEtablissements) { - Etablissement etab = ldapDao.findOneEtablissementById(idEtablissement, structMapper); - etablissements.getEtablissements().add(etab); - } - - return etablissements; - } - - private void logIntoFileXmlContent(final String xmlContent, final String idEtablissement){ - final String fileLog = String.format("/ResultPronoteUnencryptedFor-%s-%s.xml", idEtablissement, - Instant.now().truncatedTo(ChronoUnit.SECONDS).atZone(ZoneId.systemDefault()) - .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); - try { - FileOutputStream outputStream = new FileOutputStream(debugDataPath.getPath() + fileLog); - byte[] strToBytes = xmlContent.getBytes(StandardCharsets.UTF_8); - outputStream.write(strToBytes); - outputStream.close(); - } catch (FileNotFoundException ex) { - log.error("Impossible d'écrire dans le fichier {}", fileLog, ex); - } catch (IOException ex) { - log.error("Impossible d'écrire dans le fichier IO exception", ex); - } - } - - private void encrypt(ImportChiffre importChiffre, final String content) throws NoSuchAlgorithmException, IOException { - byte[] input = Zlib.compress(content.getBytes(StandardCharsets.UTF_8)); - log.debug("Compressed data stats: \n\rcontent length is {} \n\rreturned byte array length is {}", - content.length(), input.length); - - // Generating IV. - byte[] iv = new byte[BYTE_SIZE]; - SecureRandom random = new SecureRandom(); - random.nextBytes(iv); - final IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); - - // Generating AES Key - KeyGenerator kgen = null; - kgen = KeyGenerator.getInstance("AES"); - kgen.init(128); - final SecretKey key = kgen.generateKey(); - - // Encrypt data with AES. - Cipher cipher = null; - byte[] encrypted = null; - try { - cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, key, ivParameterSpec); - encrypted = cipher.doFinal(input); - } catch (NoSuchPaddingException | BadPaddingException | InvalidAlgorithmParameterException | IllegalBlockSizeException | InvalidKeyException e) { - throw new NoSuchAlgorithmException(e); - } - - // encrypt to RSA and provide the AES Key to Index Education - // Index Education requirements : encrypt with RSA (AES key + IV + MD5HASH(AES KEY + IV)) - byte[] encryptedKey = null; - try { - byte[] cle = new byte[BYTE_SIZE * 3]; - // copy to the byte array AES KEY - System.arraycopy(key.getEncoded(), 0, cle, 0, BYTE_SIZE); - // copy to the byte array IV - System.arraycopy(iv, 0, cle, BYTE_SIZE, BYTE_SIZE); - - // generate de MD5 HASH of the (AES key + IV) - byte[] md5Hash = genMD5Hash(Arrays.copyOfRange(cle, 0, BYTE_SIZE * 2)); - - // copy to the byte array the MD5 HASH - System.arraycopy(md5Hash, 0, cle, BYTE_SIZE * 2, BYTE_SIZE); - - // finally encrypt the byte array with the RSA asymmetric key - Cipher cipherRsa = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - cipherRsa.init(Cipher.ENCRYPT_MODE, publicKey); - encryptedKey = cipherRsa.doFinal(cle); - } catch (NoSuchPaddingException | BadPaddingException | IllegalBlockSizeException | InvalidKeyException e) { - throw new NoSuchAlgorithmException(e); - } - - importChiffre.setContenu(Base64.getEncoder().encodeToString(encrypted)); - importChiffre.setVerification(getHash(input)); - importChiffre.setCle(Base64.getEncoder().encodeToString(encryptedKey)); - } - - private byte[] getHash(final byte[] content) throws NoSuchAlgorithmException { - // calculate HASH verification - MessageDigest digest = MessageDigest.getInstance("SHA-256"); - return digest.digest(content); - } - - private byte[] genMD5Hash(final byte[] content) throws NoSuchAlgorithmException { - MessageDigest digest = MessageDigest.getInstance("MD5"); - return digest.digest(content); - } -} - - diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/Civilite.java b/src/main/java/fr/recia/pronote/ws/service/bean/Civilite.java deleted file mode 100644 index 79cf69f..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/bean/Civilite.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service.bean; - -import fr.recia.pronote.ws.model.rapprochementsso.Civilites; - -public enum Civilite { - M(2), - Mme(1), - undefined(0); - - private long code; - - private Civilite(long code) { - this.code = code; - } - - public long getCode() { - return code; - } - public void setCode(final long code) { - this.code = code; - } - - public static Civilites getNomenclature() { - Civilites civilites = new Civilites(); - civilites.getCivilites().add(new fr.recia.pronote.ws.model.rapprochementsso.Civilite(M.getCode(), M.name())); - civilites.getCivilites().add(new fr.recia.pronote.ws.model.rapprochementsso.Civilite(Mme.getCode(), Mme.name())); - civilites.getCivilites().add(new fr.recia.pronote.ws.model.rapprochementsso.Civilite(undefined.getCode(), undefined.name())); - return civilites; - } - - -} diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/IIDMapper.java b/src/main/java/fr/recia/pronote/ws/service/bean/IIDMapper.java deleted file mode 100644 index 19062bf..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/bean/IIDMapper.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service.bean; - -import fr.recia.pronote.ws.service.exception.NotFoundIdException; - -public interface IIDMapper { - /** - * Provide the pronoteId from the entry it will create a new associated ID to the ENT ID if not found. - * @param ENTID The object ID locally known - * @return long the internal pronote process long id. - */ - long getPronoteID(final String ENTID); - - /** - * Find the already associated pronoteId from the entry throw an exception if not found. - * @param ENTID The object ID locally known - * @return long the internal pronote process long id. - * @throws NotFoundIdException if not found. - */ - long findPronoteID(final String ENTID) throws NotFoundIdException; -} diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/impl/IDMapperImpl.java b/src/main/java/fr/recia/pronote/ws/service/bean/impl/IDMapperImpl.java deleted file mode 100644 index 31aca3a..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/bean/impl/IDMapperImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service.bean.impl; - -import java.util.LinkedList; - -import fr.recia.pronote.ws.service.bean.IIDMapper; -import fr.recia.pronote.ws.service.exception.NotFoundIdException; -import lombok.NoArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.util.Assert; - -@Slf4j -@NoArgsConstructor -public class IDMapperImpl implements IIDMapper { - - LinkedList ids= new LinkedList<>(); - - @Override - public long getPronoteID(String ENTID) { - Assert.hasText(ENTID, "Lidentifiant transmis ne peut pas être vide."); - log.debug("Identifiant ENT transmis {}", ENTID); - int index = ids.indexOf(ENTID); - if (index < 0) { - ids.addLast(ENTID); - index = ids.size()-1; - } - log.debug("Identifiant ENT transmis {} returne l'identifiant pronote {}", ENTID, index); - return index; - } - - @Override - public long findPronoteID(String ENTID) throws NotFoundIdException { - Assert.hasText(ENTID, "Lidentifiant transmis ne peut pas être vide."); - log.debug("Identifiant ENT transmis {}", ENTID); - int index = ids.indexOf(ENTID); - log.debug("Identifiant ENT transmis {} returne l'identifiant pronote {}", ENTID, index); - if (index < 0) { - throw new NotFoundIdException(); - } - return index; - } -} diff --git a/src/main/java/fr/recia/pronote/ws/service/util/CertificateUtils.java b/src/main/java/fr/recia/pronote/ws/service/util/CertificateUtils.java deleted file mode 100644 index 409bebc..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/util/CertificateUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service.util; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.security.InvalidKeyException; -import java.security.InvalidParameterException; -import java.security.KeyFactory; -import java.security.NoSuchAlgorithmException; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.RSAPublicKeySpec; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.codec.binary.Base64; - -public class CertificateUtils { - private static final int VALUE_LENGTH = 4; - private static final byte[] INITIAL_PREFIX = new byte[]{0x00, 0x00, 0x00, 0x07, 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61}; - private static final Pattern SSH_RSA_PATTERN = Pattern.compile("ssh-rsa[\\s]+([A-Za-z0-9/+]+=*)[\\s]*.*"); - -// SSH-RSA key format -// -// 00 00 00 07 The length in bytes of the next field -// 73 73 68 2d 72 73 61 The key type (ASCII encoding of "ssh-rsa") -// 00 00 00 03 The length in bytes of the public exponent -// 01 00 01 The public exponent (usually 65537, as here) -// 00 00 01 01 The length in bytes of the modulus (here, 257) -// 00 c3 a3... The modulus - - public static RSAPublicKey parseSSHPublicKey(String key) throws InvalidKeyException { - Matcher matcher = SSH_RSA_PATTERN.matcher(key.trim()); - if (!matcher.matches()) { - throw new InvalidKeyException("Key format is invalid for SSH RSA."); - } - String keyStr = matcher.group(1); - - ByteArrayInputStream is = new ByteArrayInputStream(Base64.decodeBase64(keyStr)); - - byte[] prefix = new byte[INITIAL_PREFIX.length]; - - try { - if (INITIAL_PREFIX.length != is.read(prefix) || !Arrays.equals(INITIAL_PREFIX, prefix)) { - throw new InvalidKeyException("Initial [ssh-rsa] key prefix missed."); - } - - BigInteger exponent = getValue(is); - BigInteger modulus = getValue(is); - - return (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new RSAPublicKeySpec(modulus, exponent)); - } catch (IOException | InvalidKeySpecException | NoSuchAlgorithmException e) { - throw new InvalidKeyException("Failed to read SSH RSA certificate from string", e); - } - } - - private static BigInteger getValue(InputStream is) throws IOException { - byte[] lenBuff = new byte[VALUE_LENGTH]; - if (VALUE_LENGTH != is.read(lenBuff)) { - throw new InvalidParameterException("Unable to read value length."); - } - - int len = ByteBuffer.wrap(lenBuff).getInt(); - byte[] valueArray = new byte[len]; - if (len != is.read(valueArray)) { - throw new InvalidParameterException("Unable to read value."); - } - - return new BigInteger(valueArray); - } -} diff --git a/src/main/java/fr/recia/pronote/ws/service/util/XmlValidatorImpl.java b/src/main/java/fr/recia/pronote/ws/service/util/XmlValidatorImpl.java deleted file mode 100644 index 250fae3..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/util/XmlValidatorImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service.util; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; - -import javax.xml.XMLConstants; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; - -import lombok.extern.slf4j.Slf4j; -import org.xml.sax.SAXException; - -@Slf4j -public class XmlValidatorImpl { - - private final SchemaFactory schemaFactory = SchemaFactory - .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - private Validator validator; - - public XmlValidatorImpl(final File schemaFile) throws SAXException { - super(); - final Schema schema = schemaFactory.newSchema(schemaFile); - validator = schema.newValidator(); - } - - public boolean validate(final String xml) throws IOException, SAXException { - Source xmlSource = new StreamSource(new StringReader(xml)); - try { - validator.validate(xmlSource); - return true; - } catch (SAXException | IOException e) { - log.error(xmlSource.getSystemId() + " is NOT valid reason:", e); - throw e; - } - } -} diff --git a/src/main/java/fr/recia/pronote/ws/service/util/Zlib.java b/src/main/java/fr/recia/pronote/ws/service/util/Zlib.java deleted file mode 100644 index 3b18029..0000000 --- a/src/main/java/fr/recia/pronote/ws/service/util/Zlib.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.service.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.zip.DataFormatException; -import java.util.zip.DeflaterOutputStream; -import java.util.zip.InflaterOutputStream; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class Zlib { - /** - * Compresses an array of bytes using Zlib. - * @param data The array of bytes to compress - * @return The compressed bytes - */ - public static byte[] compress(byte[] data) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - DeflaterOutputStream outputStream = new DeflaterOutputStream(baos); - outputStream.write(data); - outputStream.finish(); - - return baos.toByteArray(); - } - - /** - * Decompresses a compressed array of bytes. - * @param data The compressed bytes - * @return The decompressed bytes - * @throws DataFormatException Thrown when the passed bytes are the wrong format - */ - public static byte[] decompress(byte[] data) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - InflaterOutputStream outputStream = new InflaterOutputStream(baos); - outputStream.write(data); - outputStream.finish(); - - return baos.toByteArray(); - } - - public static String byteArrayToString(byte[] a) { - return new String(a, StandardCharsets.UTF_8); - } - - public static void check(final String toCompress) throws IOException { - log.info("Original String: " + toCompress); - byte[] compressed = Zlib.compress(toCompress.getBytes(StandardCharsets.UTF_8)); - log.info("Compressed String: " + byteArrayToString(compressed)); - log.info("Original: %d%n", toCompress.length()); - log.info("Compress: %d%n", compressed.length); - byte[] decompressed = Zlib.decompress(compressed); - log.info("Decompressed Str: " + byteArrayToString(decompressed)); - } -} diff --git a/src/main/java/fr/recia/pronote/ws/web/rest/PronoteAPIResource.java b/src/main/java/fr/recia/pronote/ws/web/rest/PronoteAPIResource.java deleted file mode 100644 index 69ed8d7..0000000 --- a/src/main/java/fr/recia/pronote/ws/web/rest/PronoteAPIResource.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald - * - * Licensed 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. - */ -package fr.recia.pronote.ws.web.rest; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.security.NoSuchAlgorithmException; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; - -import javax.annotation.PostConstruct; -import javax.servlet.http.HttpServletResponse; - -import com.fasterxml.jackson.dataformat.xml.XmlMapper; -import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; -import fr.recia.pronote.ws.model.conteneurimportchiffre.ImportChiffre; -import fr.recia.pronote.ws.service.PronoteExportService; -import fr.recia.pronote.ws.service.util.XmlValidatorImpl; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; -import org.xml.sax.SAXException; - -@RestController -@RequestMapping(value = "/api") -@Slf4j -public class PronoteAPIResource { - - @Autowired - private File debugDataPath; - - @Autowired - private PronoteExportService pronoteExportService; - - @Autowired - private File importChiffreXSD; - - private XmlValidatorImpl xmlValidator; - - @PostConstruct - public void setUp() throws SAXException { - xmlValidator = new XmlValidatorImpl(importChiffreXSD); - } - - @RequestMapping(value = "/export/{uai}", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE) - public ResponseEntity getXMLPronoteExport(@PathVariable String uai, HttpServletResponse response) { - log.info("Requesting Import Chiffré Pronote of etablissement {}", uai); - try { - return new ResponseEntity(pronoteExportService.getPronoteExport(uai), HttpStatus.OK); - } catch (IOException e) { - log.error(String.format("Can't process ImportChiffre for %s", uai), e); - } catch (EmptyResultDataAccessException ex) { - log.error(String.format("Etablissement '%s' non trouvé", uai), ex); - return new ResponseEntity<>(HttpStatus.NOT_FOUND); - } catch (NoSuchAlgorithmException ex) { - log.error("Impossible de générer le fichier un algorithme n'existe pas", ex); - } catch (SAXException ex) { - log.error("Le flux xml est mal formé", ex); - } - return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); - } - - @RequestMapping(value = "/download/{uai}", method = RequestMethod.GET) - public ResponseEntity getFilePronoteExport(@PathVariable String uai, HttpServletResponse response) { - log.info("Requesting Import Chiffré Pronote of etablissement {}", uai); - try { - ImportChiffre ic = pronoteExportService.getPronoteExport(uai); - - // set XmlMapper to transform object to XML - XmlMapper xmlMapper = new XmlMapper(); - xmlMapper.registerModule(new JakartaXmlBindAnnotationModule()); - xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true ); - - final String xmlContent = xmlMapper.writeValueAsString(ic); - - if (log.isDebugEnabled()) { - logIntoFileXmlContent(xmlContent, uai); - } - log.trace("Export ImportChiffre {}", xmlContent); - - // validating xml - xmlValidator.validate(xmlContent); - - return ResponseEntity.ok() - .contentType(MediaType.APPLICATION_XML) - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + uai +".xml\"") - .body(xmlContent.getBytes(StandardCharsets.UTF_8)); - } catch (IOException e) { - log.error(String.format("Can't process ImportChiffre for %s", uai), e); - } catch (EmptyResultDataAccessException ex) { - log.error(String.format("Etablissement '%s' non trouvé", uai), ex); - return new ResponseEntity<>(HttpStatus.NOT_FOUND); - } catch (NoSuchAlgorithmException ex) { - log.error("Impossible de générer le fichier un algorithme n'existe pas", ex); - } catch (SAXException ex) { - log.error("Le flux xml est mal formé", ex); - } - return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); - } - - private void logIntoFileXmlContent(final String xmlContent, final String idEtablissement){ - final String fileLog = String.format("/ResultPronoteEncryptedFor-%s-%s.xml", idEtablissement, - Instant.now().truncatedTo(ChronoUnit.SECONDS).atZone(ZoneId.systemDefault()) - .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); - try { - FileOutputStream outputStream = new FileOutputStream(debugDataPath.getPath() + fileLog); - byte[] strToBytes = xmlContent.getBytes(StandardCharsets.UTF_8); - outputStream.write(strToBytes); - outputStream.close(); - } catch (FileNotFoundException ex) { - log.error("Impossible d'écrire dans le fichier {}", fileLog, ex); - } catch (IOException ex) { - log.error("Impossible d'écrire dans le fichier IO exception", ex); - } - } -} diff --git a/src/main/java/fr/recia/pronote/ws/PronoteWsApplication.java b/src/main/java/fr/recia/si/ent/api/SIENTAPIApplication.java similarity index 70% rename from src/main/java/fr/recia/pronote/ws/PronoteWsApplication.java rename to src/main/java/fr/recia/si/ent/api/SIENTAPIApplication.java index db15008..2e9b4f7 100644 --- a/src/main/java/fr/recia/pronote/ws/PronoteWsApplication.java +++ b/src/main/java/fr/recia/si/ent/api/SIENTAPIApplication.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,16 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws; - -import java.security.Provider; -import java.security.Security; -import java.util.Arrays; -import java.util.stream.StreamSupport; +package fr.recia.si.ent.api; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; +import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.properties.ConfigurationPropertiesScan; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @@ -32,14 +29,17 @@ import org.springframework.core.env.Environment; import org.springframework.core.env.MutablePropertySources; -@SpringBootApplication +import java.util.Arrays; +import java.util.stream.StreamSupport; + +@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class}) @ConfigurationPropertiesScan @Slf4j -public class PronoteWsApplication extends SpringBootServletInitializer { +public class SIENTAPIApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(PronoteWsApplication.class); + return application.sources(SIENTAPIApplication.class); } public static void main(String[] args) { @@ -49,21 +49,7 @@ public static void main(String[] args) { } - ConfigurableApplicationContext app = SpringApplication.run(PronoteWsApplication.class, args); - -// BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider(); -// Security.addProvider(bouncyCastleProvider); -// Security.setProperty("crypto.policy", "unlimited"); -// -// log.info("Bouncy Catle Provider Version " + bouncyCastleProvider.getVersionStr() -// + " \nName " + bouncyCastleProvider.getName() -// + " | \n" + bouncyCastleProvider.getInfo()); - - Provider[] providers = Security.getProviders(); - - for (Provider provider : providers) { - log.info("Installed security providers" + provider.getInfo() + "\n"); - } + ConfigurableApplicationContext app = SpringApplication.run(SIENTAPIApplication.class, args); Environment env = app.getEnvironment(); diff --git a/src/main/java/fr/recia/si/ent/api/config/SIENTAPIConfiguration.java b/src/main/java/fr/recia/si/ent/api/config/SIENTAPIConfiguration.java new file mode 100644 index 0000000..00e2c68 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/config/SIENTAPIConfiguration.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.config; + +import fr.recia.si.ent.api.config.bean.AppConfProperties; +import fr.recia.si.ent.api.config.bean.LDAPProperties; +import fr.recia.si.ent.api.service.bean.IExtractOpaqueId; +import fr.recia.si.ent.api.service.bean.IExtractUIDFromDN; +import fr.recia.si.ent.api.service.bean.impl.ExtractOpaqueIdImpl; +import fr.recia.si.ent.api.service.bean.impl.ExtractUIDFromDNImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.core.support.LdapContextSource; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@Configuration +@Slf4j +public class SIENTAPIConfiguration { + + @Autowired + private LDAPProperties ldapProperties; + + @Autowired + private AppConfProperties appConfProperties; + + /** + * Index opaqueIdExtractor per clientId + **/ + @Bean + public Map opaqueIdExtractors(){ + Map opaqueIdMap = new HashMap<>(); + appConfProperties.getClients().forEach((key, val) -> { + if (val.getUserOpaqueId() != null) + opaqueIdMap.put(key, new ExtractOpaqueIdImpl(val.getUserOpaqueId())); + }); + return opaqueIdMap; + } + + @Bean + public IExtractUIDFromDN uidFromDNExtractor() { + return new ExtractUIDFromDNImpl(ldapProperties.getUserUidExtractorPattern()); + } + +// @Bean +// public List etablissementNameCleaner() { +// final List cleaners = new ArrayList<>(); +// ldapProperties.getEtablissementNameProcessors().forEach(cleaner -> cleaners.add(new RegexGroupReplacementCleaner(cleaner))); +// return cleaners; +// } + + @Bean + public LdapContextSource contextSource() { + final LdapContextSource contextSource = new LdapContextSource(); + + contextSource.setAnonymousReadOnly(ldapProperties.isAnonymousReadOnly()); + contextSource.setBase(ldapProperties.getBase()); + contextSource.setUrl(ldapProperties.getUrl()); + contextSource.setUserDn(ldapProperties.getUserDn()); + contextSource.setPassword(ldapProperties.getPassword()); + contextSource.setPooled(ldapProperties.isPooled()); + + return contextSource; + } + + @Bean + public LdapTemplate ldapTemplate() throws Exception{ + final LdapTemplate ldapTemplate = new LdapTemplate(); + ldapTemplate.setContextSource(contextSource()); + ldapTemplate.setDefaultCountLimit(ldapProperties.getCountLimit()); + ldapTemplate.setDefaultTimeLimit(ldapProperties.getTimeout()); + + return ldapTemplate; + } + + @Bean + public Map> regroupementStructures() { + Map> grouped = new HashMap<>(); + appConfProperties.getStructuresRegroupees().forEach((key, values) -> { + values.replaceAll(String::toUpperCase); + Set concatened = new HashSet<>(values); + concatened.add(key.toUpperCase()); + grouped.put(key.toUpperCase(), concatened); + }); + return grouped; + } +} diff --git a/src/main/java/fr/recia/si/ent/api/config/SecurityConfiguration.java b/src/main/java/fr/recia/si/ent/api/config/SecurityConfiguration.java new file mode 100644 index 0000000..9b4293a --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/config/SecurityConfiguration.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.config; + +import fr.recia.si.ent.api.config.bean.AppConfProperties; +import fr.recia.si.ent.api.config.security.AuthenticationFilter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authorization.AuthorizationDecision; +import org.springframework.security.authorization.AuthorizationManager; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.access.intercept.RequestAuthorizationContext; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.IpAddressMatcher; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashSet; +import java.util.Set; + +@Configuration +@EnableWebSecurity +@Slf4j +public class SecurityConfiguration { + + @Autowired + private AppConfProperties appConfProperties; + + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + + //log.debug("WebSecurity configuration: authorize access on '/api/**' for {}", hasIpAddress.toString()); + //.access(hasIpAddress(appConfProperties)).and().anyRequest() + + http.csrf(AbstractHttpConfigurer::disable).exceptionHandling() + .and().authorizeHttpRequests( + authorizationManagerRequestMatcherRegistry -> authorizationManagerRequestMatcherRegistry.antMatchers("/**").authenticated()) + .httpBasic(Customizer.withDefaults()).sessionManagement(httpSecuritySessionManagementConfigurer -> httpSecuritySessionManagementConfigurer.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .addFilterBefore(new AuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); + return http.build(); + + } + + + private AuthorizationManager hasIpAddress(AppConfProperties appConfProperties) { + Set IpAddressMatchers = new HashSet<>(); + appConfProperties.getIpAddressClientMap().values().forEach(IpAddressMatchers::addAll); + return (authentication, context) -> { + HttpServletRequest request = context.getRequest(); + return new AuthorizationDecision(IpAddressMatchers.stream().anyMatch(ipAddressMatchers -> ipAddressMatchers.matches(request))); + }; + } +} diff --git a/src/main/java/fr/recia/si/ent/api/config/bean/APIClient.java b/src/main/java/fr/recia/si/ent/api/config/bean/APIClient.java new file mode 100644 index 0000000..82379d8 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/config/bean/APIClient.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.config.bean; + +import fr.recia.si.ent.api.dao.impl.LdapAttributes; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.PostConstruct; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.*; + +@Data +@Validated +public class APIClient { + /*@NotBlank + private String groupRegex; + @NotEmpty + private Map indexListReplacement;*/ + + @NotBlank + private String apiKey; + @NotEmpty + private List authorizedIPAccess; + private userOpaqueId userOpaqueId; + @NotEmpty + private Map endPointsRequestMap; + + + @Data + @Validated + @Slf4j + public static class endPointsRequest { + @NotBlank + private String ldapFilter; + @NotEmpty + private Set ldapAttributes; + + @PostConstruct + private void checkSetUp(){ + Set ldapAttributesNormalized = new HashSet<>(); + ldapAttributes.forEach(val -> { + Optional match = LdapAttributes.ALL_ATTRS.stream().filter(e -> e.equalsIgnoreCase(val)).findFirst(); + if (match.isPresent()) { + ldapAttributesNormalized.add(match.get()); + } else { + log.warn("The ldapAttribute '{}' doesn't exist in LdapAttributes list {}", val, LdapAttributes.ALL_ATTRS ); + } + }); + this.ldapAttributes = ldapAttributesNormalized; + } + } + @Data + @Validated + @Slf4j + public static class userOpaqueId { + @NotBlank + private String regexp; + @NotBlank + private String ldapAttribute; + + @PostConstruct + private void checkSetUp(){ + Optional match = LdapAttributes.ALL_ATTRS.stream().filter(e -> e.equalsIgnoreCase(ldapAttribute)).findFirst(); + if (match.isPresent()) { + this.ldapAttribute = match.get(); + } else { + log.warn("The ldapAttribute '{}' for userOpaqueId doesn't exist in LdapAttributes list {}", ldapAttribute, LdapAttributes.ALL_ATTRS ); + } + } + } +} diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/Sexe.java b/src/main/java/fr/recia/si/ent/api/config/bean/ApiEndpoints.java similarity index 50% rename from src/main/java/fr/recia/pronote/ws/service/bean/Sexe.java rename to src/main/java/fr/recia/si/ent/api/config/bean/ApiEndpoints.java index b6c42c8..98aa97a 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/Sexe.java +++ b/src/main/java/fr/recia/si/ent/api/config/bean/ApiEndpoints.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,17 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean; +package fr.recia.si.ent.api.config.bean; -public enum Sexe { - Masculin, - Feminin; - - public static Sexe getSexeFromCode(final String code){ - switch (code) { - case "M": return Sexe.Masculin; - case "F": return Sexe.Feminin; - default: throw new IllegalArgumentException(String.format("La valeur %s n'est pas une valeur possible pour la conversion en type énuméré %s", code, Sexe.class)); - } - } -} +public final class ApiEndpoints { + public static final String USER_INFO = "userInfo"; + public static final String CHILDRENS_OF = "childrensOf"; + public static final String DETAILLED_FONCTIONS = "detailledFonctions"; + public static final String DETAILLED_CLASSES = "detailledClasses"; + public static final String DETAILLED_GROUPS = "detailledGroups"; +} \ No newline at end of file diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/AppConfProperties.java b/src/main/java/fr/recia/si/ent/api/config/bean/AppConfProperties.java similarity index 52% rename from src/main/java/fr/recia/pronote/ws/config/bean/AppConfProperties.java rename to src/main/java/fr/recia/si/ent/api/config/bean/AppConfProperties.java index 84d38b4..ab27667 100644 --- a/src/main/java/fr/recia/pronote/ws/config/bean/AppConfProperties.java +++ b/src/main/java/fr/recia/si/ent/api/config/bean/AppConfProperties.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,35 +13,43 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.config.bean; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.PostConstruct; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; +package fr.recia.si.ent.api.config.bean; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.security.web.util.matcher.IpAddressMatcher; import org.springframework.validation.annotation.Validated; +import javax.annotation.PostConstruct; +import javax.validation.constraints.NotEmpty; +import java.util.*; + @ConfigurationProperties(prefix = "app.conf") @Data @Validated @Slf4j public class AppConfProperties { - @NotBlank - private String debugDataFilePath; - @NotEmpty private Map> structuresRegroupees = new HashMap<>(); + @NotEmpty + private Map clients = new HashMap<>(); + + private Map APIKeysClientMap = new HashMap<>(); + private Map> IpAddressClientMap = new HashMap<>(); + private Map> IpAddressAPIPathMap = new HashMap<>(); + @PostConstruct - public void debug() { + public void setupAndDebug() { + clients.forEach((clientId, clientDesc) -> { + APIKeysClientMap.put(clientDesc.getApiKey(), clientId); + //Compile IpAddressMatchers for clients access + Set ipsMatchers = new HashSet<>(); + clientDesc.getAuthorizedIPAccess().forEach(ip -> ipsMatchers.add(new IpAddressMatcher(ip))); + IpAddressClientMap.put(clientId, ipsMatchers); + }); log.debug("AppConfProperties {}", this); } } diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/AppInfosProperties.java b/src/main/java/fr/recia/si/ent/api/config/bean/AppInfosProperties.java similarity index 87% rename from src/main/java/fr/recia/pronote/ws/config/bean/AppInfosProperties.java rename to src/main/java/fr/recia/si/ent/api/config/bean/AppInfosProperties.java index 65f08c7..8400ef0 100644 --- a/src/main/java/fr/recia/pronote/ws/config/bean/AppInfosProperties.java +++ b/src/main/java/fr/recia/si/ent/api/config/bean/AppInfosProperties.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.config.bean; - -import javax.annotation.PostConstruct; -import javax.validation.constraints.NotBlank; +package fr.recia.si.ent.api.config.bean; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; +import javax.annotation.PostConstruct; +import javax.validation.constraints.NotBlank; + @ConfigurationProperties(prefix = "app.info") @Validated @Data diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/Cleaner.java b/src/main/java/fr/recia/si/ent/api/config/bean/Cleaner.java similarity index 85% rename from src/main/java/fr/recia/pronote/ws/config/bean/Cleaner.java rename to src/main/java/fr/recia/si/ent/api/config/bean/Cleaner.java index af9bc7a..59fd299 100644 --- a/src/main/java/fr/recia/pronote/ws/config/bean/Cleaner.java +++ b/src/main/java/fr/recia/si/ent/api/config/bean/Cleaner.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.config.bean; +package fr.recia.si.ent.api.config.bean; import java.util.Map; diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/LDAPProperties.java b/src/main/java/fr/recia/si/ent/api/config/bean/LDAPProperties.java similarity index 75% rename from src/main/java/fr/recia/pronote/ws/config/bean/LDAPProperties.java rename to src/main/java/fr/recia/si/ent/api/config/bean/LDAPProperties.java index efa7fdf..f05c1c0 100644 --- a/src/main/java/fr/recia/pronote/ws/config/bean/LDAPProperties.java +++ b/src/main/java/fr/recia/si/ent/api/config/bean/LDAPProperties.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,20 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.config.bean; - -import java.util.List; - -import javax.annotation.PostConstruct; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +package fr.recia.si.ent.api.config.bean; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; +import javax.annotation.PostConstruct; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + @ConfigurationProperties(prefix = "app.ldap") @Data @@ -43,7 +40,7 @@ public class LDAPProperties { @NotNull private String password; private boolean pooled; - private boolean anonimousReadOnly; + private boolean anonymousReadOnly; @NotNull private String structureRootDn; @NotNull @@ -51,21 +48,9 @@ public class LDAPProperties { private int timeout = 10000; private int countLimit = 1500; - @NotNull - private Filter filters; - - @NotEmpty - private List etablissementNameProcessors; - - @NotBlank - private String userOpaqueIdPattern; - @NotBlank private String userUidExtractorPattern; - @NotBlank - private String autorizedResponsablePattern; - @PostConstruct public void debug() { log.debug("LDAPProperties {}", this); diff --git a/src/main/java/fr/recia/si/ent/api/config/security/ApiKeyAuthentication.java b/src/main/java/fr/recia/si/ent/api/config/security/ApiKeyAuthentication.java new file mode 100644 index 0000000..3fe58eb --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/config/security/ApiKeyAuthentication.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.config.security; + +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; + +import java.util.Collection; + +public class ApiKeyAuthentication extends AbstractAuthenticationToken { + private final String apiKey; + + public ApiKeyAuthentication(String apiKey, Collection authorities) { + super(authorities); + this.apiKey = apiKey; + setAuthenticated(true); + } + + @Override + public Object getCredentials() { + return null; + } + + @Override + public Object getPrincipal() { + return apiKey; + } +} diff --git a/src/main/java/fr/recia/si/ent/api/config/security/AuthenticationFilter.java b/src/main/java/fr/recia/si/ent/api/config/security/AuthenticationFilter.java new file mode 100644 index 0000000..cec7e82 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/config/security/AuthenticationFilter.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.config.security; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.filter.GenericFilterBean; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; + +@Slf4j +public class AuthenticationFilter extends GenericFilterBean { + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) + throws IOException, ServletException { + try { + log.debug("doFilter - try to authenticate"); + Authentication authentication = AuthenticationService.getAuthentication((HttpServletRequest) request); + SecurityContextHolder.getContext().setAuthentication(authentication); + log.debug("doFilter - authentication is done"); + } catch (Exception ex) { + log.debug("doFilter - authentication failed with exception", ex); + HttpServletResponse httpResponse = (HttpServletResponse) response; + httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + httpResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); + PrintWriter writer = httpResponse.getWriter(); + writer.print(ex.getMessage()); + writer.flush(); + writer.close(); + } + + filterChain.doFilter(request, response); + } +} \ No newline at end of file diff --git a/src/main/java/fr/recia/si/ent/api/config/security/AuthenticationService.java b/src/main/java/fr/recia/si/ent/api/config/security/AuthenticationService.java new file mode 100644 index 0000000..ca73d19 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/config/security/AuthenticationService.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.config.security; + +import fr.recia.si.ent.api.config.bean.AppConfProperties; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.authority.AuthorityUtils; +import org.springframework.security.web.util.matcher.IpAddressMatcher; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +import javax.annotation.PostConstruct; +import javax.servlet.http.HttpServletRequest; + +@Slf4j +@Component +public class AuthenticationService { + private static final String AUTH_TOKEN_HEADER_NAME = "X-API-KEY"; + + private static AppConfProperties appConfProperties; + + @Autowired + private AppConfProperties config; + + @PostConstruct + private void setUp() { + appConfProperties = this.config; + } + + public static Authentication getAuthentication(HttpServletRequest request) { + Assert.notNull(appConfProperties, "You have a misconfiguration of the class with the injected bean appConfProperties !"); + Assert.notEmpty(appConfProperties.getAPIKeysClientMap(), "You have a misconfiguration of bean appConfProperties.APIKeysClientMap, he is empty !"); + final String apiKey = request.getHeader(AUTH_TOKEN_HEADER_NAME); + log.debug("getAuthentication - check for token {}", apiKey); + if (apiKey == null || !appConfProperties.getAPIKeysClientMap().containsKey(apiKey)) { + log.warn("Access with token '{}' isn't authorized - access from IP '{}'", apiKey, request.getRemoteAddr()); + throw new BadCredentialsException("Invalid API Key"); + } + final String clientId = appConfProperties.getAPIKeysClientMap().get(apiKey); + checkClientIpAccess(request, clientId); + log.info("getAuthentication - authorization for clientId '{}' from IP '{}'", clientId, request.getRemoteAddr()); + return new ApiKeyAuthentication(clientId, AuthorityUtils.NO_AUTHORITIES); + } + + private static void checkClientIpAccess(final HttpServletRequest request, final String clientId) throws AccessDeniedException { + final String clientIpAddress = request.getRemoteAddr(); + boolean isAuthorized = false; + for (String ip: appConfProperties.getClients().get(clientId).getAuthorizedIPAccess()) { + if (new IpAddressMatcher(ip).matches(clientIpAddress)) { + isAuthorized = true; + } + } + if (!isAuthorized) { + log.warn("Access from IP '{}' for clientId '{}' isn't authorized", clientIpAddress, clientId); + throw new AccessDeniedException("Client Not Authorized"); + } + } +} diff --git a/src/main/java/fr/recia/si/ent/api/dao/ILdapDao.java b/src/main/java/fr/recia/si/ent/api/dao/ILdapDao.java new file mode 100644 index 0000000..c6bfa58 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/dao/ILdapDao.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.dao; + +import fr.recia.si.ent.api.service.bean.IExtractOpaqueId; +import org.springframework.dao.EmptyResultDataAccessException; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public interface ILdapDao { + + Map findPersonFromStringFilter(@NotBlank final String filter, @NotEmpty final Set attributes, final IExtractOpaqueId extractOpaqueId) throws EmptyResultDataAccessException; + + List> findAllPersonFromStringFilter(@NotBlank final String filter, @NotEmpty final Set attributes, final IExtractOpaqueId extractOpaqueId) throws EmptyResultDataAccessException; + +} \ No newline at end of file diff --git a/src/main/java/fr/recia/si/ent/api/dao/impl/LdapAttributes.java b/src/main/java/fr/recia/si/ent/api/dao/impl/LdapAttributes.java new file mode 100644 index 0000000..224573d --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/dao/impl/LdapAttributes.java @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.dao.impl; + +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class LdapAttributes { + + public static final String ENTSTRUCTURE_IDENT_ATTRIBUTE = "ENTStructureSIREN"; + public static final String ENTSTRUCTURE_UAI = "ENTStructureUAI"; + + + + public static final String ENTPERSON_DN = "distinguishedName"; + public static final String ENTPERSON_UID = "uid"; + public static final String ENTPERSON_GIVENNAME = "givenName"; + public static final String ENTPERSON_ISMEMBEROF = "isMemberOf"; + public static final String ENTPERSON_MAIL = "mail"; + public static final String ENTPERSON_PERSONALTITLE = "personalTitle"; + public static final String ENTPERSON_SN = "sn"; + public static final String ENTPERSON_CN = "cn"; + public static final String ENTPERSON_DISPLAYNAME = "displayName"; + public static final String ENTPERSON_ENTAUXENSCATEGODISCIPLINE = "ENTAuxEnsCategoDiscipline"; + public static final String ENTPERSON_ENTAUXENSGROUPES = "ENTAuxEnsGroupes"; + public static final String ENTPERSON_ENTAUXENSGROUPESMATIERES = "ENTAuxEnsGroupesMatieres"; + public static final String ENTPERSON_ENTAUXENSMATIEREENSEIGNETAB = "ENTAuxEnsMatiereEnseignEtab"; + public static final String ENTPERSON_ENTAUXENSMEF = "ENTAuxEnsMEF"; + public static final String ENTPERSON_ENTAUXNONENSCOLLLOCSERVICE = "ENTAuxNonEnsCollLocService"; + public static final String ENTPERSON_ENTELEVEADRESSEREL = "ENTEleveAdresseRel"; + public static final String ENTPERSON_ENTELEVECLASSES = "ENTEleveClasses"; + public static final String ENTPERSON_ENTELEVECODEENSEIGNEMENTS = "ENTEleveCodeEnseignements"; + public static final String ENTPERSON_ENTELEVEENSEIGNEMENTS = "ENTEleveEnseignements"; + public static final String ENTPERSON_ENTELEVEFILIERE = "ENTEleveFiliere"; + public static final String ENTPERSON_ENTELEVEGROUPES = "ENTEleveGroupes"; + public static final String ENTPERSON_ENTELEVELIBELLEMEF = "ENTEleveLibelleMEF"; + public static final String ENTPERSON_ENTELEVEMAJEUR = "ENTEleveMajeur"; + public static final String ENTPERSON_ENTELEVEMEF = "ENTEleveMEF"; + public static final String ENTPERSON_ENTELEVENIVFORMATION = "ENTEleveNivFormation"; + public static final String ENTPERSON_ENTELEVEPERSRELELEVE = "ENTElevePersRelEleve"; + public static final String ENTPERSON_ENTELEVEREGIME = "ENTEleveRegime"; + public static final String ENTPERSON_ENTELEVESTATUTELEVE = "ENTEleveStatutEleve"; + public static final String ENTPERSON_ENTELEVETRANSPORT = "ENTEleveTransport"; + public static final String ENTPERSON_ENTPERSONADRESSEDIFFUSION = "ENTPersonAdresseDiffusion"; + public static final String ENTPERSON_ENTPERSONAUTRESMAILS = "ENTPersonAutresMails"; + public static final String ENTPERSON_ENTPERSONAUTRESPRENOMS = "ENTPersonAutresPrenoms"; + public static final String ENTPERSON_ENTPERSONCODEPOSTAL = "ENTPersonCodePostal"; + public static final String ENTPERSON_ENTPERSONDATENAISSANCE = "ENTPersonDateNaissance"; + public static final String ENTPERSON_ENTPERSONFONCTIONS = "ENTPersonFonctions"; + public static final String ENTPERSON_ENTPERSONGARIDENTIFIANT = "ENTPersonGARIdentifiant"; + public static final String ENTPERSON_ENTPERSONNOMPATRO = "ENTPersonNomPatro"; + public static final String ENTPERSON_ENTPERSONPAYS = "ENTPersonPays"; + public static final String ENTPERSON_ENTPERSONPROFILS = "ENTPersonProfils"; + public static final String ENTPERSON_ENTPERSONSEXE = "ENTPersonSexe"; + public static final String ENTPERSON_ENTPERSONSTRUCTRATTACH = "ENTPersonStructRattach"; + public static final String ENTPERSON_ENTPERSONVILLE = "ENTPersonVille"; + public static final String ENTPERSON_ESCOAUXENSCODEMATIEREENSEIGNETAB = "ESCOAuxEnsCodeMatiereEnseignEtab"; + public static final String ENTPERSON_ESCODOMAINES = "ESCODomaines"; + public static final String ENTPERSON_ESCOELEVECODEENSEIGNEMENTS = "ESCOEleveCodeEnseignements"; + public static final String ENTPERSON_ESCOPERSONETATCOMPTE = "ESCOPersonEtatCompte"; + public static final String ENTPERSON_ESCOPERSONEXTERNALIDS = "ESCOPersonExternalIds"; + public static final String ENTPERSON_ESCOPERSONPROFILS = "ESCOPersonProfils"; + public static final String ENTPERSON_ESCOSIREN = "ESCOSIREN"; + public static final String ENTPERSON_ESCOSIRENCOURANT = "ESCOSIRENCourant"; + public static final String ENTPERSON_ESCOUAI = "ESCOUAI"; + public static final String ENTPERSON_ESCOUAICOURANT = "ESCOUAICourant"; + public static final String ENTPERSON_ESCOUAIRATTACHEMENT = "ESCOUAIRattachement"; + + + public static final Set STRUCTURE_ATTRS = + Stream.of(ENTSTRUCTURE_IDENT_ATTRIBUTE, ENTSTRUCTURE_UAI).collect(Collectors.toSet()); + + public static final Set PERSON_ATTRS = + Stream.of(ENTPERSON_DN, ENTPERSON_UID, ENTPERSON_GIVENNAME, ENTPERSON_ISMEMBEROF, ENTPERSON_MAIL, ENTPERSON_PERSONALTITLE, + ENTPERSON_SN, ENTPERSON_CN, ENTPERSON_DISPLAYNAME, ENTPERSON_ENTAUXENSCATEGODISCIPLINE, ENTPERSON_ENTAUXENSGROUPES, + ENTPERSON_ENTAUXENSGROUPESMATIERES, ENTPERSON_ENTAUXENSMATIEREENSEIGNETAB, ENTPERSON_ENTAUXENSMEF, + ENTPERSON_ENTAUXNONENSCOLLLOCSERVICE, ENTPERSON_ENTELEVEADRESSEREL, ENTPERSON_ENTELEVECLASSES, + ENTPERSON_ENTELEVECODEENSEIGNEMENTS, ENTPERSON_ENTELEVEENSEIGNEMENTS, ENTPERSON_ENTELEVEFILIERE, + ENTPERSON_ENTELEVEGROUPES, ENTPERSON_ENTELEVELIBELLEMEF, ENTPERSON_ENTELEVEMAJEUR, ENTPERSON_ENTELEVEMEF, + ENTPERSON_ENTELEVENIVFORMATION, ENTPERSON_ENTELEVEPERSRELELEVE, ENTPERSON_ENTELEVEREGIME, + ENTPERSON_ENTELEVESTATUTELEVE, ENTPERSON_ENTELEVETRANSPORT, ENTPERSON_ENTPERSONADRESSEDIFFUSION, + ENTPERSON_ENTPERSONAUTRESMAILS, ENTPERSON_ENTPERSONAUTRESPRENOMS, ENTPERSON_ENTPERSONCODEPOSTAL, + ENTPERSON_ENTPERSONDATENAISSANCE, ENTPERSON_ENTPERSONFONCTIONS, ENTPERSON_ENTPERSONGARIDENTIFIANT, + ENTPERSON_ENTPERSONNOMPATRO, ENTPERSON_ENTPERSONPAYS, ENTPERSON_ENTPERSONPROFILS, ENTPERSON_ENTPERSONSEXE, + ENTPERSON_ENTPERSONSTRUCTRATTACH, ENTPERSON_ENTPERSONVILLE, ENTPERSON_ESCOAUXENSCODEMATIEREENSEIGNETAB, + ENTPERSON_ESCODOMAINES, ENTPERSON_ESCOELEVECODEENSEIGNEMENTS, ENTPERSON_ESCOPERSONETATCOMPTE, + ENTPERSON_ESCOPERSONEXTERNALIDS, ENTPERSON_ESCOPERSONPROFILS, ENTPERSON_ESCOSIREN, ENTPERSON_ESCOSIRENCOURANT, + ENTPERSON_ESCOUAI, ENTPERSON_ESCOUAICOURANT, ENTPERSON_ESCOUAIRATTACHEMENT) + .collect(Collectors.toSet()); + + public static final Set ALL_ATTRS = Stream.concat(PERSON_ATTRS.stream(), STRUCTURE_ATTRS.stream()).collect(Collectors.toSet()); + public static final Set PERSON_IDS_ATTRS = Stream.of(ENTPERSON_DN, ENTPERSON_UID, ENTPERSON_ESCOPERSONEXTERNALIDS, ENTPERSON_ENTPERSONGARIDENTIFIANT).collect(Collectors.toSet()); + + public static final Set MULTIVALUED_PERSON_ATTRs = + Stream.of(ENTPERSON_ISMEMBEROF, ENTPERSON_ENTAUXENSCATEGODISCIPLINE, ENTPERSON_ENTAUXENSGROUPES, ENTPERSON_ENTAUXENSGROUPESMATIERES, + ENTPERSON_ENTAUXENSMATIEREENSEIGNETAB, ENTPERSON_ENTAUXENSMEF, + ENTPERSON_ENTAUXNONENSCOLLLOCSERVICE, ENTPERSON_ENTELEVEADRESSEREL, ENTPERSON_ENTELEVECLASSES, + ENTPERSON_ENTELEVECODEENSEIGNEMENTS, ENTPERSON_ENTELEVEENSEIGNEMENTS, ENTPERSON_ENTELEVEGROUPES, + ENTPERSON_ENTELEVEPERSRELELEVE, ENTPERSON_ENTPERSONAUTRESMAILS, ENTPERSON_ENTPERSONAUTRESPRENOMS, + ENTPERSON_ENTPERSONFONCTIONS, ENTPERSON_ENTPERSONPROFILS, ENTPERSON_ESCOAUXENSCODEMATIEREENSEIGNETAB, + ENTPERSON_ESCODOMAINES, ENTPERSON_ESCOELEVECODEENSEIGNEMENTS, ENTPERSON_ESCOPERSONEXTERNALIDS, + ENTPERSON_ESCOPERSONPROFILS, ENTPERSON_ESCOSIREN, ENTPERSON_ESCOUAI) + .collect(Collectors.toSet()); + + public static final Set MONOVALUED_PERSON_ATTRs = + Stream.of(ENTPERSON_DN, ENTPERSON_UID, ENTPERSON_GIVENNAME, ENTPERSON_MAIL, ENTPERSON_PERSONALTITLE, + ENTPERSON_SN, ENTPERSON_CN, ENTPERSON_DISPLAYNAME, ENTPERSON_ENTELEVEFILIERE, ENTPERSON_ENTELEVELIBELLEMEF, + ENTPERSON_ENTELEVEMAJEUR, ENTPERSON_ENTELEVEMEF, ENTPERSON_ENTELEVENIVFORMATION, ENTPERSON_ENTELEVEREGIME, + ENTPERSON_ENTELEVESTATUTELEVE, ENTPERSON_ENTELEVETRANSPORT, ENTPERSON_ENTPERSONADRESSEDIFFUSION, + ENTPERSON_ENTPERSONCODEPOSTAL, ENTPERSON_ENTPERSONDATENAISSANCE, ENTPERSON_ENTPERSONGARIDENTIFIANT, + ENTPERSON_ENTPERSONNOMPATRO, ENTPERSON_ENTPERSONPAYS, ENTPERSON_ENTPERSONSEXE, + ENTPERSON_ENTPERSONSTRUCTRATTACH, ENTPERSON_ENTPERSONVILLE,ENTPERSON_ESCOPERSONETATCOMPTE, ENTPERSON_ESCOSIRENCOURANT, + ENTPERSON_ESCOUAICOURANT, ENTPERSON_ESCOUAIRATTACHEMENT) + .collect(Collectors.toSet()); +} diff --git a/src/main/java/fr/recia/si/ent/api/dao/impl/LdapDaoImpl.java b/src/main/java/fr/recia/si/ent/api/dao/impl/LdapDaoImpl.java new file mode 100644 index 0000000..cbe3ae5 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/dao/impl/LdapDaoImpl.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.dao.impl; + +import fr.recia.si.ent.api.config.bean.LDAPProperties; +import fr.recia.si.ent.api.dao.ILdapDao; +import fr.recia.si.ent.api.service.bean.IExtractOpaqueId; +import fr.recia.si.ent.api.service.bean.IExtractUIDFromDN; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.ldap.core.ContextMapper; +import org.springframework.ldap.core.LdapTemplate; +import org.springframework.ldap.query.LdapQuery; +import org.springframework.ldap.query.LdapQueryBuilder; +import org.springframework.stereotype.Service; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Service +@Data +@AllArgsConstructor +@NoArgsConstructor +@Slf4j +public class LdapDaoImpl implements ILdapDao { + + @Autowired + private LdapTemplate ldapTemplate; + + @Autowired + private LDAPProperties ldapProperties; + + @Autowired + private IExtractUIDFromDN extractUIDFromDN; + + + @Override + public Map findPersonFromStringFilter(@NotBlank final String filter, @NotEmpty final Set attributes, final IExtractOpaqueId extractOpaqueId) throws EmptyResultDataAccessException { + log.debug("findPersonFromStringFilter - LDAP filter applied '{}' and attributes requested '{}'", filter, attributes); + + // for security concern remove ids attributes from default building + ContextMapper> mapper = new PersonAttributesMapper(ldapProperties, attributes, extractOpaqueId); + LdapQuery query = LdapQueryBuilder.query().attributes(Stream.concat(LdapAttributes.PERSON_IDS_ATTRS.stream(), attributes.stream()) + .collect(Collectors.toSet()).toArray(String[]::new)) + .base(ldapProperties.getPeopleRootDn()) + .filter(filter); + return ldapTemplate.searchForObject(query, mapper); + } + + @Override + public List> findAllPersonFromStringFilter(@NotBlank final String filter, @NotEmpty final Set attributes, final IExtractOpaqueId extractOpaqueId) throws EmptyResultDataAccessException { + log.debug("findAllPersonFromStringFilter - LDAP filter applied '{}' and attributes requested '{}'", filter, attributes); + + + // for security concern remove ids attributes from default building + ContextMapper> mapper = new PersonAttributesMapper(ldapProperties, attributes, extractOpaqueId); + LdapQuery query = LdapQueryBuilder.query().attributes(Stream.concat(LdapAttributes.PERSON_IDS_ATTRS.stream(), attributes.stream()) + .collect(Collectors.toSet()).toArray(String[]::new)) + .base(ldapProperties.getPeopleRootDn()) + .filter(filter); + return ldapTemplate.search(query, mapper); + } +} diff --git a/src/main/java/fr/recia/si/ent/api/dao/impl/PersonAttributesMapper.java b/src/main/java/fr/recia/si/ent/api/dao/impl/PersonAttributesMapper.java new file mode 100644 index 0000000..a465667 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/dao/impl/PersonAttributesMapper.java @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +/** + * + */ +package fr.recia.si.ent.api.dao.impl; + +import fr.recia.si.ent.api.config.bean.LDAPProperties; +import fr.recia.si.ent.api.service.bean.IExtractOpaqueId; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.ldap.core.ContextMapper; +import org.springframework.ldap.core.DirContextAdapter; +import org.springframework.util.Assert; + +import javax.naming.NamingException; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +@Data +@AllArgsConstructor +@Slf4j +public class PersonAttributesMapper implements ContextMapper> { + +// @NotNull +// private IIDMapper userMapper; + private static final String USERID_ATTR = "id"; + + @NotNull + private LDAPProperties ldapProperties; + + @NotEmpty + private Set attributes; + + private IExtractOpaqueId extractOpaqueId; + + + @Override + public Map mapFromContext(Object ctx) throws NamingException { + Map person = new HashMap<>(); + + DirContextAdapter context = (DirContextAdapter) ctx; + + final String uid = context.getStringAttribute(LdapAttributes.ENTPERSON_UID); + final String userId = (extractOpaqueId != null) ? extractOpaqueId.getOpaqueId(context) : uid; + + log.debug("Ldap to Object Mapping for uid '{}' with userId {}", uid, userId); + Assert.hasText(userId, "Le userId ne peut pas être vide !"); + person.put(USERID_ATTR, userId); + + for (String attr : attributes) { + if (LdapAttributes.MONOVALUED_PERSON_ATTRs.contains(attr)) { + person.put(attr, context.getStringAttribute(attr)); + } else if (LdapAttributes.MULTIVALUED_PERSON_ATTRs.contains(attr)) { + person.put(attr, context.getStringAttributes(attr)); + } else { + throw new IllegalArgumentException("You have a misconfiguration in your LDAPAttributes class from property '" + attr + "'"); + } + } + log.debug("Ldap to Object Mapping for uid '{}' return object '{}'", uid, person); + return person; + } + +} diff --git a/src/main/java/fr/recia/pronote/ws/model/erreur/Erreur.java b/src/main/java/fr/recia/si/ent/api/model/erreur/Erreur.java similarity index 93% rename from src/main/java/fr/recia/pronote/ws/model/erreur/Erreur.java rename to src/main/java/fr/recia/si/ent/api/model/erreur/Erreur.java index 62f1a99..7748882 100644 --- a/src/main/java/fr/recia/pronote/ws/model/erreur/Erreur.java +++ b/src/main/java/fr/recia/si/ent/api/model/erreur/Erreur.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.model.erreur; +package fr.recia.si.ent.api.model.erreur; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/fr/recia/pronote/ws/model/erreur/ErreurWrapper.java b/src/main/java/fr/recia/si/ent/api/model/erreur/ErreurWrapper.java similarity index 91% rename from src/main/java/fr/recia/pronote/ws/model/erreur/ErreurWrapper.java rename to src/main/java/fr/recia/si/ent/api/model/erreur/ErreurWrapper.java index 8030c17..8b6ad51 100644 --- a/src/main/java/fr/recia/pronote/ws/model/erreur/ErreurWrapper.java +++ b/src/main/java/fr/recia/si/ent/api/model/erreur/ErreurWrapper.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.model.erreur; +package fr.recia.si.ent.api.model.erreur; import java.io.Serializable; diff --git a/src/main/java/fr/recia/pronote/ws/model/util/ZonedDateTimeAdapter.java b/src/main/java/fr/recia/si/ent/api/model/util/ZonedDateTimeAdapter.java similarity index 88% rename from src/main/java/fr/recia/pronote/ws/model/util/ZonedDateTimeAdapter.java rename to src/main/java/fr/recia/si/ent/api/model/util/ZonedDateTimeAdapter.java index 32f7e74..5d0611d 100644 --- a/src/main/java/fr/recia/pronote/ws/model/util/ZonedDateTimeAdapter.java +++ b/src/main/java/fr/recia/si/ent/api/model/util/ZonedDateTimeAdapter.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.model.util; +package fr.recia.si.ent.api.model.util; import java.time.ZoneId; import java.time.ZonedDateTime; diff --git a/src/main/java/fr/recia/pronote/ws/config/bean/Filter.java b/src/main/java/fr/recia/si/ent/api/service/SIENTAPIService.java similarity index 51% rename from src/main/java/fr/recia/pronote/ws/config/bean/Filter.java rename to src/main/java/fr/recia/si/ent/api/service/SIENTAPIService.java index d92b605..09531a0 100644 --- a/src/main/java/fr/recia/pronote/ws/config/bean/Filter.java +++ b/src/main/java/fr/recia/si/ent/api/service/SIENTAPIService.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,24 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.config.bean; +package fr.recia.si.ent.api.service; -import javax.validation.constraints.NotNull; +import fr.recia.si.ent.api.service.exception.NotFoundIdException; -import lombok.Data; -import org.springframework.validation.annotation.Validated; +import java.util.List; +import java.util.Map; -@Data -@Validated -public class Filter { - @NotNull - private String eleve; - @NotNull - private String personnel; - @NotNull - private String professeur; - @NotNull - private String responsable; - @NotNull - private String etablissement; +public interface SIENTAPIService { + Map getUserInfos(final String externalId) throws NotFoundIdException; + List> getChildrensOf(final String externalId) throws NotFoundIdException; } diff --git a/src/main/java/fr/recia/si/ent/api/service/SIENTAPIServiceImpl.java b/src/main/java/fr/recia/si/ent/api/service/SIENTAPIServiceImpl.java new file mode 100644 index 0000000..e5fa236 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/service/SIENTAPIServiceImpl.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.service; + +import fr.recia.si.ent.api.config.bean.APIClient; +import fr.recia.si.ent.api.config.bean.ApiEndpoints; +import fr.recia.si.ent.api.config.bean.AppConfProperties; +import fr.recia.si.ent.api.dao.ILdapDao; +import fr.recia.si.ent.api.dao.impl.LdapAttributes; +import fr.recia.si.ent.api.service.bean.IExtractOpaqueId; +import fr.recia.si.ent.api.service.exception.NotFoundIdException; +import fr.recia.si.ent.api.service.util.Pair; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +@Service +@Slf4j +public class SIENTAPIServiceImpl implements SIENTAPIService { + + @Autowired + private ILdapDao ldapDao; + @Autowired + private AppConfProperties appConfProperties; + @Autowired + private Map opaqueIdExtractors; + + @Autowired + @Qualifier("regroupementStructures") + private Map> regroupementStructures; + + + @Override + public List> getChildrensOf(final String externalId) throws NotFoundIdException { + final String clientId = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + final APIClient apiClient = appConfProperties.getClients().get(clientId); + + final Map parent = getUserInfos(externalId); + if (parent.isEmpty()) return new ArrayList<>(); + + if (apiClient != null) { + final APIClient.endPointsRequest endPointsRequest = apiClient.getEndPointsRequestMap().get(ApiEndpoints.CHILDRENS_OF); + if (endPointsRequest != null) { + final String uid = (String) parent.get(LdapAttributes.ENTPERSON_UID); + return ldapDao.findAllPersonFromStringFilter(String.format(endPointsRequest.getLdapFilter(), uid), + endPointsRequest.getLdapAttributes(), opaqueIdExtractors.get(clientId)); + } + } + log.warn("getChildrensOf: no child was found with id '{}' for clientId '{}'", externalId, clientId); + return new ArrayList<>(); + } + + public Map getUserInfos(final String externalId) throws NotFoundIdException { + final String clientId = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + final APIClient apiClient = appConfProperties.getClients().get(clientId); + return getUserInfos(externalId, apiClient, clientId); + } + + private Map getUserInfos(final String externalId, final APIClient apiClient, final String clientId) throws NotFoundIdException { + if (apiClient != null) { + final APIClient.endPointsRequest endPointsRequest = apiClient.getEndPointsRequestMap().get(ApiEndpoints.USER_INFO); + if (endPointsRequest != null) { + return ldapDao.findPersonFromStringFilter(String.format(endPointsRequest.getLdapFilter(), externalId), + endPointsRequest.getLdapAttributes(), opaqueIdExtractors.get(clientId)); + } + } + log.warn("getUserInfo: no person found with id '{}' for clientId '{}'", externalId, clientId); + throw new NotFoundIdException(String.format("Person with provided id '%s' for clientId '%s' wasn't found !", externalId, clientId)); + } + + + private Pair> getRegroupementStructures(final String idEtablissement) { + for (Map.Entry> entry : regroupementStructures.entrySet()) { + if (containsIgnoreCase(entry.getValue(), idEtablissement)) + return new Pair<>(entry.getKey(), entry.getValue()); + } + return new Pair<>(idEtablissement.toUpperCase(), Set.of(idEtablissement.toUpperCase())); + } + + private boolean containsIgnoreCase(final Set list, final String string) { + return list.stream().anyMatch(s -> s.equalsIgnoreCase(string)); + } + +} + + diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/IExtractOpaqueId.java b/src/main/java/fr/recia/si/ent/api/service/bean/IExtractOpaqueId.java similarity index 80% rename from src/main/java/fr/recia/pronote/ws/service/bean/IExtractOpaqueId.java rename to src/main/java/fr/recia/si/ent/api/service/bean/IExtractOpaqueId.java index 8e33daf..f373ee8 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/IExtractOpaqueId.java +++ b/src/main/java/fr/recia/si/ent/api/service/bean/IExtractOpaqueId.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean; - -import javax.naming.NamingException; +package fr.recia.si.ent.api.service.bean; import org.springframework.ldap.core.DirContextAdapter; +import javax.naming.NamingException; + public interface IExtractOpaqueId { String getOpaqueId(final DirContextAdapter context) throws NamingException; + + String getLdapAttribute(); } diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/IExtractUIDFromDN.java b/src/main/java/fr/recia/si/ent/api/service/bean/IExtractUIDFromDN.java similarity index 81% rename from src/main/java/fr/recia/pronote/ws/service/bean/IExtractUIDFromDN.java rename to src/main/java/fr/recia/si/ent/api/service/bean/IExtractUIDFromDN.java index 54c7c42..d38224b 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/IExtractUIDFromDN.java +++ b/src/main/java/fr/recia/si/ent/api/service/bean/IExtractUIDFromDN.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean; +package fr.recia.si.ent.api.service.bean; import java.util.List; diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/IStringCleaner.java b/src/main/java/fr/recia/si/ent/api/service/bean/IStringCleaner.java similarity index 82% rename from src/main/java/fr/recia/pronote/ws/service/bean/IStringCleaner.java rename to src/main/java/fr/recia/si/ent/api/service/bean/IStringCleaner.java index a19cbac..16b6943 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/IStringCleaner.java +++ b/src/main/java/fr/recia/si/ent/api/service/bean/IStringCleaner.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean; +package fr.recia.si.ent.api.service.bean; public interface IStringCleaner { /** diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/impl/ExtractOpaqueIdImpl.java b/src/main/java/fr/recia/si/ent/api/service/bean/impl/ExtractOpaqueIdImpl.java similarity index 52% rename from src/main/java/fr/recia/pronote/ws/service/bean/impl/ExtractOpaqueIdImpl.java rename to src/main/java/fr/recia/si/ent/api/service/bean/impl/ExtractOpaqueIdImpl.java index f3a1352..34be63d 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/impl/ExtractOpaqueIdImpl.java +++ b/src/main/java/fr/recia/si/ent/api/service/bean/impl/ExtractOpaqueIdImpl.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,35 +13,45 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean.impl; +package fr.recia.si.ent.api.service.bean.impl; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.naming.NamingException; -import javax.validation.constraints.NotBlank; - -import fr.recia.pronote.ws.dao.impl.LdapAttributes; -import fr.recia.pronote.ws.service.bean.IExtractOpaqueId; +import fr.recia.si.ent.api.config.bean.APIClient; +import fr.recia.si.ent.api.dao.impl.LdapAttributes; +import fr.recia.si.ent.api.service.bean.IExtractOpaqueId; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.springframework.ldap.core.DirContextAdapter; import org.springframework.util.Assert; +import javax.naming.NamingException; +import javax.validation.constraints.NotEmpty; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + @Slf4j public class ExtractOpaqueIdImpl implements IExtractOpaqueId { - private Pattern opaqueIdPattern; + private final Pattern opaqueIdPattern; + + @Getter + private final String ldapAttribute; + + public ExtractOpaqueIdImpl(final @NotEmpty APIClient.userOpaqueId userOpaqueId) { + this.opaqueIdPattern = Pattern.compile(userOpaqueId.getRegexp()); + this.ldapAttribute = userOpaqueId.getLdapAttribute(); + + Assert.isTrue( + LdapAttributes.ALL_ATTRS.stream().anyMatch(e -> e.equalsIgnoreCase(this.ldapAttribute)), + String.format("The ldapAttribute '%s' doesn't exist in LdapAttributes list %s", this.ldapAttribute, LdapAttributes.ALL_ATTRS )); - public ExtractOpaqueIdImpl(final @NotBlank String opaqueIdPattern) { - this.opaqueIdPattern = Pattern.compile(opaqueIdPattern); } @Override public String getOpaqueId(DirContextAdapter context) throws NamingException { - final String[] opaqueIds = context.getStringAttributes(LdapAttributes.ESCO_PERSON_EXTERNAL_IDS); + final String[] opaqueIds = context.getStringAttributes(ldapAttribute); Assert.isTrue(opaqueIds != null && opaqueIds.length > 0, - "L'ESCOPersonExternalIds ne peut pas être vide pour l'utilisateur " - + context.getStringAttribute(LdapAttributes.UID)); + "L'attribut '" + ldapAttribute + "' ne peut pas être vide pour l'utilisateur " + + context.getStringAttribute(LdapAttributes.ENTPERSON_UID)); for (String val : opaqueIds) { Matcher matcher = opaqueIdPattern.matcher(val); if (matcher.find()) { diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/impl/ExtractUIDFromDNImpl.java b/src/main/java/fr/recia/si/ent/api/service/bean/impl/ExtractUIDFromDNImpl.java similarity index 88% rename from src/main/java/fr/recia/pronote/ws/service/bean/impl/ExtractUIDFromDNImpl.java rename to src/main/java/fr/recia/si/ent/api/service/bean/impl/ExtractUIDFromDNImpl.java index c3a72d3..65f6d04 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/impl/ExtractUIDFromDNImpl.java +++ b/src/main/java/fr/recia/si/ent/api/service/bean/impl/ExtractUIDFromDNImpl.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean.impl; +package fr.recia.si.ent.api.service.bean.impl; import java.util.ArrayList; import java.util.List; @@ -22,7 +22,7 @@ import javax.validation.constraints.NotBlank; -import fr.recia.pronote.ws.service.bean.IExtractUIDFromDN; +import fr.recia.si.ent.api.service.bean.IExtractUIDFromDN; import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/src/main/java/fr/recia/pronote/ws/service/bean/impl/RegexGroupReplacementCleaner.java b/src/main/java/fr/recia/si/ent/api/service/bean/impl/RegexGroupReplacementCleaner.java similarity index 89% rename from src/main/java/fr/recia/pronote/ws/service/bean/impl/RegexGroupReplacementCleaner.java rename to src/main/java/fr/recia/si/ent/api/service/bean/impl/RegexGroupReplacementCleaner.java index 0fbc831..00e212c 100644 --- a/src/main/java/fr/recia/pronote/ws/service/bean/impl/RegexGroupReplacementCleaner.java +++ b/src/main/java/fr/recia/si/ent/api/service/bean/impl/RegexGroupReplacementCleaner.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.bean.impl; +package fr.recia.si.ent.api.service.bean.impl; import java.util.HashMap; import java.util.Map; @@ -23,8 +23,8 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; -import fr.recia.pronote.ws.config.bean.Cleaner; -import fr.recia.pronote.ws.service.bean.IStringCleaner; +import fr.recia.si.ent.api.config.bean.Cleaner; +import fr.recia.si.ent.api.service.bean.IStringCleaner; import lombok.Data; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/fr/recia/pronote/ws/service/exception/AuthorizedResourceException.java b/src/main/java/fr/recia/si/ent/api/service/exception/AuthorizedResourceException.java similarity index 83% rename from src/main/java/fr/recia/pronote/ws/service/exception/AuthorizedResourceException.java rename to src/main/java/fr/recia/si/ent/api/service/exception/AuthorizedResourceException.java index c9bda38..79de7a6 100644 --- a/src/main/java/fr/recia/pronote/ws/service/exception/AuthorizedResourceException.java +++ b/src/main/java/fr/recia/si/ent/api/service/exception/AuthorizedResourceException.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.exception; +package fr.recia.si.ent.api.service.exception; /** * Created by jgribonvald on 01/12/17. diff --git a/src/main/java/fr/recia/pronote/ws/service/exception/CustomRestRequestException.java b/src/main/java/fr/recia/si/ent/api/service/exception/CustomRestRequestException.java similarity index 83% rename from src/main/java/fr/recia/pronote/ws/service/exception/CustomRestRequestException.java rename to src/main/java/fr/recia/si/ent/api/service/exception/CustomRestRequestException.java index ede486d..acff336 100644 --- a/src/main/java/fr/recia/pronote/ws/service/exception/CustomRestRequestException.java +++ b/src/main/java/fr/recia/si/ent/api/service/exception/CustomRestRequestException.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.exception; +package fr.recia.si.ent.api.service.exception; /** * Created by jgribonvald on 12/06/17. diff --git a/src/main/java/fr/recia/pronote/ws/service/exception/ListRequestErrorException.java b/src/main/java/fr/recia/si/ent/api/service/exception/ListRequestErrorException.java similarity index 90% rename from src/main/java/fr/recia/pronote/ws/service/exception/ListRequestErrorException.java rename to src/main/java/fr/recia/si/ent/api/service/exception/ListRequestErrorException.java index 2cfa726..e35bf62 100644 --- a/src/main/java/fr/recia/pronote/ws/service/exception/ListRequestErrorException.java +++ b/src/main/java/fr/recia/si/ent/api/service/exception/ListRequestErrorException.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.exception; +package fr.recia.si.ent.api.service.exception; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/fr/recia/pronote/ws/service/exception/NotFoundIdException.java b/src/main/java/fr/recia/si/ent/api/service/exception/NotFoundIdException.java similarity index 78% rename from src/main/java/fr/recia/pronote/ws/service/exception/NotFoundIdException.java rename to src/main/java/fr/recia/si/ent/api/service/exception/NotFoundIdException.java index 0a28993..08e86d9 100644 --- a/src/main/java/fr/recia/pronote/ws/service/exception/NotFoundIdException.java +++ b/src/main/java/fr/recia/si/ent/api/service/exception/NotFoundIdException.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.exception; +package fr.recia.si.ent.api.service.exception; /** - * Created by jgribonvald on 01/12/17. + * Created by jgribonvald on 22/10/2024. */ public class NotFoundIdException extends Exception { diff --git a/src/main/java/fr/recia/pronote/ws/service/util/Pair.java b/src/main/java/fr/recia/si/ent/api/service/util/Pair.java similarity index 81% rename from src/main/java/fr/recia/pronote/ws/service/util/Pair.java rename to src/main/java/fr/recia/si/ent/api/service/util/Pair.java index 50685e7..ec6ac3a 100644 --- a/src/main/java/fr/recia/pronote/ws/service/util/Pair.java +++ b/src/main/java/fr/recia/si/ent/api/service/util/Pair.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.service.util; +package fr.recia.si.ent.api.service.util; import lombok.Data; import lombok.NonNull; diff --git a/src/main/java/fr/recia/pronote/ws/web/rest/HealthCheck.java b/src/main/java/fr/recia/si/ent/api/web/rest/HealthCheck.java similarity index 89% rename from src/main/java/fr/recia/pronote/ws/web/rest/HealthCheck.java rename to src/main/java/fr/recia/si/ent/api/web/rest/HealthCheck.java index 5a871b3..bd64358 100644 --- a/src/main/java/fr/recia/pronote/ws/web/rest/HealthCheck.java +++ b/src/main/java/fr/recia/si/ent/api/web/rest/HealthCheck.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.web.rest; +package fr.recia.si.ent.api.web.rest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/src/main/java/fr/recia/si/ent/api/web/rest/SIENTAPIResource.java b/src/main/java/fr/recia/si/ent/api/web/rest/SIENTAPIResource.java new file mode 100644 index 0000000..63dd0f7 --- /dev/null +++ b/src/main/java/fr/recia/si/ent/api/web/rest/SIENTAPIResource.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald + * + * Licensed 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. + */ +package fr.recia.si.ent.api.web.rest; + +import fr.recia.si.ent.api.config.bean.ApiEndpoints; +import fr.recia.si.ent.api.service.SIENTAPIService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping(value = "/api") +@Slf4j +public class SIENTAPIResource { + + @Autowired + private SIENTAPIService sientapiService; + + @RequestMapping(value = "/" + ApiEndpoints.CHILDRENS_OF + "/{externalId}", method = RequestMethod.GET, produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE}) + public ResponseEntity>> getChildrensOf(@PathVariable String externalId, HttpServletResponse response) { + log.info("Requesting childrens of {}", externalId); + try { + return new ResponseEntity>>(sientapiService.getChildrensOf(externalId), HttpStatus.OK); + } catch (EmptyResultDataAccessException ex) { + log.error(String.format(ApiEndpoints.CHILDRENS_OF + " - Personne '%s' non trouvée", externalId)); + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } catch (Exception e) { + log.error(ApiEndpoints.CHILDRENS_OF + " - ", e); + } + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } + + @RequestMapping(value = "/" + ApiEndpoints.USER_INFO + "/{externalId}", method = RequestMethod.GET, produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE}) + public ResponseEntity> getUserInfos(@PathVariable String externalId, HttpServletResponse response) { + log.info("Requesting User Infos of {}", externalId); + try { + return new ResponseEntity>(sientapiService.getUserInfos(externalId), HttpStatus.OK); + } catch (EmptyResultDataAccessException ex) { + log.error(String.format(ApiEndpoints.USER_INFO + " - Personne '%s' non trouvée", externalId)); + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } catch (Exception e) { + log.error(ApiEndpoints.USER_INFO + " - ", e); + } + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } + +} diff --git a/src/main/java/fr/recia/pronote/ws/web/rest/exception/GlobalExceptionHandler.java b/src/main/java/fr/recia/si/ent/api/web/rest/exception/GlobalExceptionHandler.java similarity index 90% rename from src/main/java/fr/recia/pronote/ws/web/rest/exception/GlobalExceptionHandler.java rename to src/main/java/fr/recia/si/ent/api/web/rest/exception/GlobalExceptionHandler.java index 3240461..4e1a49f 100644 --- a/src/main/java/fr/recia/pronote/ws/web/rest/exception/GlobalExceptionHandler.java +++ b/src/main/java/fr/recia/si/ent/api/web/rest/exception/GlobalExceptionHandler.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.web.rest.exception; +package fr.recia.si.ent.api.web.rest.exception; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import com.fasterxml.jackson.databind.ObjectMapper; -import fr.recia.pronote.ws.model.erreur.Erreur; -import fr.recia.pronote.ws.model.erreur.ErreurWrapper; -import fr.recia.pronote.ws.service.exception.AuthorizedResourceException; +import fr.recia.si.ent.api.model.erreur.Erreur; +import fr.recia.si.ent.api.model.erreur.ErreurWrapper; +import fr.recia.si.ent.api.service.exception.AuthorizedResourceException; import lombok.extern.slf4j.Slf4j; -import fr.recia.pronote.ws.service.exception.ListRequestErrorException; +import fr.recia.si.ent.api.service.exception.ListRequestErrorException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index dd0c59e..938faf0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ # -# Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ +# Copyright (C) 2020-2024 GIP-RECIA https://www.recia.fr/ # @Author (C) 2020 Julien Gribonvald # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 46d8069..5379772 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,5 @@ # -# Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ +# Copyright (C) 2020-2024 GIP-RECIA https://www.recia.fr/ # @Author (C) 2020 Julien Gribonvald # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +16,8 @@ server: port: ${appPort:8080} + tomcat: + max-http-header-size: 64KB # Spring MVC actuator endpoints available via /admin/info, /admin/health, ... #server.servlet-path: / @@ -25,9 +27,3 @@ server: management: endpoints: enabled: false - -app: - security: - authorizedIPAccess: - - 127.0.0.1 - diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 3c16a01..0d08981 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ @@ -60,6 +60,7 @@ + diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 5f31bae..377c3d0 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,7 +1,7 @@ - pronote-ws + si-ent-api diff --git a/src/main/resources/xsd/ConteneurImportChiffre.xsd b/src/main/resources/xsd/ConteneurImportChiffre.xsd deleted file mode 100644 index 4c31320..0000000 --- a/src/main/resources/xsd/ConteneurImportChiffre.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - Nom du partenaire - - - - - Commentaire libre pour désigner la nature du contenu chiffré - - - - - Chiffrement en RSA de la clé AES et du vecteur d'initialisation avec la clé publique Index-Education - - - - - - - - - - Données chiffrées en AES avec les informations de chiffrement présentes dans l'élément "Clé" - - - - - Hash SHA256 du contenu non chiffré - - - - - - UAI de l'établissement - - - - - - Version du format "conteneur" - - - - - diff --git a/src/main/resources/xsd/RapprochementSSO.xsd b/src/main/resources/xsd/RapprochementSSO.xsd deleted file mode 100644 index 911b395..0000000 --- a/src/main/resources/xsd/RapprochementSSO.xsd +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - Type représentant les identifiants uniques dans le référentiel du partenaire - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code RNE/UAI de l'établissement - - - - - - - - - - - - - - - - - - - - - - Permet d'importer la liste des établissements à initialiser dans la base EDT/PRONOTE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Obligatoire pour l'export vers SIECLE des privés - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Correspond au champ ID_NATIONAL de l'export SCONET - - - - - - - - - - - - - - - - - - - ID du partenaire ayant généré ce fichier (fourni par Index-Education) - - - - - - - - - - - - - diff --git a/src/test/java/fr/recia/pronote/ws/PronoteWsApplicationTests.java b/src/test/java/fr/recia/si/ent/api/SIENTAPIApplicationTests.java similarity index 83% rename from src/test/java/fr/recia/pronote/ws/PronoteWsApplicationTests.java rename to src/test/java/fr/recia/si/ent/api/SIENTAPIApplicationTests.java index 5211d95..15007b1 100644 --- a/src/test/java/fr/recia/pronote/ws/PronoteWsApplicationTests.java +++ b/src/test/java/fr/recia/si/ent/api/SIENTAPIApplicationTests.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws; +package fr.recia.si.ent.api; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -24,7 +24,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest @ActiveProfiles("test") -class PronoteWsApplicationTests { +class SIENTAPIApplicationTests { @Test void contextLoads() { diff --git a/src/test/java/fr/recia/pronote/ws/web/rest/HealthCheckTest.java b/src/test/java/fr/recia/si/ent/api/web/rest/HealthCheckTest.java similarity index 90% rename from src/test/java/fr/recia/pronote/ws/web/rest/HealthCheckTest.java rename to src/test/java/fr/recia/si/ent/api/web/rest/HealthCheckTest.java index 2bbe25f..400b0ac 100644 --- a/src/test/java/fr/recia/pronote/ws/web/rest/HealthCheckTest.java +++ b/src/test/java/fr/recia/si/ent/api/web/rest/HealthCheckTest.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.web.rest; +package fr.recia.si.ent.api.web.rest; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.head; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import javax.annotation.PostConstruct; - -import fr.recia.pronote.ws.web.rest.exception.GlobalExceptionHandler; +import fr.recia.si.ent.api.web.rest.exception.GlobalExceptionHandler; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -32,6 +27,11 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import javax.annotation.PostConstruct; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.head; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @ExtendWith(SpringExtension.class) @ActiveProfiles(value = "test") @Slf4j diff --git a/src/test/java/fr/recia/pronote/ws/web/rest/TestUtil.java b/src/test/java/fr/recia/si/ent/api/web/rest/TestUtil.java similarity index 93% rename from src/test/java/fr/recia/pronote/ws/web/rest/TestUtil.java rename to src/test/java/fr/recia/si/ent/api/web/rest/TestUtil.java index d4d81e1..6c09d7a 100644 --- a/src/test/java/fr/recia/pronote/ws/web/rest/TestUtil.java +++ b/src/test/java/fr/recia/si/ent/api/web/rest/TestUtil.java @@ -1,6 +1,6 @@ -/** - * Copyright (C) 2020 GIP-RECIA https://www.recia.fr/ - * @Author (C) 2020 Julien Gribonvald +/* + * Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ + * @Author (C) 2024 Julien Gribonvald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package fr.recia.pronote.ws.web.rest; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; +package fr.recia.si.ent.api.web.rest; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.http.MediaType; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + /** * Utility class for testing REST controllers. */ diff --git a/src/test/resources/application-test.yml b/src/test/resources/application-test.yml new file mode 100644 index 0000000..97fdc5a --- /dev/null +++ b/src/test/resources/application-test.yml @@ -0,0 +1,37 @@ +# +# Copyright (C) 2024 GIP-RECIA https://www.recia.fr/ +# @Author (C) 2024 Julien Gribonvald +# +# Licensed 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. +# + +server: + port: ${appPort:8080} + +# Spring MVC actuator endpoints available via /admin/info, /admin/health, ... +#server.servlet-path: / +#management.context-path: /admin + +# http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-endpoints +management: + endpoints: + enabled: false + +info: + app: + name: @project.artifactId@ + version: @project.version@ + +app: + security: + authorizedIPAccess: + - 127.0.0.1 \ No newline at end of file From f954ff9baf8f56827fb1b43bf49ca197f13d37f2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:47:37 +0000 Subject: [PATCH 2/2] chore(deps): update dependency com.mycila:license-maven-plugin-git to v4.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3fcdac6..2b952ec 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ UTF-8 11 - 4.5 + 4.6