Skip to content
Snippets Groups Projects
Commit 12bc182e authored by Steve Reis's avatar Steve Reis
Browse files

GitBook: [#33] No subject

parent 8e45d7d1
No related branches found
No related tags found
No related merge requests found
...@@ -10,15 +10,14 @@ description: >- ...@@ -10,15 +10,14 @@ description: >-
#### General #### General
| name | type | default | description | | name | type | default | description |
| ------------------ | ------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------ | ------- | ------------------------------- | ------------------------------------------------------------------------------------------- |
| ENGINE\_TYPE | string | exareme | Define the connector that should be used : **`exareme, datashield, csv, local`**. | | ENGINE\_TYPE | string | exareme | Define the connector that should be used : **`exareme, datashield, csv, local`**. |
| ENGINE\_BASE\_URL | string | http://127.0.0.1:8080/services/ | Specify the endpoint for the data source. The parameter will be provided for the connector. | | ENGINE\_BASE\_URL | string | http://127.0.0.1:8080/services/ | Specify the endpoint for the data source. The parameter will be provided for the connector. |
| TOS\_SKIP | boolean | false | Allow to skip the `terms of services` (this parameter is provided to the frontend) | | TOS\_SKIP | boolean | false | Allow to skip the `terms of services` (this parameter is provided to the frontend) |
| GATEWAY\_PORT | number | 8081 | Indicate the port that should be used by the gateway | | GATEWAY\_PORT | number | 8081 | Indicate the port that should be used by the gateway |
| NODE\_ENV | string | dev | Value can be `prod` or `dev` | | NODE\_ENV | string | dev | Value can be `prod` or `dev` |
| LOG\_LEVEL | number | 1 in production, 4 otherwise | <p>Values in range [1;4] <br>1: 'warn', 'error'<br>2: 'warn', 'error', 'log'</p><p>3: 'warn', 'error', 'log', 'verbose'<br>4: 'warn', 'error', 'log', 'verbose', 'debug'</p> | | BASE\_URL\_CONTEXT | string | null | Define context of the gateway. E.g. `api` if the api is under `http://127.0.0.1/api/` |
| BASE\_URL\_CONTEXT | string | null | Define context of the gateway. E.g. `api` if the api is under `http://127.0.0.1/api/` |
#### Authentication #### Authentication
......
...@@ -48,9 +48,9 @@ This field can be used by the connector to store information related to the user ...@@ -48,9 +48,9 @@ This field can be used by the connector to store information related to the user
The real login system is delegated to the connector by using the `login` method in the interface. The real login system is delegated to the connector by using the `login` method in the interface.
{% code title="engine.interface.ts" %} {% code title="connector.interface.ts" %}
```typescript ```typescript
export interface IEngineService { export interface Connector {
// ... // ...
/** /**
...@@ -77,9 +77,9 @@ When the login is performed, this function should return a `User` object and can ...@@ -77,9 +77,9 @@ When the login is performed, this function should return a `User` object and can
The same mechanism is applied to the logout system using the method logout from the engine. The same mechanism is applied to the logout system using the method logout from the engine.
{% code title="engine.interface.ts" %} {% code title="connector.interface.ts" %}
```typescript ```typescript
export interface IEngineService { export interface Connector {
// ... // ...
logout?(req: Request logout?(req: Request
...@@ -90,3 +90,37 @@ export interface IEngineService { ...@@ -90,3 +90,37 @@ export interface IEngineService {
``` ```
{% endcode %} {% endcode %}
#### Session validation
Whenever a Frontend required a refreshToken, the gateway should tell if the user is still connected to the engine. For this, your connector should implements the function **isSessionValid**.&#x20;
{% code title="connector.interface.ts" %}
```typescript
export interface Connector {
// ...
isSessionValid?(user: User): Promise<boolean>;
// ...
}
```
{% endcode %}
This function should ensure that the user can still access the engine with the current token.
#### How to get the user&#x20;
Whether you use the local login or a 3rd party system, there is a unique way to access the user inside the Gateway. This method through the request :&#x20;
```typescript
request.user
```
This request's attribute is feed by strategy policies defined in the Gateway. Currently the following strategies are applied&#x20;
1. JWT cookies
2. JWT bearer
3. Engine (use the connector to retrieve the user)
Even if the `AUTH_SKIP` is defined you should be able to retrieve the user through the request.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment