clean up some sphinx warnings
[dcaegen2.git] / docs / sections / services / dfc / http-notes.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 HTTP/HTTPS notes
5 ================
6
7 HTTP Basic Authentication in FileReady messages
8 """""""""""""""""""""""""""""""""""""""""""""""
9 File ready message for http server is the same like in other protocols. The only difference is scheme set to
10 "http". Processed uri is in the form of:
11
12 .. code-block:: bash
13
14    scheme://userinfo@host:port/path
15    i.e.
16    http://demo:demo123456!@example.com:80/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
17
18 If port number was not provided, port 80 is used by default.
19
20 Example file ready message is as follows:
21
22 .. code-block:: bash
23
24    curl --location --request POST 'https://portal.api.simpledemo.onap.org:30417/eventListener/v7' \
25    --header 'Content-Type: application/json' \
26    --header 'Authorization: Basic c2FtcGxlMTpzYW1wbGUx' \
27    --data-raw '{
28      "event": {
29        "commonEventHeader": {
30          "version": "4.0.1",
31          "vesEventListenerVersion": "7.0.1",
32          "domain": "notification",
33          "eventName": "Notification_gnb-Nokia_FileReady",
34          "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1",
35          "lastEpochMicrosec": 8745745764578,
36          "priority": "Normal",
37          "reportingEntityName": "NOK6061ZW3",
38          "sequence": 0,
39          "sourceName": "NOK6061ZW3",
40          "startEpochMicrosec": 8745745764578,
41          "timeZoneOffset": "UTC+05.30"
42        },
43        "notificationFields": {
44          "changeIdentifier": "PM_MEAS_FILES",
45          "changeType": "FileReady",
46          "notificationFieldsVersion": "2.0",
47          "arrayOfNamedHashMap": [
48            {
49              "name": "C_28532_measData_file.xml",
50              "hashMap": {
51                "location": "http://login:password@server.com:80/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz",
52                "compression": "gzip",
53                "fileFormatType": "org.3GPP.32.435#measCollec",
54                "fileFormatVersion": "V10"
55              }
56            }
57          ]
58        }
59      }
60    }'
61
62 Note, more than one file from the same location can be added to the "arrayOfNamedHashMap". If so, they are downloaded
63 from the endpoint through single http connection.
64
65 HTTPS connection with DFC
66 """""""""""""""""""""""""
67 The file ready message for https server is the same as used in other protocols and http. The only difference is that the scheme is set to
68 "https":
69
70 .. code-block:: json
71
72    {"arrayOfNamedHashMap": [
73            {
74              "name": "C_28532_measData_file.xml",
75              "hashMap": {
76                "location": "https://login:password@server.com:443/file.xml.gz"
77    }}]}
78
79 The processed uri depends on the https connection type that has to be established (client certificate authentication, basic
80 authentication, and no authentication).
81
82 For client certificate authentication:
83
84 .. code-block:: bash
85
86    scheme://host:port/path
87    i.e.
88    https://example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
89
90 Authentication is based on the certificate used by the DFC.
91
92 For basic authentication:
93
94 .. code-block:: bash
95
96    scheme://userinfo@host:port/path
97    i.e.
98    https://demo:demo123456!@example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
99
100 Authentication is based on the "userinfo" applied within the link.
101
102 If no authentication is required:
103
104 .. code-block:: bash
105
106    scheme://host:port/path
107    i.e.
108    https://example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
109
110 Note, effective way of authentication depends of uri provided and http server configuration.
111
112 If port number was not supplied , port 443 is used by default.
113 Every file is sent through separate https connection.
114
115 JWT token in HTTP/HTTPS connection
116 """"""""""""""""""""""""""""""""""
117
118 JWT token is processed, if it is provided as a ``access_token`` in the query part of the **location** entry:
119
120 .. code-block:: bash
121
122    scheme://host:port/path?access_token=<token>
123    i.e.
124    https://example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vIiwiaWF0IjoxNTE2MjM5MDIyfQ.MWyG1QSymi-RtG6pkiYrXD93ZY9NJzaPI-wS4MEpUto
125
126 JWT tokens are consumed both in HTTP and HTTPS connections. Using JWT token is optional. If it is provided, its
127 **validity is not verified**. Token is extracted to the HTTP header as ``Authorization: Bearer <token>`` and is **NOT**
128 used in URL in HTTP GET call. Only single JWT token entry in the query is acceptable. If more than one ''access_token''
129 entry is found in the query, such situation is reported as error and DFC tries to download file without token. Another
130 query parameters are not modified at all and are used in URL in HTTP GET call.
131
132 If both JWT token and basic authentication are provided, JWT token has the priority. Such situation is considered
133 as fault and is logged on warning level.