Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation regarding widget parameters encryption #823

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.commons.lang3.StringUtils;

/**
* Api error dto.
* Api error DTO.
*/
@Data
@NoArgsConstructor
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down