Commit 865b23cf authored by naji's avatar naji
Browse files

version marche mongo51

parent 901d6079
......@@ -12,7 +12,7 @@ spring:
register: false
data:
mongodb:
uri: mongodb://mongod_dbuser_iam:mongod_dbpwd_iam@localhost:27018/iam?connectTimeoutMS=2000
uri: mongodb://mongod_dbuser_iam:mongod_dbpwd_iam@10.100.129.51:27018/iam?connectTimeoutMS=2000
server-identity:
identityName: vitamui-dev
......
......@@ -13,6 +13,12 @@
<name>VITAMUI Pastis API External</name>
<description>Demo project for Spring Boot</description>
<properties>
<rpm.skip>false</rpm.skip>
<swagger.dir>api-external</swagger.dir>
<swagger.skip>false</swagger.skip>
</properties>
<dependencies>
<dependency>
......@@ -50,55 +56,6 @@
<artifactId>iam-security</artifactId>
</dependency>
<!--Start of Jaxb API and it's implementation and dependencies- Java11-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
<version>4.0.0-M2</version>
</dependency>
<!--End of Jaxb API and it's implementation and dependencies- Java11-->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>javax.xml.parsers</groupId>
<artifactId>jaxp-api</artifactId>
<version>1.4.5</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Documentation -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
<!-- Start of SpringBoot starter web (Tomcat by default) and starter test-->
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -149,18 +106,55 @@
<artifactId>opentracing-spring-jaeger-web-starter</artifactId>
</dependency>
<!-- Documentation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<!--Start of Jaxb API and it's implementation and dependencies- Java11-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
<version>4.0.0-M2</version>
</dependency>
<!--End of Jaxb API and it's implementation and dependencies- Java11-->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>javax.xml.parsers</groupId>
<artifactId>jaxp-api</artifactId>
<version>1.4.5</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- End of SpringBoot starter web and starter test-->
<dependency>
<groupId>com.fasterxml</groupId>
......@@ -229,122 +223,68 @@
<artifactId>gson</artifactId>
</dependency>
</dependencies>
<!-- Start of profiles -->
<profiles>
<!-- Profile 1 - Production -->
<profile>
<id>prod</id>
<!-- Start of production plugins -->
<build>
<plugins>
<!-- SpringBoot maven plugin-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<mainClass>fr.gouv.vitamui.pastis.PastisRestApplication</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<!-- Read the application.properties files with the properties plug-in -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/src/main/resources/application.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!-- Tests -->
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
</profile>
<!-- End of Prod profile -->
<!--TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui</groupId>
<artifactId>iam-external-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-test</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui</groupId>
<artifactId>iam-commons</artifactId>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<!-- Start of Dev profile -->
<profile>
<id>dev</id>
<build>
<!-- Start of dev profile plugins -->
<plugins>
<!-- SpringBoot maven plugin-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
</execution>
<execution>
<id>spring-boot-repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<attach>false</attach> <!-- Need to use the original jar for integration-tests -->
<mainClass>fr.gouv.vitamui.pastis.PastisRestApplication</mainClass>
<jvmArguments>-Xmx128m</jvmArguments>
<jvmArguments>-Xms512m</jvmArguments>
<arguments>
<argument>--spring.config.additional-location=file:src/main/config/ui-pastis-application-dev.yml</argument>
</arguments>
</configuration>
</plugin>
<!-- Read the application.properties files with the properties plug-in -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/src/main/resources/application.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- End of Dev profile -->
</dependencies>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
</execution>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<attach>false</attach> <!-- Need to use the original jar for integration-tests -->
<mainClass>fr.gouv.vitamui.pastis.external.PastisExternalApplication</mainClass>
<jvmArguments>-Xmx512m</jvmArguments>
<arguments>
<!-- use src/main/config/application-dev.yml when using mvn spring-boot:run -->
<!-- See : https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files -->
<argument>--spring.config.additional-location=file:${basedir}/src/main/config/pastis-external-application-dev.yml</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
debug: false
#Spring docs swagger
spring:
profiles:
active: swagger
cloud:
consul: #disabled for dev
enabled: false
......@@ -27,8 +26,8 @@ server:
port: 8015
ssl:
key-store: ../../../dev-deployment/environments/keystores/server/localhost/keystore_pastis-external.jks
key-store-password: changeme
key-password: changeme
key-store-password: dihZohGQRy12AHYLpboLaSaXkWl14uhopCZ2E5CcJoWfVrVm
key-password: dihZohGQRy12AHYLpboLaSaXkWl14uhopCZ2E5CcJoWfVrVm
trust-store: ../../../dev-deployment/environments/keystores/server/truststore_server.jks
trust-store-password: changeme
client-auth: need
......@@ -40,7 +39,7 @@ management:
enabled: false
archive-search-external:
pastis-external:
security-client:
server-host: localhost
server-port: 8084
......@@ -53,7 +52,15 @@ archive-search-external:
server-host: localhost
server-port: 7015
secure: false
# Jaeger
opentracing:
jaeger:
enabled: true
logSpans: true
expandExceptionLogs: true
udp-sender:
host: localhost
port: 6831
logging:
level:
fr.gouv.vitamui: DEBUG
......
......@@ -45,8 +45,13 @@ import fr.gouv.vitamui.iam.internal.client.UserInternalRestClient;
import fr.gouv.vitamui.iam.security.provider.ExternalApiAuthenticationProvider;
import fr.gouv.vitamui.iam.security.service.ExternalAuthentificationService;
import fr.gouv.vitamui.iam.security.service.ExternalSecurityService;
import fr.gouv.vitamui.pastis.external.service.ArchivalProfileUnitExternalService;
import fr.gouv.vitamui.pastis.internal.client.ArchivalProfileInternalWebClient;
import fr.gouv.vitamui.pastis.internal.client.ArchivalProfileUnitInternalRestClient;
import fr.gouv.vitamui.pastis.internal.client.PastisInternalRestClientFactory;
import fr.gouv.vitamui.pastis.internal.client.PastisInternalWebClientFactory;
import fr.gouv.vitamui.pastis.internal.client.ProfileInternalRestClient;
import fr.gouv.vitamui.pastis.internal.client.ProfileInternalWebClient;
import fr.gouv.vitamui.security.client.ContextRestClient;
import fr.gouv.vitamui.security.client.SecurityRestClientFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
......@@ -127,4 +132,30 @@ public class ApiPastisServerConfig extends AbstractContextConfiguration {
public ArchivalProfileUnitInternalRestClient archivalProfileInternalRestClient(final PastisInternalRestClientFactory pastisInternalRestClientFactory) {
return pastisInternalRestClientFactory.getArchivalProfileInternalRestClient();
}
@Bean
public ArchivalProfileInternalWebClient archivalProfileInternalWebClient(final PastisInternalWebClientFactory pastisInternalWebClientFactory) {
return pastisInternalWebClientFactory.getArchivalProfileInternalWebClient();
}
@Bean
public PastisInternalWebClientFactory pastisInternalWebClientFactory(final ApiPastisApplicationProperties pastisApplicationProperties) {
return new PastisInternalWebClientFactory(pastisApplicationProperties.getPastisInternalClient());
}
@Bean
public PastisInternalRestClientFactory pastisInternalRestClientFactory(final ApiPastisApplicationProperties pastisApplicationProperties,
final RestTemplateBuilder restTemplateBuilder ) {
return new PastisInternalRestClientFactory(pastisApplicationProperties.getPastisInternalClient(), restTemplateBuilder);
}
@Bean
public ProfileInternalWebClient profileInternalWebClient(final PastisInternalWebClientFactory pastisInternalWebClientFactory) {
return pastisInternalWebClientFactory.getProfileInternalWebClient();
}
@Bean
public ProfileInternalRestClient profileInternalRestClient(final PastisInternalRestClientFactory pastisInternalRestClientFactory) {
return new ProfileInternalRestClient( pastisInternalRestClientFactory.getRestTemplate(), pastisInternalRestClientFactory.getBaseUrl());
}
}
/*
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
[dad@cines.fr]
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
profiles based on the french SEDA standard
(https://redirect.francearchives.fr/seda/).
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
*/
package fr.gouv.vitamui.pastis.external.configuration;
import fr.gouv.vitamui.pastis.external.util.ProfileService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.Collections;
@Configuration
public class PastisConfiguration {
@Value("${cors.allowed-origins}")
private String origins;
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer () {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins(origins.split(","))
.allowCredentials(true);
}
};
}
@Bean
public ErrorViewResolver customErrorViewResolver() {
final ModelAndView redirectToIndexHtml = new ModelAndView("forward:/index.html", Collections.emptyMap(), HttpStatus.OK);
return (request, status, model) -> status == HttpStatus.NOT_FOUND ? redirectToIndexHtml : null;
}
}
......@@ -26,8 +26,11 @@ import java.util.stream.Collectors;
@Service
public class ArchivalProfileUnitExternalService extends AbstractResourceClientService<ArchivalProfileUnitDto, ArchivalProfileUnitDto> {
@Autowired
private ArchivalProfileUnitInternalRestClient archivalProfileUnitInternalRestClient;
@Autowired
private ArchivalProfileInternalWebClient archivalProfileInternalWebClient;
@Autowired
......
......@@ -73,7 +73,7 @@ public class ProfileExternalService extends AbstractResourceClientService<Profil
private ProfileInternalWebClient profileInternalWebClient;
@Autowired
public ProfileExternalService(@Autowired ExternalSecurityService externalSecurityService,
public ProfileExternalService(ExternalSecurityService externalSecurityService,
ProfileInternalRestClient profileInternalRestClient,
ProfileInternalWebClient profileInternalWebClient) {
super(externalSecurityService);
......
#Spring
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=11MB
spring.servlet.multipart.enabled=true
#Spring docs swagger
springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.path=/open-api.html
springdoc.model-and-view-allowed=false
# Pastis Rest APi
rng.base.file=rng/Profil_seda_pastis_mvp.rng
json.base.file=rng/ProfileJson.json
pua.definitions.file=pua_validation/ProfileJson.json
#PORT
server.port=8051
#CORS
cors.allowed-origins = https://dev.vitamui.com:4251, https://localhost
#Spring docs swagger
springdoc:
api-docs:
path: /api-docs
swagger-ui:
path: /open-api.html
model-and-view-allowed: false
# Pastis Rest APi
rng:
base:
file: rng/Profil_seda_pastis_mvp.rng
json:
base:
file: rng/ProfileJson.json
pua:
definitions:
file: pua_validation/ProfileJson.json
spring:
application:
name: ${server-identity.identityRole}
api:
name: API Pastis External
description: This API is used to manage Vitam's profile
version: v1
servlet:
multipart:
max-file-size: 10MB
max-request-size: 11MB
enabled: true
mvc:
favicon:
enabled: false
jackson:
serialization:
write-dates-as-timestamps: false
management:
endpoints:
jmx:
domain: ${server-identity.identityRole}
unique-names: true
web.exposure.include: info,health,prometheus
endpoint:
health:
show-details: always
prometheus:
enabled: true
swagger:
layer: api-external
file-path: file:../../../tools/swagger/docs/api-external/pastis-external/swagger.json