forked from pagopa/io-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_session.yaml
304 lines (304 loc) · 8.37 KB
/
api_session.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
swagger: "2.0"
info:
version: 1.0.0
title: Session API
description: Collection of enpoints to interact with user session.
host: localhost
basePath: /api/v1
schemes:
- https
paths:
"/sessions/{fiscalcode}":
get:
operationId: getSession
summary: Get available user info from session
description: |-
Use this operation if you want to known the state of user session
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
responses:
"200":
description: Success.
schema:
$ref: "#/definitions/UserSessionInfo"
examples:
application/json:
"active": true
"400":
description: Bad request
"401":
description: Token null or invalid.
"404":
description: User not found.
"429":
description: Throttling.
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
"/sessions/{fiscalcode}/lock":
post:
operationId: lockUserSession
summary: Lock a user session and delete session data
description: |-
Use this operation if you want to block a user to log in. The operation succeed if the user is already blocked
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
responses:
"200":
description: Success.
schema:
$ref: "#/definitions/SuccessResponse"
examples:
application/json:
"message": "ok"
"400":
description: Bad request
"401":
description: Token null or invalid.
"404":
description: User not found.
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
delete:
operationId: unlockUserSession
summary: Remove a lock to a user session
description: |-
Use this operation if you want to unblock a user and re-allow to login. The operation succeed if the user wasn't blocked
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
responses:
"200":
description: Success.
schema:
$ref: "#/definitions/SuccessResponse"
examples:
application/json:
"message": "ok"
"400":
description: Bad request
"401":
description: Token null or invalid.
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
"/sessions/{fiscalcode}/logout":
post:
operationId: deleteUserSession
summary: Delete user session and invalidate lollipop data
description: |-
Use this operation to invalidate the user session and disable the lollipop params to prevent Fast Login token refresh
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
responses:
"200":
description: Success.
schema:
$ref: "#/definitions/SuccessResponse"
examples:
application/json:
"message": "ok"
"400":
description: Bad request
"401":
description: Token null or invalid.
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
"/auth/{fiscalcode}/lock":
post:
operationId: authLock
description: |-
Locks the user for the IO app.
This is intended to use with ioweb-profile lock functionality.
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
- name: body
in: body
required: true
schema:
$ref: "#/definitions/AuthLockBody"
responses:
"204":
description: Lock created.
"400":
description: Bad request
schema:
$ref: "#/definitions/ProblemJson"
"401":
description: Token null or invalid.
schema:
$ref: "#/definitions/ProblemJson"
"409":
description: The user lock has been already created.
schema:
$ref: "#/definitions/ProblemJson"
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
"/auth/{fiscalcode}/release-lock":
post:
operationId: releaseAuthLock
description: |-
Release the user authentication lock for the IO app.
This is intended to use with ioweb-profile unlock functionality.
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
- name: body
in: body
required: true
schema:
$ref: "#/definitions/AuthUnlockBody"
responses:
"204":
description: Lock successfully released.
"403":
description: Operation forbidden.
"400":
description: Bad request
schema:
$ref: "#/definitions/ProblemJson"
"401":
description: Token null or invalid.
schema:
$ref: "#/definitions/ProblemJson"
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
"/sessions/{fiscalcode}/state":
get:
operationId: getUserSessionState
summary: Get User Session State on IO App
parameters:
- $ref: "#/parameters/FiscalCode"
- $ref: "#/parameters/Token"
responses:
"200":
description: Success.
schema:
$ref: "#/definitions/SessionState"
examples:
application/json:
"access_enabled": true
"session_info":
{
"active": true,
"expiration_date": "2011-10-05T14:48:00.000Z",
"type": "LV",
}
"400":
description: Bad request
"401":
description: Unauthorized
"500":
description: There was an error
schema:
$ref: "#/definitions/ProblemJson"
parameters:
FiscalCode:
name: fiscalcode
in: path
type: string
maxLength: 16
minLength: 16
required: true
description: The fiscal code of the user, all upper case.
x-example: SPNDNL80R13C555X
Token:
name: token
in: query
type: string
required: true
description: The API key used to access this webhooks.
definitions:
FiscalCode:
$ref: "https://raw.githubusercontent.com/pagopa/io-functions-commons/v21.5.3/openapi/definitions.yaml#/FiscalCode"
ProblemJson:
$ref: "https://raw.githubusercontent.com/pagopa/io-functions-commons/v21.5.3/openapi/definitions.yaml#/ProblemJson"
UnlockCode:
type: string
pattern: ^\\d{9}$
AuthLockBody:
type: object
properties:
unlock_code:
$ref: "#/definitions/UnlockCode"
required:
- unlock_code
AuthUnlockBody:
type: object
properties:
unlock_code:
$ref: "#/definitions/UnlockCode"
SuccessResponse:
type: object
properties:
message:
type: string
UserSessionInfo:
type: object
properties:
active:
type: boolean
required:
- active
SessionInfo:
description: Info about an user session
x-one-of: true
allOf:
- type: object
description: Inactive session
properties:
active:
type: boolean
enum:
- false
required:
- active
- type: object
description: Active session
properties:
active:
type: boolean
enum:
- true
expiration_date:
type: string
format: date
type:
type: string
enum:
- LV
- LEGACY
required:
- active
- expiration_date
- type
SessionState:
description: The state of the user' session
type: object
properties:
access_enabled:
type: boolean
session_info:
$ref: "#/definitions/SessionInfo"
required:
- access_enabled
- session_info
responses: {}
consumes:
- application/json
produces:
- application/json