Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Query proxy
## Features
This proxy provides an interface between the data portal, which use cookies and JWT token as authentication means, and the server hosting map services and dataset related files which only understands basic authentication.
The proxy plays a role in to functionalities of the portal:
- the display of data on the map
- the download of the data under different output formats
Depending on the dataset's license, those services/files might be in open access or restricted access. Our goal is to display to a particular user exactly what it's accesses are allowing him to see.
Though, in order for the map to work properly and to always be able to display the full data on the portal, it has been decided that WMS would always be opened even if the user doesn't have access to the dataset.
## Dependencies
The dependencies of the proxy are:
- `Elasticsearch`: used to verify whether a dataset is in open access or not, and if the user has access to the MVT layer pour the /map endpoints
- `Legacy auth Middleware`: used to verify if the user has access to the service of the requested layer
- `MapServer`: which expose the WMS and MVT services
- the server hosting static files
## Endpoints
It provides the following endpoints:
- `/map`: which proxy requests for the map feature, the sub-routes are:
- `/wms`: which proxy requests to the WMS service
- `/mvt`: which proxy requests to the MVT service
- `/ign`: which proxy requests to the IGN ortho layer adding the API key
- `/download`: which proxy requests for the download feature, the sub-routes are
- `/wms`
- `/wfs`
- `/ws`
- `/kml`
- `/wcs`
- `/files`
- `/catalogue`
## Implementation
This proxy has been written in [Node.js](https://nodejs.org/) using the framework [Express](https://expressjs.com/) and the [http-proxy](https://github.com/http-party/node-http-proxy) node module to proxy requests.
The following diagram explains the logic implemented behind /map:

The following diagram sequence explains what is happening behind the `/download` endpoint.
