This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
api_backend.yaml
339 lines (328 loc) · 9.06 KB
/
api_backend.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
swagger: "2.0"
info:
version: 1.0.0
title: AGID forms
description: AGID forms.
host: localhost
basePath: /api/v1
paths:
"/user/profile":
get:
summary: Get user's profile
description: Returns the profile for the authenticated user.
responses:
"200":
description: Found.
schema:
$ref: "#/definitions/UserProfile"
"400":
description: Bad request
schema:
$ref: "#/definitions/ProblemJson"
"401":
description: Bearer token null or expired.
"500":
description: There was an error in retrieving the user profile.
schema:
$ref: "#/definitions/ProblemJson"
"/auth/ipa/token/{ipa_code}":
post:
summary: Send an email with a secret code to the RTD.
description: |
Send an email with a secret code to the RTD of the Public Administration
(organization) identified by the IPA code.
Gets the information on the organization from the
[IPA](https://indicepa.gov.it) catalogue using the provided IPA code.
The secret code will be used by the client to login into the backend.
responses:
"200":
description: Organization found.
schema:
"$ref": "#/definitions/GetPaFromIpa"
"400":
description: Bad request.
schema:
$ref: "#/definitions/ProblemJson"
"404":
description: No organization found for the provided IPA code.
schema:
$ref: "#/definitions/ProblemJson"
"500":
description: There was an error retrieving the organization.
schema:
$ref: "#/definitions/ProblemJson"
parameters:
- name: ipa_code
in: path
description: PA IPA code.
type: string
required: true
"/auth/ipa/session/{ipa_code}":
post:
summary: Get a bearer token to use with subsequent API calls.
description: |
The client post a secret code and the IPA code of the Public Administration
he wants to personify. If the secret is valid for the provided IPA code,
then the backend returns a bearer token to authenicate subsequent API calls.
responses:
"200":
description: Authorized.
schema:
"$ref": "#/definitions/LoginTokens"
"400":
description: Bad request.
schema:
$ref: "#/definitions/ProblemJson"
"401":
description: Not authorized.
schema:
$ref: "#/definitions/ProblemJson"
"404":
description: No organization found for the provided IPA code.
schema:
$ref: "#/definitions/ProblemJson"
"500":
description: There was an error retrieving the organization.
schema:
$ref: "#/definitions/ProblemJson"
parameters:
- name: ipa_code
in: path
description: PA IPA code.
type: string
required: true
- name: body
in: body
schema:
$ref: "#/definitions/LoginCredentials"
required: true
######################
"/auth/email/token":
post:
summary: Send an email with a secret code to the email address provided.
description: |
Send an email with a secret code to the email address provided in input.
The secret code will be used by the client to login into the backend.
responses:
"200":
description: Found.
schema:
"$ref": "#/definitions/EmailPayload"
"400":
description: Bad request.
schema:
$ref: "#/definitions/ProblemJson"
"500":
description: Generic error processing the request.
schema:
$ref: "#/definitions/ProblemJson"
parameters:
- name: body
in: body
description: Email address.
schema:
$ref: "#/definitions/EmailPayload"
required: true
"/auth/email/session":
post:
summary: Get a bearer token to use with subsequent API calls.
description: |
The client post a secret code and the email address the secret code was sent to.
If the secret is valid for the provided email address,
then the backend returns a bearer token to authenicate subsequent API calls.
responses:
"200":
description: Authorized.
schema:
"$ref": "#/definitions/LoginTokens"
"400":
description: Bad request.
schema:
$ref: "#/definitions/ProblemJson"
"401":
description: Not authorized.
schema:
$ref: "#/definitions/ProblemJson"
"500":
description: Generic error processing the request.
schema:
$ref: "#/definitions/ProblemJson"
parameters:
- name: body
in: body
schema:
$ref: "#/definitions/EmailLoginCredentials"
required: true
######################
"/auth/logout":
post:
summary: Terminate user session.
description: |
Delete the session identified by the provided bearer token.
responses:
"200":
description: Logged out.
schema:
"$ref": "#/definitions/SuccessResponse"
"500":
description: There was an error deleting user's session.
schema:
$ref: "#/definitions/ProblemJson"
schemes:
- https
security:
- Bearer: []
definitions:
HttpStatusCode:
type: integer
format: int32
description: |-
The HTTP status code generated by the origin server for this occurrence
of the problem.
minimum: 100
maximum: 600
exclusiveMaximum: true
example: 200
ProblemJson:
type: object
properties:
type:
type: string
format: uri
description: |-
An absolute URI that identifies the problem type. When dereferenced,
it SHOULD provide human-readable documentation for the problem type
(e.g., using HTML).
default: about:blank
example: https://example.com/problem/constraint-violation
title:
type: string
description: |-
A short, summary of the problem type. Written in english and readable
for engineers (usually not suited for non technical stakeholders and
not localized); example: Service Unavailable
status:
$ref: "#/definitions/HttpStatusCode"
detail:
type: string
description: |-
A human readable explanation specific to this occurrence of the
problem.
example: There was an error processing the request
instance:
type: string
format: uri
description: |-
An absolute URI that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.
GetPaFromIpa_ipa_pa:
type: object
properties:
comune:
type: string
provincia:
type: string
regione:
type: string
des_amm:
type: string
description: "PA description."
cod_amm:
type: string
description: "IPA code."
tipologia_istat:
type: string
description: "Tipology."
mail2:
type: string
description: "Email address"
required:
- comune
- provincia
- regione
- des_amm
- cod_amm
- tipologia_istat
GetPaFromIpa_ipa_ou:
type: object
properties:
cod_ou:
type: string
nome_resp:
type: string
cogn_resp:
type: string
mail_resp:
type: string
required:
- cod_ou
- nome_resp
- cogn_resp
- mail_resp
GetPaFromIpa:
type: object
properties:
ipa_pa:
$ref: "#/definitions/GetPaFromIpa_ipa_pa"
ipa_ou:
$ref: "#/definitions/GetPaFromIpa_ipa_ou"
required:
- ipa_ou
- ipa_pa
EmailPayload:
type: object
properties:
email:
type: string
format: email
required:
- email
LoginTokens:
type: object
properties:
backend_token:
type: string
graphql_token:
type: string
required:
- backend_token
- graphql_token
LoginCredentials:
type: object
properties:
secret:
type: string
required:
- secret
EmailLoginCredentials:
type: object
properties:
email:
type: string
format: email
secret:
type: string
required:
- email
- secret
SuccessResponse:
type: object
properties:
message:
type: string
UUIDString:
type: string
pattern: "^\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+$"
# x-import: italia-ts-commons/lib/UUIDString
UserProfile:
type: object
properties:
email:
type: string
format: EmailString
x-import: italia-ts-commons/lib/strings
id:
$ref: "#/definitions/UUIDString"
required:
- id
- email