diff --git a/docs/for-developers/configuration/gateway.md b/docs/for-developers/configuration/gateway.md index dac49f8061a40a15096ab0437e200330a54ebfac..2b16dacfcbdfbc415f9091c3086a000032787d21 100644 --- a/docs/for-developers/configuration/gateway.md +++ b/docs/for-developers/configuration/gateway.md @@ -10,15 +10,14 @@ description: >- #### General -| name | type | default | description | -| ------------------ | ------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 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. | -| 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 | -| 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/` | +| name | type | default | description | +| ------------------ | ------- | ------------------------------- | ------------------------------------------------------------------------------------------- | +| 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. | +| 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 | +| NODE\_ENV | string | dev | Value can be `prod` or `dev` | +| 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 diff --git a/docs/for-developers/gateway/authentication.md b/docs/for-developers/gateway/authentication.md index 6c8a63fa9d5e7bf3a606cca9069b135d6301f6f9..7e6f9bbc908a578da5b9966ae2f8a406cd49add5 100644 --- a/docs/for-developers/gateway/authentication.md +++ b/docs/for-developers/gateway/authentication.md @@ -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. -{% code title="engine.interface.ts" %} +{% code title="connector.interface.ts" %} ```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 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 -export interface IEngineService { +export interface Connector { // ... logout?(req: Request @@ -90,3 +90,37 @@ export interface IEngineService { ``` {% 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**.  + +{% 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  + +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 :  + +```typescript +request.user +``` + +This request's attribute is feed by strategy policies defined in the Gateway. Currently the following strategies are applied  + +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. +