c45c7bd8de4d7057726d88e4d513cfb47e95d4f7
[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:: bash
71
72    ...
73    "arrayOfNamedHashMap": [
74            {
75              "name": "C_28532_measData_file.xml",
76              "hashMap": {
77                "location": "https://login:password@server.com:443/file.xml.gz",
78    ...
79
80 The processed uri depends on the https connection type that has to be established (client certificate authentication, basic
81 authentication, and no authentication).
82
83 For client certificate authentication:
84
85 .. code-block:: bash
86
87    scheme://host:port/path
88    i.e.
89    https://example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
90
91 Authentication is based on the certificate used by the DFC.
92
93 For basic authentication:
94
95 .. code-block:: bash
96
97    scheme://userinfo@host:port/path
98    i.e.
99    https://demo:demo123456!@example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
100
101 Authentication is based on the "userinfo" applied within the link.
102
103 If no authentication is required:
104
105 .. code-block:: bash
106
107    scheme://host:port/path
108    i.e.
109    https://example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz
110
111 Note, effective way of authentication depends of uri provided and http server configuration.
112
113 If port number was not supplied , port 443 is used by default.
114 Every file is sent through separate https connection.
115
116 JWT token in HTTP/HTTPS connection
117 """"""""""""""""""""""""""""""""""
118
119 JWT token is processed, if it is provided as a ``access_token`` in the query part of the **location** entry:
120
121 .. code-block:: bash
122
123    scheme://host:port/path?access_token=<token>
124    i.e.
125    https://example.com:443/C20200502.1830+0200-20200502.1845+0200_195500.xml.gz?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vIiwiaWF0IjoxNTE2MjM5MDIyfQ.MWyG1QSymi-RtG6pkiYrXD93ZY9NJzaPI-wS4MEpUto
126
127 JWT tokens are consumed both in HTTP and HTTPS connections. Using JWT token is optional. If it is provided, its
128 **validity is not verified**. Token is extracted to the HTTP header as ``Authorization: Bearer <token>`` and is **NOT**
129 used in URL in HTTP GET call. Only single JWT token entry in the query is acceptable. If more than one ''access_token''
130 entry is found in the query, such situation is reported as error and DFC tries to download file without token. Another
131 query parameters are not modified at all and are used in URL in HTTP GET call.
132
133 If both JWT token and basic authentication are provided, JWT token has the priority. Such situation is considered
134 as fault and is logged on warning level.