From 93d795a30ce6f3317898e97cc790c601472f2cd5 Mon Sep 17 00:00:00 2001 From: Michael Canales Date: Thu, 24 Nov 2022 18:44:35 +0100 Subject: [PATCH 01/17] Add alternative habilitation service for some campaigns --- .../api/service/impl/UtilsServiceImpl.java | 17 ++++++++++++++++- src/main/resources/application.properties | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java index 9101bd18..4bdeebde 100644 --- a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java +++ b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java @@ -49,6 +49,12 @@ public class UtilsServiceImpl implements UtilsService{ @Value("${fr.insee.queen.pilotage.service.url.port:#{null}}") private String pilotagePort; + @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.url}") + private String alternativeHabilitationServiceURL; + + @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds}") + private List campaignIdsWithAlternativeHabilitationService; + @Value("${fr.insee.queen.pilotage.integration.override:#{null}}") private String integrationOverride; @@ -181,8 +187,17 @@ else if (role.equals(Constants.REVIEWER)) } String idep = getIdepFromToken(request); - final String uriPilotageFilter = pilotageScheme + "://" + pilotageHost + ":" + pilotagePort + Constants.API_HABILITATION + "?id=" + suId + String uriPilotageFilter=""; + + if(campaignIdsWithAlternativeHabilitationService.indexOf(campaignId)>-1) { + uriPilotageFilter+=alternativeHabilitationServiceURL; + }else { + uriPilotageFilter+=pilotageScheme + "://" + pilotageHost + ":" + pilotagePort + Constants.API_HABILITATION; + } + + uriPilotageFilter += "?id=" + suId + "&role=" + expectedRole + "&campaign=" + campaignId + "&idep=" + idep; + String authTokenHeader = request.getHeader(Constants.AUTHORIZATION); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f2b5b2cb..d64fc2b5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -27,6 +27,9 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect #Other claim to read roles from in token fr.insee.queen.token.claim.role=inseegroupedefaut +##alternative habilitation service +fr.insee.queen.pilotage.alternative-habilitation-service.url=http://alternative.url +fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds=example1999x00,example2000x00 spring.jpa.open-in-view=false From 60cc5dffa15e5a8104a27f3239791ad0c29e07a2 Mon Sep 17 00:00:00 2001 From: Michael Canales Date: Wed, 7 Dec 2022 21:18:36 +0100 Subject: [PATCH 02/17] Add alternative habilitation improvements - Alternative Reviewer role property - Handling campaign Ids requiring an alternative habilitation service --- README.md | 1 + queenbo.properties | 1 + .../api/configuration/KeycloakConfig.java | 49 ++++++++++--------- .../configuration/SecurityConfiguration.java | 47 +++++++++--------- .../api/service/impl/UtilsServiceImpl.java | 11 +++-- src/main/resources/application.properties | 2 +- .../resources/application-test.properties | 1 + 7 files changed, 62 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 98c8c167..01153c63 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ keycloak.principal-attribute:preferred_username #Roles fr.insee.queen.interviewer.role=investigator fr.insee.queen.reviewer.role=reviewer +fr.insee.queen.reviewer-alternative.role=reviewer-alternative fr.insee.queen.admin.role=admin #Pilotage Api diff --git a/queenbo.properties b/queenbo.properties index 6e746ee9..26ff6db3 100644 --- a/queenbo.properties +++ b/queenbo.properties @@ -31,6 +31,7 @@ keycloak.principal-attribute:preferred_username #Keycloak roles fr.insee.queen.interviewer.role=investigator fr.insee.queen.reviewer.role=reviewer +fr.insee.queen.reviewer-alternative.role=reviewer-alternative fr.insee.queen.admin.role=admin fr.insee.queen.webclient.role=webclient diff --git a/src/main/java/fr/insee/queen/api/configuration/KeycloakConfig.java b/src/main/java/fr/insee/queen/api/configuration/KeycloakConfig.java index 21807979..613987a0 100644 --- a/src/main/java/fr/insee/queen/api/configuration/KeycloakConfig.java +++ b/src/main/java/fr/insee/queen/api/configuration/KeycloakConfig.java @@ -45,6 +45,9 @@ public class KeycloakConfig extends KeycloakWebSecurityConfigurerAdapter { @Value("${fr.insee.queen.reviewer.role:#{null}}") private String roleReviewer; + + @Value("${fr.insee.queen.reviewer-alternative.role:#{null}}") + private String roleReviewerAlternative; @Value("${fr.insee.queen.admin.role:#{null}}") private String roleAdmin; @@ -97,40 +100,40 @@ protected void configure(HttpSecurity http) throws Exception { .antMatchers("/swagger-ui.html/**", "/v2/api-docs","/csrf", "/", "/webjars/**", "/swagger-resources/**").permitAll() .antMatchers("/environnement", "/healthcheck").permitAll() // configuration for endpoints - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGNS) .hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGNS) .hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.GET, Constants.API_ADMIN_CAMPAIGNS).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST, Constants.API_CAMPAIGNS).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.DELETE, Constants.API_CAMPAIGN_ID).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST, Constants.API_CAMPAIGN_CONTEXT).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_SURVEY_UNITS).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_SURVEY_UNITS).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.POST, Constants.API_CAMPAIGN_ID_SURVEY_UNIT).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIRES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIREID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_REQUIREDNOMENCLATURES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIRES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIREID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_REQUIREDNOMENCLATURES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNITS).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNITS_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNITS_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.DELETE, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNIT_ID_TEMP_ZONE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNITS_TEMP_ZONE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DEPOSITPROOF).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNITS_TEMP_ZONE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DEPOSITPROOF).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.GET, Constants.API_NOMENCLATURES).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.POST, Constants.API_NOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_NOMENCLATURE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_REQUIREDNOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.POST, Constants.API_NOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_NOMENCLATURE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_REQUIREDNOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.POST, Constants.API_QUESTIONNAIREMODELS).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST,Constants.API_PARADATAEVENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) .antMatchers(HttpMethod.POST, Constants.API_CREATE_DATASET).hasAnyRole(roleAdmin, roleWebClient) diff --git a/src/main/java/fr/insee/queen/api/configuration/SecurityConfiguration.java b/src/main/java/fr/insee/queen/api/configuration/SecurityConfiguration.java index 9997f6da..0fd088c8 100644 --- a/src/main/java/fr/insee/queen/api/configuration/SecurityConfiguration.java +++ b/src/main/java/fr/insee/queen/api/configuration/SecurityConfiguration.java @@ -55,6 +55,9 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Value("${fr.insee.queen.reviewer.role:#{null}}") private String roleReviewer; + @Value("${fr.insee.queen.reviewer-alternative.role:#{null}}") + private String roleReviewerAlternative; + @Value("${fr.insee.queen.admin.role:#{null}}") private String roleAdmin; @@ -91,20 +94,20 @@ protected void configure(HttpSecurity http) throws Exception { // configuration for Swagger .antMatchers("/swagger-ui.html/**", "/v2/api-docs", "/csrf", "/", "/webjars/**", "/swagger-resources/**") .permitAll().antMatchers("/environnement", "/healthcheck").permitAll() - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGNS).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGNS).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.GET, Constants.API_ADMIN_CAMPAIGNS).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST, Constants.API_CAMPAIGNS).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.DELETE, Constants.API_CAMPAIGN_ID).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST, Constants.API_CAMPAIGN_CONTEXT).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_SURVEY_UNITS).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_SURVEY_UNITS).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.POST, Constants.API_CAMPAIGN_ID_SURVEY_UNIT).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIRES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIREID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_REQUIREDNOMENCLATURES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIRES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_QUESTIONAIREID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_CAMPAIGN_ID_REQUIREDNOMENCLATURES).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNITS).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNITS_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNITS_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) .antMatchers(HttpMethod.POST, Constants.API_SURVEYUNIT_ID_TEMP_ZONE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNITS_TEMP_ZONE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) @@ -112,21 +115,21 @@ protected void configure(HttpSecurity http) throws Exception { .antMatchers(HttpMethod.DELETE, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DEPOSITPROOF).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_DATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_COMMENT).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_STATEDATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_DEPOSITPROOF).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.PUT, Constants.API_SURVEYUNIT_ID_PERSONALIZATION).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.GET, Constants.API_NOMENCLATURES).hasAnyRole(roleAdmin, roleWebClient) - .antMatchers(HttpMethod.POST, Constants.API_NOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_NOMENCLATURE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) - .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_REQUIREDNOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer) + .antMatchers(HttpMethod.POST, Constants.API_NOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_NOMENCLATURE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_METADATA).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) + .antMatchers(HttpMethod.GET, Constants.API_QUESTIONNAIRE_ID_REQUIREDNOMENCLATURE).hasAnyRole(roleAdmin, roleWebClient, roleInterviewer, roleReviewer,roleReviewerAlternative) .antMatchers(HttpMethod.POST, Constants.API_QUESTIONNAIREMODELS).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST,Constants.API_PARADATAEVENT).hasAnyRole(roleAdmin, roleWebClient) .antMatchers(HttpMethod.POST, Constants.API_CREATE_DATASET).hasAnyRole(roleAdmin, roleWebClient) diff --git a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java index 4bdeebde..f5b0bdb1 100644 --- a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java +++ b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java @@ -4,6 +4,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Optional; +import java.util.regex.Pattern; import javax.servlet.http.HttpServletRequest; @@ -52,9 +53,9 @@ public class UtilsServiceImpl implements UtilsService{ @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.url}") private String alternativeHabilitationServiceURL; - @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds}") - private List campaignIdsWithAlternativeHabilitationService; - + @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds-regex}") + private String campaignIdRegexWithAlternativeHabilitationService; + @Value("${fr.insee.queen.pilotage.integration.override:#{null}}") private String integrationOverride; @@ -189,7 +190,8 @@ else if (role.equals(Constants.REVIEWER)) String uriPilotageFilter=""; - if(campaignIdsWithAlternativeHabilitationService.indexOf(campaignId)>-1) { + if(Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId)) { + LOGGER.info("Current campaignId {} requires an alternative habilitation service {} ",campaignId, alternativeHabilitationServiceURL); uriPilotageFilter+=alternativeHabilitationServiceURL; }else { uriPilotageFilter+=pilotageScheme + "://" + pilotageHost + ":" + pilotagePort + Constants.API_HABILITATION; @@ -250,4 +252,5 @@ public boolean isTestProfile() { } return false; } + } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d64fc2b5..811f8947 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -29,7 +29,7 @@ fr.insee.queen.token.claim.role=inseegroupedefaut ##alternative habilitation service fr.insee.queen.pilotage.alternative-habilitation-service.url=http://alternative.url -fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds=example1999x00,example2000x00 +fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds-regex=((edt)|(EDT))(\d|\S){1,} spring.jpa.open-in-view=false diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties index f0747a70..653bfe23 100644 --- a/src/test/resources/application-test.properties +++ b/src/test/resources/application-test.properties @@ -27,6 +27,7 @@ logging.level.root=INFO fr.insee.queen.interviewer.role=investigator fr.insee.queen.reviewer.role=reviewer +fr.insee.queen.reviewer-alternative.role=reviewer-alternative fr.insee.queen.admin.role=investigator #Keycloak configuration From 196ac08c3604fe03206bd101322412a341c1fccf Mon Sep 17 00:00:00 2001 From: Michael Canales Date: Sat, 14 Jan 2023 21:04:19 +0100 Subject: [PATCH 03/17] Update UtilsServiceImpl.java Add log to fix Habilitation Check --- .../insee/queen/api/service/impl/UtilsServiceImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java index f5b0bdb1..83611d07 100644 --- a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java +++ b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java @@ -190,6 +190,12 @@ else if (role.equals(Constants.REVIEWER)) String uriPilotageFilter=""; + LOGGER.info("campaignIdRegexWithAlternativeHabilitationService : {} " ,campaignIdRegexWithAlternativeHabilitationService); + LOGGER.info("alternativeHabilitationServiceURL : {} " ,alternativeHabilitationServiceURL); + LOGGER.info("campaignId : {} " ,campaignId); + LOGGER.info("Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId) : {} ",Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId) ); + + if(Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId)) { LOGGER.info("Current campaignId {} requires an alternative habilitation service {} ",campaignId, alternativeHabilitationServiceURL); uriPilotageFilter+=alternativeHabilitationServiceURL; @@ -214,6 +220,9 @@ else if (role.equals(Constants.REVIEWER)) request.getRemoteUser(), role, suId, resp.getStatusCode().toString()); return false; } + LOGGER.info("resp.getBody() " + resp.getBody()); + LOGGER.info("resp.getBody()).get(\"habilitated\") " + ((LinkedHashMap) resp.getBody()).get("habilitated")); + habilitationResult = Boolean.TRUE .equals(((LinkedHashMap) resp.getBody()).get("habilitated")); From 98b579f44fc8a9c831dcd807970684403919888d Mon Sep 17 00:00:00 2001 From: Michael Canales Date: Sat, 14 Jan 2023 21:58:00 +0100 Subject: [PATCH 04/17] Fix property name - fix camel case property for alternative habilitation service regex --- .../java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java | 2 +- src/main/resources/application.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java index 83611d07..27e1c1c7 100644 --- a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java +++ b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java @@ -53,7 +53,7 @@ public class UtilsServiceImpl implements UtilsService{ @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.url}") private String alternativeHabilitationServiceURL; - @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds-regex}") + @Value("${fr.insee.queen.pilotage.alternative-habilitation-service.campaignids-regex}") private String campaignIdRegexWithAlternativeHabilitationService; @Value("${fr.insee.queen.pilotage.integration.override:#{null}}") diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 811f8947..bc2011b4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -29,7 +29,7 @@ fr.insee.queen.token.claim.role=inseegroupedefaut ##alternative habilitation service fr.insee.queen.pilotage.alternative-habilitation-service.url=http://alternative.url -fr.insee.queen.pilotage.alternative-habilitation-service.campaignIds-regex=((edt)|(EDT))(\d|\S){1,} +fr.insee.queen.pilotage.alternative-habilitation-service.campaignids-regex=((edt)|(EDT))(\d|\S){1,} spring.jpa.open-in-view=false From c4a414cd3946f15c62f37688b889a6289d6cb678 Mon Sep 17 00:00:00 2001 From: Michael Canales Date: Mon, 16 Jan 2023 17:42:54 +0100 Subject: [PATCH 05/17] Update UtilsServiceImpl.java - remove useless log --- .../fr/insee/queen/api/service/impl/UtilsServiceImpl.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java index 27e1c1c7..c8f0d115 100644 --- a/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java +++ b/src/main/java/fr/insee/queen/api/service/impl/UtilsServiceImpl.java @@ -190,12 +190,6 @@ else if (role.equals(Constants.REVIEWER)) String uriPilotageFilter=""; - LOGGER.info("campaignIdRegexWithAlternativeHabilitationService : {} " ,campaignIdRegexWithAlternativeHabilitationService); - LOGGER.info("alternativeHabilitationServiceURL : {} " ,alternativeHabilitationServiceURL); - LOGGER.info("campaignId : {} " ,campaignId); - LOGGER.info("Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId) : {} ",Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId) ); - - if(Pattern.matches(campaignIdRegexWithAlternativeHabilitationService, campaignId)) { LOGGER.info("Current campaignId {} requires an alternative habilitation service {} ",campaignId, alternativeHabilitationServiceURL); uriPilotageFilter+=alternativeHabilitationServiceURL; @@ -220,8 +214,6 @@ else if (role.equals(Constants.REVIEWER)) request.getRemoteUser(), role, suId, resp.getStatusCode().toString()); return false; } - LOGGER.info("resp.getBody() " + resp.getBody()); - LOGGER.info("resp.getBody()).get(\"habilitated\") " + ((LinkedHashMap) resp.getBody()).get("habilitated")); habilitationResult = Boolean.TRUE .equals(((LinkedHashMap) resp.getBody()).get("habilitated")); From ac1f7f892f38d7726f5064773a23c73a348926f4 Mon Sep 17 00:00:00 2001 From: Eric Thuaud <58465319+EricThuaud@users.noreply.github.com> Date: Tue, 17 Jan 2023 16:45:10 +0100 Subject: [PATCH 06/17] report master hotfix - version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7090f49e..636473c2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.34 + 3.5.35 war Queen-Back-Office Back-office services for Queen From d74aeff7e09f08be94e1314b91c1ac8e8c82f4cb Mon Sep 17 00:00:00 2001 From: Eric Thuaud <58465319+EricThuaud@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:22:37 +0100 Subject: [PATCH 07/17] Variabilize internal ldap auth (#136) * build - upgrade version * fix - variabilize kc idp hint --- pom.xml | 2 +- queenbo.properties | 3 +++ .../queen/api/configuration/SwaggerConfiguration.java | 10 +++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 636473c2..5d3430da 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.35 + 3.5.36 war Queen-Back-Office Back-office services for Queen diff --git a/queenbo.properties b/queenbo.properties index 6e746ee9..3cc06082 100644 --- a/queenbo.properties +++ b/queenbo.properties @@ -20,6 +20,9 @@ fr.insee.queen.persistence.database.password = queen fr.insee.queen.persistence.database.driver = org.postgresql.Driver fr.insee.queen.defaultSchema=public +#Configure identity provider for swagger +fr.insee.queen.swagger.provider=sso-insee + #Keycloak configuration keycloak.realm=Queen keycloak.resource=Queen diff --git a/src/main/java/fr/insee/queen/api/configuration/SwaggerConfiguration.java b/src/main/java/fr/insee/queen/api/configuration/SwaggerConfiguration.java index 67000616..983be1c7 100644 --- a/src/main/java/fr/insee/queen/api/configuration/SwaggerConfiguration.java +++ b/src/main/java/fr/insee/queen/api/configuration/SwaggerConfiguration.java @@ -60,6 +60,9 @@ public class SwaggerConfiguration { @Value("${keycloak.auth-server-url}") private String authUrl; + @Value("${fr.insee.queen.swagger.provider:#{''}}") + String identityProvider; + public static final String SECURITY_SCHEMA_OAUTH2 = "oauth2"; @Autowired @@ -130,7 +133,12 @@ private List defaultAuth() { public SecurityConfiguration security() { Map additionalQueryStringParams = new HashMap<>(); - additionalQueryStringParams.put("kc_idp_hint", "sso-insee"); + if(identityProvider.isBlank()) { + additionalQueryStringParams.put("kc_idp_hint", "sso-insee"); + } + else{ + additionalQueryStringParams.put("kc_idp_hint", identityProvider); + } if (this.applicationProperties.getMode() == ApplicationProperties.Mode.keycloak) return SecurityConfigurationBuilder.builder().clientId(resource).realm(realm).scopeSeparator(",").additionalQueryStringParams(additionalQueryStringParams).build(); From 0a2b96dd5de2c3c80a240db83e8e41f0c1ce246b Mon Sep 17 00:00:00 2001 From: y72wvh Date: Tue, 21 Mar 2023 11:26:57 +0100 Subject: [PATCH 08/17] Update CampaignController.java --- .../java/fr/insee/queen/api/controller/CampaignController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/insee/queen/api/controller/CampaignController.java b/src/main/java/fr/insee/queen/api/controller/CampaignController.java index 255165a4..e369c6fc 100644 --- a/src/main/java/fr/insee/queen/api/controller/CampaignController.java +++ b/src/main/java/fr/insee/queen/api/controller/CampaignController.java @@ -212,6 +212,7 @@ public ResponseEntity deleteCampaignById(@RequestParam("force") Boolean } if(isDeletable){ campaignservice.delete(campaignOptional.get()); + evictCampaignFromCache.accept(id); LOGGER.info("DELETE campaign with id {} resulting in 200", id); return ResponseEntity.ok().build(); }else{ From a48daf28a5580badf9288ec6faf85ca08d452a20 Mon Sep 17 00:00:00 2001 From: Betty Becuwe <77614323+BettyB979@users.noreply.github.com> Date: Tue, 21 Mar 2023 17:43:23 +0100 Subject: [PATCH 09/17] Fix deposit proof for platine (#137) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update FoToPDFTransformation.java * Update FoToPDFTransformation.java * Update FoToPDFTransformation.java * Update fop.xconf * fix: fop cache uri * Update fop.xconf * Update fop.xconf * Update fop.xconf * fix: java solution? * Update FoToPDFTransformation.java * fix: desposit proof for platine * Update FoToPDFTransformation.java * Update src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java Co-authored-by: Simon Demazière --------- Co-authored-by: Simon Demazière --- pom.xml | 2 +- .../api/pdfutils/FoToPDFTransformation.java | 63 ++++++++++++------- src/main/resources/pdf/fop.xconf | 1 - 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 5d3430da..bf525737 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.36 + 3.5.37 war Queen-Back-Office Back-office services for Queen diff --git a/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java b/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java index c39ed7d1..cf2c4280 100755 --- a/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java +++ b/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java @@ -1,8 +1,13 @@ package fr.insee.queen.api.pdfutils; -import org.apache.fop.apps.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.nio.file.Path; import javax.xml.transform.Result; import javax.xml.transform.Source; @@ -10,39 +15,49 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; -import java.io.*; -import java.net.URI; + +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class FoToPDFTransformation { static Logger logger = LoggerFactory.getLogger(FoToPDFTransformation.class); public File transformFoToPdf(File foFile) throws Exception { - File outFilePDF = File.createTempFile("pdf-file",".pdf"); - try{ - File conf = new File(FoToPDFTransformation.class.getResource("/pdf/fop.xconf").toURI()); - InputStream isXconf = new FileInputStream(conf); + logger.info("foFile = " + foFile.getPath()); + File outFilePDF = File.createTempFile("pdf-file", ".pdf"); + try { + + InputStream isXconf = FoToPDFTransformation.class.getResourceAsStream("/pdf/fop.xconf"); + + URI folderBase = FoToPDFTransformation.class.getResource("/pdf/").toURI(); + + FopFactory fopFactory = FopFactory.newInstance(folderBase, isXconf); + + OutputStream out = new BufferedOutputStream(new FileOutputStream(outFilePDF)); - URI folderBase = FoToPDFTransformation.class.getResource("/pdf/").toURI(); - FopFactory fopFactory = FopFactory.newInstance(folderBase,isXconf); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); + + fopFactory.getFontManager().setCacheFile(Path.of(System.getProperty("java.io.tmpdir")).toUri()); - OutputStream out = new BufferedOutputStream(new FileOutputStream(outFilePDF)); + TransformerFactory factory = TransformerFactory.newInstance(); - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); - TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); - Transformer transformer = factory.newTransformer(); + Source src = new StreamSource(foFile); - Source src = new StreamSource(foFile); + Result res = new SAXResult(fop.getDefaultHandler()); - Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); - transformer.transform(src, res); - - out.close(); - } catch (Exception e){ - logger.error("Error during fo to pdf transformation :"+e.getMessage()); - } - return outFilePDF; + out.close(); + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error during fo to pdf transformation :" + e.getMessage()); + } + return outFilePDF; } } diff --git a/src/main/resources/pdf/fop.xconf b/src/main/resources/pdf/fop.xconf index 5446fd76..66da8f1d 100755 --- a/src/main/resources/pdf/fop.xconf +++ b/src/main/resources/pdf/fop.xconf @@ -9,7 +9,6 @@ - fonts From 307ef2a4b74a5230151c398b6ae11ca36ef15f84 Mon Sep 17 00:00:00 2001 From: y72wvh Date: Tue, 21 Mar 2023 17:47:13 +0100 Subject: [PATCH 10/17] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bf525737..ce690419 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.37 + 3.5.38 war Queen-Back-Office Back-office services for Queen From 7a7289eb176cc020292880bdb550c09503e43ba9 Mon Sep 17 00:00:00 2001 From: y72wvh Date: Thu, 30 Mar 2023 15:57:39 +0200 Subject: [PATCH 11/17] Update fop.xconf --- src/main/resources/pdf/fop.xconf | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/pdf/fop.xconf b/src/main/resources/pdf/fop.xconf index 66da8f1d..5ca668ac 100755 --- a/src/main/resources/pdf/fop.xconf +++ b/src/main/resources/pdf/fop.xconf @@ -10,6 +10,7 @@ value is specified as auto --> fonts + false From 352e56342dc7e03623649a0357aa8a2ba86e0485 Mon Sep 17 00:00:00 2001 From: y72wvh Date: Thu, 30 Mar 2023 17:38:43 +0200 Subject: [PATCH 12/17] Update fop.xconf --- src/main/resources/pdf/fop.xconf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/pdf/fop.xconf b/src/main/resources/pdf/fop.xconf index 5ca668ac..aea49b1a 100755 --- a/src/main/resources/pdf/fop.xconf +++ b/src/main/resources/pdf/fop.xconf @@ -10,8 +10,9 @@ value is specified as auto --> fonts - false - + true + /opt/tomcat/temp/fop.cache + From 38e837711073e10bc2131b8ebe8dcb09c9390eb4 Mon Sep 17 00:00:00 2001 From: y72wvh Date: Fri, 31 Mar 2023 09:55:22 +0200 Subject: [PATCH 13/17] fix: deposit proof --- .../fr/insee/queen/api/pdfutils/FoToPDFTransformation.java | 4 ++-- src/main/resources/pdf/fop.xconf | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java b/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java index cf2c4280..a8f4e8c7 100755 --- a/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java +++ b/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java @@ -36,13 +36,13 @@ public File transformFoToPdf(File foFile) throws Exception { URI folderBase = FoToPDFTransformation.class.getResource("/pdf/").toURI(); FopFactory fopFactory = FopFactory.newInstance(folderBase, isXconf); + + fopFactory.getFontManager().setCacheFile(Path.of(System.getProperty("java.io.tmpdir")).toUri()); OutputStream out = new BufferedOutputStream(new FileOutputStream(outFilePDF)); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); - fopFactory.getFontManager().setCacheFile(Path.of(System.getProperty("java.io.tmpdir")).toUri()); - TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); diff --git a/src/main/resources/pdf/fop.xconf b/src/main/resources/pdf/fop.xconf index aea49b1a..24888a4a 100755 --- a/src/main/resources/pdf/fop.xconf +++ b/src/main/resources/pdf/fop.xconf @@ -10,9 +10,7 @@ value is specified as auto --> fonts - true - /opt/tomcat/temp/fop.cache - + From 70a33960642ff8b11610e8ef5571d74bfda3b834 Mon Sep 17 00:00:00 2001 From: y72wvh Date: Fri, 31 Mar 2023 10:12:55 +0200 Subject: [PATCH 14/17] build: version 3.5.39 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ce690419..432d9ea1 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.38 + 3.5.39 war Queen-Back-Office Back-office services for Queen From 7c876b6dab64e8fd9b9a691cf884064d486e9ce3 Mon Sep 17 00:00:00 2001 From: Betty Becuwe <77614323+BettyB979@users.noreply.github.com> Date: Fri, 31 Mar 2023 14:11:18 +0200 Subject: [PATCH 15/17] Fix fop2 (#141) * Update FoToPDFTransformation.java * Update pom.xml --- pom.xml | 2 +- .../java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 432d9ea1..b3dcfeac 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.39 + 3.5.40 war Queen-Back-Office Back-office services for Queen diff --git a/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java b/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java index a8f4e8c7..f099a019 100755 --- a/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java +++ b/src/main/java/fr/insee/queen/api/pdfutils/FoToPDFTransformation.java @@ -37,7 +37,7 @@ public File transformFoToPdf(File foFile) throws Exception { FopFactory fopFactory = FopFactory.newInstance(folderBase, isXconf); - fopFactory.getFontManager().setCacheFile(Path.of(System.getProperty("java.io.tmpdir")).toUri()); + fopFactory.getFontManager().setCacheFile(Path.of(System.getProperty("java.io.tmpdir")+"/fop.cache").toUri()); OutputStream out = new BufferedOutputStream(new FileOutputStream(outFilePDF)); From 0ac0a409ca170c832fd5f8de5f5dbfbef97046b7 Mon Sep 17 00:00:00 2001 From: Eric Thuaud <58465319+EricThuaud@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:29:39 +0200 Subject: [PATCH 16/17] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b3dcfeac..8d9309a3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.40 + 3.5.41 war Queen-Back-Office Back-office services for Queen From 89c227ec054d07e2b7c2540bef901b4797bf2767 Mon Sep 17 00:00:00 2001 From: Eric Thuaud <58465319+EricThuaud@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:05:29 +0200 Subject: [PATCH 17/17] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8d9309a3..53c643c2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.insee.queen queen - 3.5.41 + 3.5.42 war Queen-Back-Office Back-office services for Queen