JSON Web Token authentication

Overview

Authentication is required for the models that are in limited access. Authentication is managed into erecord by JWT (JSON Web Token). See more information.

If you want to use a model that is in limited access, you have to identify yourself.

In practice

To send a request about a simulator that is in limited access (GET vpz/input, POST vpz/output, POST vpz/report, GET slm/download…), you must identify yourself by giving an available JWT value as a jwt parameter of the request.

So you must previously have acquired an available JWT value : How to get a JWT (JSON Web Token).

A JWT value is available only for a limited duration so some days after having acquired it, you will have to ask for a new one.

Illustration

In this fictional example :

The user (username=”alphateam”, password=”ahpla2017”) has access authorization for some simulators that are in limited access, among which there is the simulator whose Id is 999.

Get an available JWT value

-> Example : In a webbrowser | In command line with cURL

As a result :

An available JWT value, corresponding with user “alphateam”, is :

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Ind3ZG10ZWFtIiwidXNlcl9pZCI6MiwiZW1haWwiOiIiLCJleHAiOjE0OTg4NjY2NjV9.kQhtSlfY0NWIXnig7p5J-wdq0_p81m5FwQc7gLze6vE

This JWT value is available for all the simulators that are authorized for user “alphateam”, in particular for the simulator whose Id is 999.

Use JWT value to access the simulator in limited access

With the JWT value previously got, one can send requests about the simulator whose Id is 999, in order to access its parameters values and/or simulation results.

In the following example, the sent requests are :

  1. Request GET vpz/input to see parameters values.
  2. Request POST vpz/output to simulate and get simulation results.
  3. Request POST vpz/report whose report result (containing parameters values and simulation results) will be downloaded later on (in 4.) (see option mode=todownload).
  4. Request GET slm/download to download the file report previously built (in 3.).

-> Example (1. 2. 3.) : In command line with cURL

-> Example (4.) : In a webbrowser