Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ROBERT Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TousAntiCovid sources
ROBERT Server
Commits
268a413e
Commit
268a413e
authored
Sep 15, 2020
by
Julia StopCovid
Committed by
Deniro StopCovid
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Setting Robert Server WS
parent
d061a71d
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
189 additions
and
76 deletions
+189
-76
pom.xml
pom.xml
+13
-5
robert-server-common/src/main/java/fr/gouv/stopc/robert/server/common/service/IServerConfigurationService.java
...rt/server/common/service/IServerConfigurationService.java
+0
-6
robert-server-common/src/main/java/fr/gouv/stopc/robert/server/common/service/impl/ServerConfigurationServiceImpl.java
...r/common/service/impl/ServerConfigurationServiceImpl.java
+0
-5
robert-server-ws-rest/pom.xml
robert-server-ws-rest/pom.xml
+20
-35
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/RobertServerWsRestApplication.java
.../stopc/robertserver/ws/RobertServerWsRestApplication.java
+2
-2
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/config/WsServerConfiguration.java
...v/stopc/robertserver/ws/config/WsServerConfiguration.java
+25
-0
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/AbstractRegisterControllerImpl.java
...er/ws/controller/impl/AbstractRegisterControllerImpl.java
+4
-1
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/RegisterControllerImpl.java
...bertserver/ws/controller/impl/RegisterControllerImpl.java
+4
-2
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/RegisterInternalControllerImpl.java
...er/ws/controller/impl/RegisterInternalControllerImpl.java
+4
-2
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/StatusControllerImpl.java
...robertserver/ws/controller/impl/StatusControllerImpl.java
+9
-5
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/service/impl/AuthRequestValidationServiceImpl.java
...ver/ws/service/impl/AuthRequestValidationServiceImpl.java
+7
-2
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/utils/PropertyLoader.java
...a/fr/gouv/stopc/robertserver/ws/utils/PropertyLoader.java
+0
-3
robert-server-ws-rest/src/main/resources/application-dev.properties
...ver-ws-rest/src/main/resources/application-dev.properties
+64
-0
robert-server-ws-rest/src/main/resources/application.properties
...-server-ws-rest/src/main/resources/application.properties
+1
-3
robert-server-ws-rest/src/main/resources/bootstrap.yml
robert-server-ws-rest/src/main/resources/bootstrap.yml
+24
-0
robert-server-ws-rest/src/test/java/test/fr/gouv/stopc/robertserver/ws/StatusControllerWsRestTest.java
...ouv/stopc/robertserver/ws/StatusControllerWsRestTest.java
+7
-3
robert-server-ws-rest/src/test/resources/application.properties
...-server-ws-rest/src/test/resources/application.properties
+5
-2
No files found.
pom.xml
View file @
268a413e
...
...
@@ -48,6 +48,7 @@
</error_prone_annotations.version>
<postgresql.version>
42.2.12
</postgresql.version>
<bountycastle.version>
1.65
</bountycastle.version>
<spring-cloud.version>
Hoxton.SR5
</spring-cloud.version>
</properties>
<dependencies>
...
...
@@ -152,12 +153,19 @@
<version>
${postgresql.version}
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpkix-jdk15on
</artifactId>
<version>
${bountycastle.version}
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcpkix-jdk15on
</artifactId>
<version>
${bountycastle.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
${spring-cloud.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
...
robert-server-common/src/main/java/fr/gouv/stopc/robert/server/common/service/IServerConfigurationService.java
View file @
268a413e
...
...
@@ -18,10 +18,4 @@ public interface IServerConfigurationService {
* @return The duration of an epoch (in seconds)
*/
int
getEpochDurationSecs
();
/**
*
* @return The duration that must be covered by an epoch bundle returned in /register and /status (in days)
*/
int
getEpochBundleDurationInDays
();
}
robert-server-common/src/main/java/fr/gouv/stopc/robert/server/common/service/impl/ServerConfigurationServiceImpl.java
View file @
268a413e
...
...
@@ -53,9 +53,4 @@ public class ServerConfigurationServiceImpl implements IServerConfigurationServi
return
TimeUtils
.
EPOCH_DURATION_SECS
;
}
@Override
public
int
getEpochBundleDurationInDays
()
{
return
4
;
}
}
robert-server-ws-rest/pom.xml
View file @
268a413e
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<licenses>
...
...
@@ -16,7 +18,6 @@
<version>
1.6.0-SNAPSHOT
</version>
</parent>
<artifactId>
robert-server-ws-rest
</artifactId>
<packaging>
jar
</packaging>
<name>
robert-server-ws-rest
</name>
...
...
@@ -91,29 +92,32 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<!-- Micrometer core dependecy
-->
<!-- Micrometer core dependecy -->
<dependency>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-core
</artifactId>
</dependency>
<!-- Micrometer Prometheus registry
-->
<!-- Micrometer Prometheus registry -->
<dependency>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-registry-prometheus
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-vault-config-consul
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-consul-config
</artifactId>
</dependency>
</dependencies>
<build>
...
...
@@ -124,31 +128,12 @@
</plugin>
<!-- java.ws.rs-api verified as EPL 2.0 -->
<!-- Disabled because fails when not executed from each module's directory -->
<!--
<plugin>
<groupId>org.complykit</groupId>
<artifactId>license-check-maven-plugin</artifactId>
<version>0.5.3</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>os-check</goal>
</goals>
</execution>
</executions>
<configuration>
<blacklist>
<param>agpl-3.0</param>
<param>gpl-2.0</param>
<param>gpl-3.0</param>
</blacklist>
<excludes>
<param>javax.ws.rs:javax.ws.rs-api:2.1.1</param>
</excludes>
</configuration>
</plugin>
-->
<!-- <plugin> <groupId>org.complykit</groupId> <artifactId>license-check-maven-plugin</artifactId>
<version>0.5.3</version> <executions> <execution> <phase>verify</phase> <goals>
<goal>os-check</goal> </goals> </execution> </executions> <configuration>
<blacklist> <param>agpl-3.0</param> <param>gpl-2.0</param> <param>gpl-3.0</param>
</blacklist> <excludes> <param>javax.ws.rs:javax.ws.rs-api:2.1.1</param>
</excludes> </configuration> </plugin> -->
</plugins>
</build>
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/RobertServerWsRestApplication.java
View file @
268a413e
...
...
@@ -7,9 +7,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
@ComponentScan
(
basePackages
=
"fr.gouv.stopc"
)
@ComponentScan
(
basePackages
=
"fr.gouv.stopc"
)
@EnableMongoRepositories
(
basePackages
=
"fr.gouv.stopc"
)
@EnableAutoConfiguration
(
exclude
={
DataSourceAutoConfiguration
.
class
})
@EnableAutoConfiguration
(
exclude
=
{
DataSourceAutoConfiguration
.
class
})
@SpringBootApplication
public
class
RobertServerWsRestApplication
{
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/config/WsServerConfiguration.java
0 → 100644
View file @
268a413e
package
fr.gouv.stopc.robertserver.ws.config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
lombok.Getter
;
import
lombok.ToString
;
/*
* Global configuration of the Robert Server WS application, which is editable through Consul.
*/
@Getter
@ToString
@Component
@RefreshScope
public
class
WsServerConfiguration
{
@Value
(
"${robert.epoch-bundle-duration-in-days}"
)
private
Integer
epochBundleDurationInDays
;
@Value
(
"${robert.server.status-request-minimum-epoch-gap}"
)
private
Integer
statusRequestMinimumEpochGap
;
}
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/AbstractRegisterControllerImpl.java
View file @
268a413e
...
...
@@ -21,6 +21,7 @@ import fr.gouv.stopc.robertserver.database.model.ApplicationConfigurationModel;
import
fr.gouv.stopc.robertserver.database.model.Registration
;
import
fr.gouv.stopc.robertserver.database.service.IApplicationConfigService
;
import
fr.gouv.stopc.robertserver.database.service.IRegistrationService
;
import
fr.gouv.stopc.robertserver.ws.config.WsServerConfiguration
;
import
fr.gouv.stopc.robertserver.ws.dto.ClientConfigDto
;
import
fr.gouv.stopc.robertserver.ws.dto.RegisterResponseDto
;
import
fr.gouv.stopc.robertserver.ws.exception.RobertServerException
;
...
...
@@ -38,6 +39,8 @@ public abstract class AbstractRegisterControllerImpl {
protected
ICryptoServerGrpcClient
cryptoServerClient
;
protected
IRestApiService
restApiService
;
protected
WsServerConfiguration
wsServerConfiguration
;
protected
ResponseEntity
<
RegisterResponseDto
>
postCheckRegister
(
RegisterVo
registerVo
)
throws
RobertServerException
{
byte
[]
clientPublicECDHKey
=
Base64
.
decode
(
registerVo
.
getClientPublicECDHKey
());
...
...
@@ -46,7 +49,7 @@ public abstract class AbstractRegisterControllerImpl {
CreateRegistrationRequest
request
=
CreateRegistrationRequest
.
newBuilder
()
.
setClientPublicKey
(
ByteString
.
copyFrom
(
clientPublicECDHKey
))
.
setNumberOfDaysForEpochBundles
(
this
.
serverConfigurationService
.
getEpochBundleDurationInDays
())
.
setNumberOfDaysForEpochBundles
(
this
.
wsServerConfiguration
.
getEpochBundleDurationInDays
())
.
setServerCountryCode
(
ByteString
.
copyFrom
(
serverCountryCode
))
.
setFromEpochId
(
TimeUtils
.
getCurrentEpochFrom
(
this
.
serverConfigurationService
.
getServiceTimeStart
()))
.
build
();
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/RegisterControllerImpl.java
View file @
268a413e
...
...
@@ -10,6 +10,7 @@ import fr.gouv.stopc.robert.crypto.grpc.server.client.service.ICryptoServerGrpcC
import
fr.gouv.stopc.robert.server.common.service.IServerConfigurationService
;
import
fr.gouv.stopc.robertserver.database.service.IApplicationConfigService
;
import
fr.gouv.stopc.robertserver.database.service.IRegistrationService
;
import
fr.gouv.stopc.robertserver.ws.config.WsServerConfiguration
;
import
fr.gouv.stopc.robertserver.ws.controller.IRegisterController
;
import
fr.gouv.stopc.robertserver.ws.dto.RegisterResponseDto
;
import
fr.gouv.stopc.robertserver.ws.exception.RobertServerException
;
...
...
@@ -28,7 +29,8 @@ public class RegisterControllerImpl extends AbstractRegisterControllerImpl imple
final
IApplicationConfigService
applicationConfigService
,
final
CaptchaService
captchaService
,
final
ICryptoServerGrpcClient
cryptoServerClient
,
final
IRestApiService
restApiService
)
{
final
IRestApiService
restApiService
,
final
WsServerConfiguration
wsServerConfiguration
)
{
this
.
registrationService
=
registrationService
;
this
.
serverConfigurationService
=
serverConfigurationService
;
...
...
@@ -36,7 +38,7 @@ public class RegisterControllerImpl extends AbstractRegisterControllerImpl imple
this
.
captchaService
=
captchaService
;
this
.
cryptoServerClient
=
cryptoServerClient
;
this
.
restApiService
=
restApiService
;
this
.
wsServerConfiguration
=
wsServerConfiguration
;
}
@Override
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/RegisterInternalControllerImpl.java
View file @
268a413e
...
...
@@ -11,6 +11,7 @@ import fr.gouv.stopc.robert.crypto.grpc.server.client.service.ICryptoServerGrpcC
import
fr.gouv.stopc.robert.server.common.service.IServerConfigurationService
;
import
fr.gouv.stopc.robertserver.database.service.IApplicationConfigService
;
import
fr.gouv.stopc.robertserver.database.service.IRegistrationService
;
import
fr.gouv.stopc.robertserver.ws.config.WsServerConfiguration
;
import
fr.gouv.stopc.robertserver.ws.controller.IRegisterInternalController
;
import
fr.gouv.stopc.robertserver.ws.dto.RegisterResponseDto
;
import
fr.gouv.stopc.robertserver.ws.exception.RobertServerException
;
...
...
@@ -29,7 +30,8 @@ public class RegisterInternalControllerImpl extends AbstractRegisterControllerIm
final
IApplicationConfigService
applicationConfigService
,
final
CaptchaInternalService
captchaInternalService
,
final
ICryptoServerGrpcClient
cryptoServerClient
,
final
IRestApiService
restApiService
)
{
final
IRestApiService
restApiService
,
final
WsServerConfiguration
wsServerConfiguration
)
{
this
.
registrationService
=
registrationService
;
this
.
serverConfigurationService
=
serverConfigurationService
;
...
...
@@ -37,7 +39,7 @@ public class RegisterInternalControllerImpl extends AbstractRegisterControllerIm
this
.
captchaInternalService
=
captchaInternalService
;
this
.
cryptoServerClient
=
cryptoServerClient
;
this
.
restApiService
=
restApiService
;
this
.
wsServerConfiguration
=
wsServerConfiguration
;
}
@Override
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/controller/impl/StatusControllerImpl.java
View file @
268a413e
...
...
@@ -21,6 +21,7 @@ import fr.gouv.stopc.robertserver.database.model.ApplicationConfigurationModel;
import
fr.gouv.stopc.robertserver.database.model.Registration
;
import
fr.gouv.stopc.robertserver.database.service.IApplicationConfigService
;
import
fr.gouv.stopc.robertserver.database.service.IRegistrationService
;
import
fr.gouv.stopc.robertserver.ws.config.WsServerConfiguration
;
import
fr.gouv.stopc.robertserver.ws.controller.IStatusController
;
import
fr.gouv.stopc.robertserver.ws.dto.ClientConfigDto
;
import
fr.gouv.stopc.robertserver.ws.dto.StatusResponseDto
;
...
...
@@ -44,6 +45,8 @@ public class StatusControllerImpl implements IStatusController {
private
final
AuthRequestValidationService
authRequestValidationService
;
private
final
PropertyLoader
propertyLoader
;
private
final
WsServerConfiguration
wsServerConfiguration
;
private
final
IRestApiService
restApiService
;
...
...
@@ -54,14 +57,15 @@ public class StatusControllerImpl implements IStatusController {
final
IApplicationConfigService
applicationConfigService
,
final
AuthRequestValidationService
authRequestValidationService
,
final
PropertyLoader
propertyLoader
,
final
IRestApiService
restApiService
)
{
final
IRestApiService
restApiService
,
final
WsServerConfiguration
wsServerConfiguration
)
{
this
.
serverConfigurationService
=
serverConfigurationService
;
this
.
registrationService
=
registrationService
;
this
.
applicationConfigService
=
applicationConfigService
;
this
.
authRequestValidationService
=
authRequestValidationService
;
this
.
propertyLoader
=
propertyLoader
;
this
.
restApiService
=
restApiService
;
this
.
wsServerConfiguration
=
wsServerConfiguration
;
}
@Override
...
...
@@ -130,7 +134,7 @@ public class StatusControllerImpl implements IStatusController {
// Step #7: Check that epochs are not too distant
int
currentEpoch
=
TimeUtils
.
getCurrentEpochFrom
(
this
.
serverConfigurationService
.
getServiceTimeStart
());
int
epochDistance
=
currentEpoch
-
record
.
getLastStatusRequestEpoch
();
if
(
epochDistance
<
this
.
propertyLoader
.
getStatusRequestMinimumEpochGap
()
if
(
epochDistance
<
this
.
wsServerConfiguration
.
getStatusRequestMinimumEpochGap
()
&&
this
.
propertyLoader
.
getEsrLimit
()
!=
0
)
{
String
message
=
"Discarding ESR request because epochs are too close:"
;
...
...
@@ -140,12 +144,12 @@ public class StatusControllerImpl implements IStatusController {
record
.
getLastStatusRequestEpoch
(),
currentEpoch
,
epochDistance
,
this
.
propertyLoader
.
getStatusRequestMinimumEpochGap
());
this
.
wsServerConfiguration
.
getStatusRequestMinimumEpochGap
());
log
.
info
(
"{} {} < {} (tolerance)"
,
message
,
epochDistance
,
this
.
propertyLoader
.
getStatusRequestMinimumEpochGap
());
this
.
wsServerConfiguration
.
getStatusRequestMinimumEpochGap
());
record
.
setLastFailedStatusRequestEpoch
(
currentEpoch
);
record
.
setLastFailedStatusRequestMessage
(
errorMessage
);
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/service/impl/AuthRequestValidationServiceImpl.java
View file @
268a413e
...
...
@@ -21,6 +21,7 @@ import fr.gouv.stopc.robert.server.common.DigestSaltEnum;
import
fr.gouv.stopc.robert.server.common.service.IServerConfigurationService
;
import
fr.gouv.stopc.robert.server.common.utils.ByteUtils
;
import
fr.gouv.stopc.robert.server.common.utils.TimeUtils
;
import
fr.gouv.stopc.robertserver.ws.config.WsServerConfiguration
;
import
fr.gouv.stopc.robertserver.ws.service.AuthRequestValidationService
;
import
fr.gouv.stopc.robertserver.ws.vo.AuthRequestVo
;
import
fr.gouv.stopc.robertserver.ws.vo.StatusVo
;
...
...
@@ -39,13 +40,17 @@ public class AuthRequestValidationServiceImpl implements AuthRequestValidationSe
private
final
IRegistrationService
registrationService
;
private
final
WsServerConfiguration
wsServerConfiguration
;
@Inject
public
AuthRequestValidationServiceImpl
(
final
IServerConfigurationService
serverConfigurationService
,
final
ICryptoServerGrpcClient
cryptoServerClient
,
final
IRegistrationService
registrationService
)
{
final
IRegistrationService
registrationService
,
final
WsServerConfiguration
wsServerConfiguration
)
{
this
.
serverConfigurationService
=
serverConfigurationService
;
this
.
cryptoServerClient
=
cryptoServerClient
;
this
.
registrationService
=
registrationService
;
this
.
wsServerConfiguration
=
wsServerConfiguration
;
}
private
ResponseEntity
createErrorValidationFailed
()
{
...
...
@@ -177,7 +182,7 @@ public class AuthRequestValidationServiceImpl implements AuthRequestValidationSe
.
setTime
(
Integer
.
toUnsignedLong
(
ByteUtils
.
bytesToInt
(
Base64
.
decode
(
statusVo
.
getTime
()))))
.
setMac
(
ByteString
.
copyFrom
(
Base64
.
decode
(
statusVo
.
getMac
())))
.
setFromEpochId
(
TimeUtils
.
getCurrentEpochFrom
(
this
.
serverConfigurationService
.
getServiceTimeStart
()))
.
setNumberOfDaysForEpochBundles
(
this
.
serverConfigurationService
.
getEpochBundleDurationInDays
())
.
setNumberOfDaysForEpochBundles
(
this
.
wsServerConfiguration
.
getEpochBundleDurationInDays
())
.
setServerCountryCode
(
ByteString
.
copyFrom
(
new
byte
[]
{
this
.
serverConfigurationService
.
getServerCountryCode
()
}))
.
build
();
...
...
robert-server-ws-rest/src/main/java/fr/gouv/stopc/robertserver/ws/utils/PropertyLoader.java
View file @
268a413e
...
...
@@ -64,9 +64,6 @@ public class PropertyLoader {
@Value
(
"${robert.server.request-time-delta-tolerance}"
)
private
Integer
requestTimeDeltaTolerance
;
@Value
(
"${robert.server.status-request-minimum-epoch-gap}"
)
private
Integer
statusRequestMinimumEpochGap
;
@Value
(
"${robert.server.captcha-challenge-timestamp-tolerance}"
)
private
Integer
captchaChallengeTimestampTolerance
;
...
...
robert-server-ws-rest/src/main/resources/application-dev.properties
0 → 100644
View file @
268a413e
controller.path.prefix
=
/api
controller.internal.path.prefix
=
/internal/api
push.api.path
=
/push-token
push.api.path.token
=
/{token}
push.api.version
=
${PUSH_API_VERSION:/v1}
debug
=
${ROBERT_SERVER_DEBUG_ERRORS:false}
#spring.data.mongodb.authentication-database= # Authentication database name.
# Database name.
#spring.data.mongodb.database=${ROBERT_SERVER_DB_NAME:protectedRobertDB}
#spring.data.mongodb.field-naming-strategy= # Fully qualified name of the FieldNamingStrategy to use.
#spring.data.mongodb.grid-fs-database= # GridFS database name.
#spring.data.mongodb.host=${ROBERT_SERVER_DB_HOST:localhost}
# Mongo server host.
#spring.data.mongodb.password= # Login password of the mongo server.
# Mongo server port.
#spring.data.mongodb.port=${ROBERT_SERVER_DB_PORT:27017}
## Enable Mongo repositories.
server.port
=
${ROBERT_SERVER_PORT:8086}
## Use uri to be able to connect to replica sets / sharded clusters
## Giving a value to $ROBERT_SERVER_DB_URI will bypass ROBERT_SERVER_DB_HOST, ROBERT_SERVER_DB_PORT and ROBERT_SERVER_DB_NAME
spring.data.mongodb.uri
=
${ROBERT_SERVER_DB_URI:mongodb
\:
//${ROBERT_SERVER_DB_HOST:localhost}
\:
${ROBERT_SERVER_DB_PORT:27017}/${ROBERT_SERVER_DB_NAME:protectedRobertDB}}
# The hostname of the crypto server
robert.crypto.server.host
=
${ROBERT_CRYPTO_SERVER_HOST:localhost}
# The port of the crypto server
robert.crypto.server.port
=
${ROBERT_CRYPTO_SERVER_PORT:9090}
# Submission code server
submission.code.server.host
=
${SUBMISSION_CODE_SERVER_HOST:localhost}
submission.code.server.port
=
${SUBMISSION_CODE_SERVER_PORT:8087}
submission.code.server.verify.path
=
/api/v1/verify
captcha.secret
=
${CAPTCHA_SECRET}
captcha.hostname
=
${CAPTCHA_HOSTNAME:stopcovid.gouv.fr}
captcha.verify.url
=
${VERIFY_URL:https://www.google.com/recaptcha/api/siteverify}
# Internal captcha service
captcha.internal.gateway.enabled
=
${CAPTCHA_INTERNAL_GATEWAY_ENABLED:false}
captcha.internal.hostname
=
${CAPTCHA_INTERNAL_HOSTNAME:http://localhost:8055}
captcha.internal.verify.url
=
${CAPTCHA_INTERNAL_VERIFY_URL:http://localhost:8055/private/api/v1/captcha/{captchaId}/checkAnswer}
captcha.internal.success.code
=
${CAPTCHA_INTERNAL_SUCCESS_CODE:SUCCESS}
# Define the duration limit between Request
robert.esr.limit
=
${ESR_LIMIT:1}
# Available endpoints for the monitoring
management.endpoints.web.exposure.include
=
${ROBERT_SERVER_MONITORING_ENDPOINTS:health,metrics}
robert.server.country-code
=
${ROBERT_SERVER_COUNTRY_CODE:0x33}
robert.server.request-time-delta-tolerance
=
${ROBERT_SERVER_REQUEST_TIME_DELTA_TOLERANCE:60}
robert.server.status-request-minimum-epoch-gap
=
${ROBERT_SERVER_ESR_MINI_EPOCH_GAP:2}
robert.server.captcha-challenge-timestamp-tolerance
=
${ROBERT_SERVER_CAPTCHA_CHALLENGE_TIMESTAMP_TOLERANCE:15}
robert.server.time-start
=
${ROBERT_SERVER_TIMESTART:20200601}
push.server.host
=
${PUSH_SERVER_HOST:localhost}
push.server.port
=
${PUSH_SERVER_PORT:9096}
robert-server-ws-rest/src/main/resources/application.properties
View file @
268a413e
...
...
@@ -25,7 +25,6 @@ debug=${ROBERT_SERVER_DEBUG_ERRORS:false}
server.port
=
${ROBERT_SERVER_PORT:8086}
## Use uri to be able to connect to replica sets / sharded clusters
## Giving a value to $ROBERT_SERVER_DB_URI will bypass ROBERT_SERVER_DB_HOST, ROBERT_SERVER_DB_PORT and ROBERT_SERVER_DB_NAME
spring.data.mongodb.uri
=
${ROBERT_SERVER_DB_URI:mongodb
\:
//${ROBERT_SERVER_DB_HOST:localhost}
\:
${ROBERT_SERVER_DB_PORT:27017}/${ROBERT_SERVER_DB_NAME:protectedRobertDB}}
# The hostname of the crypto server
robert.crypto.server.host
=
${ROBERT_CRYPTO_SERVER_HOST:localhost}
...
...
@@ -48,7 +47,7 @@ captcha.internal.hostname=${CAPTCHA_INTERNAL_HOSTNAME:http://localhost:8055}
captcha.internal.verify.url
=
${CAPTCHA_INTERNAL_VERIFY_URL:http://localhost:8055/private/api/v1/captcha/{captchaId}/checkAnswer}
captcha.internal.success.code
=
${CAPTCHA_INTERNAL_SUCCESS_CODE:SUCCESS}
# Define the dura
n
tion limit between Request
# Define the duration limit between Request
robert.esr.limit
=
${ESR_LIMIT:1}
# Available endpoints for the monitoring
...
...
@@ -56,7 +55,6 @@ management.endpoints.web.exposure.include=${ROBERT_SERVER_MONITORING_ENDPOINTS:h
robert.server.country-code
=
${ROBERT_SERVER_COUNTRY_CODE:0x33}
robert.server.request-time-delta-tolerance
=
${ROBERT_SERVER_REQUEST_TIME_DELTA_TOLERANCE:60}
robert.server.status-request-minimum-epoch-gap
=
${ROBERT_SERVER_ESR_MINI_EPOCH_GAP:2}
robert.server.captcha-challenge-timestamp-tolerance
=
${ROBERT_SERVER_CAPTCHA_CHALLENGE_TIMESTAMP_TOLERANCE:15}
robert.server.time-start
=
${ROBERT_SERVER_TIMESTART:20200601}
...
...
robert-server-ws-rest/src/main/resources/bootstrap.yml
0 → 100644
View file @
268a413e
spring
:
application
:
name
:
robert-server
profiles
:
active
:
${SPRING_PROFILES_ACTIVE:dev}
cloud
:
consul
:
enabled
:
${CONSUL_ENABLED:false}
host
:
${CONSUL_HOST:localhost}
port
:
${CONSUL_PORT:8500}
scheme
:
${CONSUL_SCHEME:http}
token
:
${ROBERT_SERVER_CONSUL_ACL_TOKEN:token}
config
:
enabled
:
${CONSUL_CONFIG_ENABLED:false}
vault
:
enabled
:
${VAULT_ENABLED:false}
host
:
${VAULT_HOST:localhost}
port
:
${VAULT_PORT:8200}
token
:
${VAULT_TOKEN:token}
scheme
:
${VAULT_SCHEME:http}
robert-server-ws-rest/src/test/java/test/fr/gouv/stopc/robertserver/ws/StatusControllerWsRestTest.java
View file @
268a413e
...
...
@@ -60,6 +60,7 @@ import fr.gouv.stopc.robertserver.database.model.Registration;
import
fr.gouv.stopc.robertserver.database.service.impl.RegistrationService
;
import
fr.gouv.stopc.robertserver.ws.RobertServerWsRestApplication
;
import
fr.gouv.stopc.robertserver.ws.config.RobertServerWsConfiguration
;
import
fr.gouv.stopc.robertserver.ws.config.WsServerConfiguration
;
import
fr.gouv.stopc.robertserver.ws.dto.StatusResponseDto
;
import
fr.gouv.stopc.robertserver.ws.service.IRestApiService
;
import
fr.gouv.stopc.robertserver.ws.utils.PropertyLoader
;
...
...
@@ -114,6 +115,9 @@ public class StatusControllerWsRestTest {
@MockBean
private
PropertyLoader
propertyLoader
;
@MockBean
private
WsServerConfiguration
wsServerConfiguration
;
@MockBean
private
RobertServerWsConfiguration
config
;
...
...
@@ -134,7 +138,7 @@ public class StatusControllerWsRestTest {
this
.
currentEpoch
=
this
.
getCurrentEpoch
();
when
(
this
.
propertyLoader
.
getEsrLimit
()).
thenReturn
(-
1
);
when
(
this
.
propertyLoader
.
getStatusRequestMinimumEpochGap
()).
thenReturn
(
this
.
statusRequestMinimumEpochGap
);
when
(
this
.
wsServerConfiguration
.
getStatusRequestMinimumEpochGap
()).
thenReturn
(
this
.
statusRequestMinimumEpochGap
);
this
.
serverKey
=
this
.
generateKey
(
24
);
}
...
...
@@ -882,7 +886,7 @@ public class StatusControllerWsRestTest {
currentEpoch
,
currentEpoch
,
0
,
this
.
propertyLoader
.
getStatusRequestMinimumEpochGap
());
this
.
wsServerConfiguration
.
getStatusRequestMinimumEpochGap
());
byte
[]
idA
=
this
.
generateKey
(
5
);
byte
[]
kA
=
this
.
generateKA
();
...
...
@@ -941,7 +945,7 @@ public class StatusControllerWsRestTest {
currentEpoch
,
currentEpoch
,
0
,
this
.
propertyLoader
.
getStatusRequestMinimumEpochGap
());
this
.
wsServerConfiguration
.
getStatusRequestMinimumEpochGap
());
byte
[]
idA
=
this
.
generateKey
(
5
);
byte
[]
kA
=
this
.
generateKA
();
...
...
robert-server-ws-rest/src/test/resources/application.properties
View file @
268a413e
...
...
@@ -49,10 +49,13 @@ robert.esr.limit=1
robert.server.country-code
=
0x21
robert.server.request-time-delta-tolerance
=
60
robert.server.status-request-minimum-epoch-gap
=
2
robert.server.captcha-challenge-timestamp-tolerance
=
15
robert.server.time-start
=
20200601
push.server.host
=
localhost
push.server.port
=
8090
robert.epoch-bundle-duration-in-days
=
4
# Mobile application
robert.app.status-request-minimum-epoch-gap
=
2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment