diff --git a/README.md b/README.md index 7ba04147a..e9a45a804 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Docker Pulls](https://img.shields.io/docker/pulls/michelin/suricate?label=Pulls&logo=docker&style=for-the-badge)](https://hub.docker.com/r/michelin/suricate/tags) [![Docker Stars](https://img.shields.io/docker/stars/michelin/suricate?label=Stars&logo=docker&style=for-the-badge)](https://hub.docker.com/r/michelin/suricate) [![SonarCloud Coverage](https://img.shields.io/sonar/coverage/michelin_suricate?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge)](https://sonarcloud.io/component_measures?id=michelin_suricate&metric=coverage&view=list) -[![SonarCloud Tests](https://img.shields.io/sonar/tests/michelin_suricate/master?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarcloud)](https://sonarcloud.io/component_measures?metric=tests&view=list&id=michelin_kstreamplify) +[![SonarCloud Tests](https://img.shields.io/sonar/tests/michelin_suricate/master?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarcloud)](https://sonarcloud.io/component_measures?metric=tests&view=list&id=michelin_suricate) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache&style=for-the-badge)](https://opensource.org/licenses/Apache-2.0) This repository contains the source code of the Suricate application. @@ -23,14 +23,16 @@ This repository contains the source code of the Suricate application. * [Default Configuration](#default-configuration) * [Database](#database) * [Authentication](#authentication) - * [LDAP vs Database](#ldap-vs-database) - * [Social Login](#social-login) - * [GitHub](#github) - * [GitLab](#gitlab) - * [Redirection to Front-End](#redirection-to-front-end) - * [Name Parsing Strategy](#name-parsing-strategy) - * [Personal Access Token](#personal-access-token) - * [Repositories](#repositories) + * [LDAP vs Database](#ldap-vs-database) + * [Social Login](#social-login) + * [GitHub](#github) + * [GitLab](#gitlab) + * [Redirection to Front-End](#redirection-to-front-end) + * [Name Parsing Strategy](#name-parsing-strategy) + * [Personal Access Token](#personal-access-token) + * [Widgets](#widgets) + * [Encryption](#encryption) + * [Repositories](#repositories) * [Swagger UI](#swagger-ui) * [Contribution](#contribution) @@ -68,7 +70,7 @@ default properties: docker-compose up -d ``` -Both Front-End and Back-End will be served on port 8080 by default. +After running the command, the application will be accessible on http://localhost:8080/. ## Configuration @@ -118,7 +120,7 @@ application.authentication.jwt.signingKey: 'changeitchangeitchangeitchangeit' application.authentication.jwt.tokenValidityMs: 86400000 ``` -The signing key should be at least 256 bits long and should be changed for each environment. +The signing key should be at least 256 bits long (since Suricate v2.8.0) and should be changed for each environment. #### Database @@ -130,12 +132,6 @@ You can choose this authentication mode using the following YAML property: application.authentication.provider: 'database' ``` -If you choose the database authentication mode, you must change the encryption password: - -```yaml -jasypt.encryptor.password: 'changeitchangeitchangeitchangeit' -``` - #### LDAP You can log in to Suricate an LDAP. @@ -256,7 +252,20 @@ It is recommended to update the _checksumSecret_ with a different secret for eac The _prefix_ is used by the application to identify the token type and parse it. -### Repositories +### Widgets + +Here is given the guidelines to configure the widgets. + +#### Encryption + +Sensitive widget parameters such as passwords or tokens are encrypted in the database. +You must change the encryption key for each environment using the following property: + +```yaml +jasypt.encryptor.password: changeitchangeitchangeitchangeit +``` + +#### Repositories The first time you start the application, you'll need to configure a repository of widgets. To do this, navigate to the repositories tab and add a new repository. You can choose to add either a local or remote repository (such as GitLab or diff --git a/src/main/java/com/michelin/suricate/model/dto/api/error/ApiErrorDto.java b/src/main/java/com/michelin/suricate/model/dto/api/error/ApiErrorDto.java index 6b1647b5e..288a00d8c 100644 --- a/src/main/java/com/michelin/suricate/model/dto/api/error/ApiErrorDto.java +++ b/src/main/java/com/michelin/suricate/model/dto/api/error/ApiErrorDto.java @@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils; /** - * Api error dto. + * Api error DTO. */ @Data @NoArgsConstructor @@ -59,6 +59,12 @@ public ApiErrorDto(ApiErrorEnum apiErrorEnum) { this.status = apiErrorEnum.getStatus().value(); } + /** + * Constructor. + * + * @param message The error message + * @param apiError The API error enum + */ public ApiErrorDto(String message, ApiErrorEnum apiError) { this(apiError); this.message = StringUtils.isBlank(message) ? apiError.getMessage() : message; diff --git a/src/main/java/com/michelin/suricate/services/js/script/JsEndpoints.java b/src/main/java/com/michelin/suricate/services/js/script/JsEndpoints.java index b0ea696af..068149269 100644 --- a/src/main/java/com/michelin/suricate/services/js/script/JsEndpoints.java +++ b/src/main/java/com/michelin/suricate/services/js/script/JsEndpoints.java @@ -16,6 +16,8 @@ package com.michelin.suricate.services.js.script; +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + import com.michelin.suricate.utils.exceptions.js.FatalException; import com.michelin.suricate.utils.exceptions.js.RemoteException; import com.michelin.suricate.utils.exceptions.js.RequestException; @@ -63,7 +65,7 @@ private static String executeRequest(String url, String headerName, String heade if (StringUtils.isNotBlank(body)) { builder.post( - RequestBody.create(body, MediaType.parse(org.springframework.http.MediaType.APPLICATION_JSON_VALUE))); + RequestBody.create(body, MediaType.parse(APPLICATION_JSON_VALUE))); } Request request = builder.build(); diff --git a/src/main/java/com/michelin/suricate/utils/exceptions/ApiException.java b/src/main/java/com/michelin/suricate/utils/exceptions/ApiException.java index e72531c1b..a76c56162 100644 --- a/src/main/java/com/michelin/suricate/utils/exceptions/ApiException.java +++ b/src/main/java/com/michelin/suricate/utils/exceptions/ApiException.java @@ -52,7 +52,7 @@ public ApiException(String message, ApiErrorEnum error) { /** * Method used to retrieve the error. * - * @return the APi error + * @return the API error */ public ApiErrorDto getError() { return error.toResponse(getMessage()); diff --git a/src/main/java/com/michelin/suricate/utils/http/OkHttpClientUtils.java b/src/main/java/com/michelin/suricate/utils/http/OkHttpClientUtils.java index cefc9575f..1584be6b5 100644 --- a/src/main/java/com/michelin/suricate/utils/http/OkHttpClientUtils.java +++ b/src/main/java/com/michelin/suricate/utils/http/OkHttpClientUtils.java @@ -82,7 +82,7 @@ public static OkHttpClient getUnsafeOkHttpClient() { } catch (NoSuchAlgorithmException e) { log.error("An error occurred during the OKHttpClient configuration: TLS algorithm not found", e); } catch (KeyManagementException e) { - log.error("An error occurred during the OKHttpClient configuration: Cannot init the SSL context", e); + log.error("An error occurred during the OKHttpClient configuration: Cannot init the TLS context", e); } return null;