· 5 years ago · Jul 08, 2020, 05:20 PM
1openapi: 3.0.0
2info:
3 title: Auth LTI layer
4 description:
5 Authentication layer used to enable LMS integration by the use of LTI.<br />
6 <br />
7 <b>warning</b> - current version work with mocked data.
8 version: 0.1.0
9servers:
10 - url: https://ec2-34-243-218-10.eu-west-1.compute.amazonaws.com/api/auth-lti/v1
11 description: AWS test server
12paths:
13 /:
14 get:
15 summary: API service description.
16 description:
17 Endpoint used to validate the service name, version and routes.
18 tags:
19 - base
20 responses:
21 '200':
22 description: A service description.
23 content:
24 application/json:
25 schema:
26 type: object
27 properties:
28 status:
29 $ref: '#/components/schemas/status'
30 data:
31 $ref: '#/components/schemas/index_data'
32 example:
33 status:
34 success: true
35 errors: []
36 data:
37 name: api-auth-lti
38 version: 1.0.0
39 routes:
40 index: '[GET] /'
41 check: '[GET] /__check'
42 openapi: '[GET] /__openapi'
43 auth: '[GET] /auth'
44 token: '[POST] /token'
45 redirect: '[GET] /redirect'
46 '500':
47 $ref: '#/components/responses/internal_server_error'
48 /__check:
49 get:
50 summary: API health check endpoint.
51 description:
52 Endpoint used to validate the state of the service.<br />
53 The service will perform internal checks to validate that can respond to all request.
54 tags:
55 - base
56 responses:
57 '200':
58 description: All health check tests passed.
59 content:
60 application/json:
61 schema:
62 type: object
63 properties:
64 status:
65 $ref: '#/components/schemas/status'
66 data:
67 $ref: '#/components/schemas/check_data'
68 example:
69 status:
70 success: true
71 errors: []
72 data:
73 test1: passed
74 test2: failed
75 '500':
76 $ref: '#/components/responses/internal_server_error'
77 /__openapi:
78 get:
79 summary: OpenAPI definition of the service.
80 description:
81 Endpoint used to retrieve the OpenAPI yaml specification of the service.
82 tags:
83 - base
84 responses:
85 '200':
86 description: Retrieved the OpenAPI successfully.
87 content:
88 application/json:
89 schema:
90 type: object
91 properties:
92 status:
93 $ref: '#/components/schemas/status'
94 data:
95 type: object
96 example:
97 status:
98 success: true
99 errors: []
100 data: {}
101 '500':
102 $ref: '#/components/responses/internal_server_error'
103 /auth:
104 get:
105 summary: Authentication request.
106 description:
107 Endpoint used to authenticate a client application.<br />
108 This will return a token to be used as the Authorization header to identificate the request.
109 tags:
110 - service
111 parameters:
112 - in: query
113 name: client
114 schema:
115 type: string
116 required: true
117 description: The ID of the client application.
118 - in: query
119 name: secret
120 schema:
121 type: string
122 required: true
123 description: The secret of the client application.
124 responses:
125 '200':
126 description: Valid request.
127 content:
128 application/json:
129 schema:
130 type: object
131 properties:
132 status:
133 $ref: '#/components/schemas/status'
134 data:
135 type: object
136 properties:
137 auth:
138 type: string
139 example:
140 status:
141 success: true
142 errors: []
143 data:
144 auth: 'Bearer random-string'
145 '400':
146 $ref: '#/components/responses/bad_request'
147 '401':
148 $ref: '#/components/responses/failed_auth'
149 '500':
150 $ref: '#/components/responses/internal_server_error'
151 /token:
152 post:
153 summary: Token request.
154 description:
155 Endpoint used to request a authentication token to be used to authenticate a user in the dreamshaper application.
156 tags:
157 - service
158 security:
159 - BearerAuth: []
160 responses:
161 '200':
162 description: Valid request.
163 content:
164 application/json:
165 schema:
166 type: object
167 properties:
168 status:
169 $ref: '#/components/schemas/status'
170 data:
171 type: object
172 properties:
173 auth:
174 type: string
175 example:
176 status:
177 success: true
178 errors: []
179 data:
180 token: '<JWT token string>'
181 recovery: '<WT token recovery key>'
182 '400':
183 $ref: '#/components/responses/bad_request'
184 '401':
185 $ref: '#/components/responses/failed_auth'
186 '500':
187 $ref: '#/components/responses/internal_server_error'
188 /redirect:
189 get:
190 summary: Redirect request.
191 description:
192 Endpoint used to request a redirect to the proper dreamshaper application page given the source authentication and user token.
193 tags:
194 - service
195 security:
196 - BearerAuth: []
197 parameters:
198 - in: query
199 name: org
200 required: true
201 schema:
202 type: string
203 description: Organization id of the source authenticatino request.
204 - in: query
205 name: token
206 required: true
207 schema:
208 type: string
209 description: JWT token generated on the /auth request.
210 - in: query
211 name: recover
212 required: true
213 schema:
214 type: string
215 description: JWT recovery key generated on the /auth request.
216 responses:
217 '302':
218 description: Valid request and redirect to the requested URL.
219 '400':
220 $ref: '#/components/responses/bad_request'
221 '401':
222 $ref: '#/components/responses/failed_auth'
223 '500':
224 $ref: '#/components/responses/internal_server_error'
225
226components:
227 securitySchemes:
228 BearerAuth:
229 type: http
230 scheme: bearer
231 bearerFormat: JWT
232
233 responses:
234 internal_server_error:
235 description: Unexpected server error.
236 content:
237 application/json:
238 schema:
239 type: object
240 properties:
241 status:
242 $ref: '#/components/schemas/status'
243 example:
244 status:
245 success: false
246 errors: [{
247 code: 10001370,
248 message: Human-readable message
249 }]
250 bad_request:
251 description: Bad request (Missing or invalid request parameters).
252 content:
253 application/json:
254 schema:
255 type: object
256 properties:
257 status:
258 $ref: '#/components/schemas/status'
259 example:
260 status:
261 success: false
262 errors: [{
263 code: 10001370,
264 message: Human-readable message
265 }]
266 failed_auth:
267 description: Failed authentication
268 content:
269 application/json:
270 schema:
271 type: object
272 properties:
273 status:
274 $ref: '#/components/schemas/status'
275 example:
276 status:
277 success: false
278 errors: [{
279 code: 10001370,
280 message: Human-readable message
281 }]
282
283 schemas:
284 status:
285 type: object
286 properties:
287 success:
288 type: boolean
289 errors:
290 type: array
291 items:
292 type: object
293 properties:
294 code:
295 type: integer
296 message:
297 type: string
298 index_data:
299 type: object
300 properties:
301 name:
302 type: string
303 version:
304 type: string
305 routes:
306 type: object
307 properties:
308 index:
309 type: string
310 check:
311 type: string
312 openapi:
313 type: string
314 auth:
315 type: string
316 token:
317 type: string
318 redirect:
319 type: string
320 check_data:
321 type: object
322 properties:
323 test1:
324 type: string
325 test2:
326 type: string
327 token_data:
328 type: object
329 properties:
330 token:
331 type: string
332 recovery:
333 type: string