Wiki source code of Authentification endpoints
Version 8.1 by Outhman Moustaghfir on 2022/06/13 13:17
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = Introduction = | ||
2 | |||
3 | This documentation describes how to get authenticated to the iXPath App. | ||
4 | |||
5 | |||
6 | = Validation = | ||
7 | |||
8 | The endpoint should verify those points : | ||
9 | |||
10 | - Encrypt the password with SHA256 algorithms | ||
11 | |||
12 | - Verify if the user's environment is active | ||
13 | |||
14 | - Remove all unnecessary verifications (Env's verification) | ||
15 | |||
16 | - Verify if the user is activated. | ||
17 | |||
18 | - Throw errors 401 and 403 for the authentication failure. | ||
19 | |||
20 | = Endpoints = | ||
21 | |||
22 | |(% style="width:162px" %)**URL [method]**|(% style="width:284px" %)**Description**|(% style="width:580px" %)**Input example**|(% style="width:472px" %)**Output example** | ||
23 | |(% style="width:162px" %)/auth [POST]|(% style="width:284px" %)generate a token to get access to all other endpoints.|(% style="width:580px" %)((( | ||
24 | The input data must be placed in the **//__JSON body__ //**of the request as the following example : | ||
25 | |||
26 | {{code language="json"}} | ||
27 | { | ||
28 | "user" : "user1", | ||
29 | "password" : "abcd.12345", | ||
30 | "env" : "iXPath" | ||
31 | } | ||
32 | {{/code}} | ||
33 | |||
34 | __NB__ : "user" and "password" are **mandatory**. | ||
35 | |||
36 | meanwhile, "env" param could be generated automatically if it is **not** **mentioned** or **no more active**. | ||
37 | )))|(% style="width:472px" %){{code language="JSON" layout="LINENUMBERS"}}{ | ||
38 | "timestamp": 1637162043978, | ||
39 | "status": "200", | ||
40 | "data": { | ||
41 | "Token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsI | ||
42 | mlkIjoiMSIsImVudiI6ImlYUGF0aCIsInRpbWUiOjE2Njg2OTgwNDM | ||
43 | 0OTN9.0aiAL7BHTanzm1yrELOOaHonWOqPddaUu26lL1GpAJJ6MPxK9eUta | ||
44 | RAi2m_gV8OhcYhPE_wgu8lESxMevT90YA", | ||
45 | "Expiration_date": "2022/11/17 16:14:03", | ||
46 | "Default_env": "iXPath" | ||
47 | } | ||
48 | }{{/code}} | ||
49 | |||
50 | = Possible errors or exceptions = | ||
51 | |||
52 | * If information is not filled in correctly or the user doesn't exist, the response will look like this example : | ||
53 | |||
54 | {{code language="JSON" layout="LINENUMBERS"}} | ||
55 | { | ||
56 | "timestamp": 1637164878357, | ||
57 | "status": "401", | ||
58 | "error": "the user's information not found : user, password", | ||
59 | "thechnicalError": "the user's information not found : user, password" | ||
60 | } | ||
61 | {{/code}} |