Skip to content

Commit 4f94bfa

Browse files
committed
feat(docs): add Authorization header for JWT in API specification (reanahub#741)
1 parent 71bdd64 commit 4f94bfa

File tree

8 files changed

+389
-2
lines changed

8 files changed

+389
-2
lines changed

docs/openapi.json

Lines changed: 225 additions & 1 deletion
Large diffs are not rendered by default.

reana_server/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ def _get_rate_limit(env_variable: str, default: str) -> str:
302302
OAUTHCLIENT_REMOTE_APPS = dict()
303303
OAUTHCLIENT_REST_REMOTE_APPS = dict()
304304

305+
# Default value for when no login providers are configured. Used for JWT validation.
306+
REANA_OAUTH_JWK_URL = None
307+
305308
# Keycloak is only configured if login providers are defined
306309
if REANA_SSO_LOGIN_PROVIDERS:
307310
# Variables for the first login provider in the JSON

reana_server/rest/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def get_config():
3636
description: API access_token of user.
3737
required: false
3838
type: string
39+
- name: Authorization
40+
in: header
41+
description: The JWT of user.
42+
required: false
43+
type: string
3944
responses:
4045
200:
4146
description: >-

reana_server/rest/gitlab.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ def gitlab_projects(
227227
description: The API access_token of the current user.
228228
required: false
229229
type: string
230+
- name: Authorization
231+
in: header
232+
description: The JWT of the current user.
233+
required: false
234+
type: string
230235
- name: search
231236
in: query
232237
description: The search string to filter the project list.

reana_server/rest/info.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ def info(user, **kwargs): # noqa
5959
- name: access_token
6060
in: query
6161
description: The API access_token of workflow owner.
62-
required: true
62+
required: false
63+
type: string
64+
- name: Authorization
65+
in: header
66+
description: The JWT of the workflow owner.
67+
required: false
6368
type: string
6469
responses:
6570
200:

reana_server/rest/secrets.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ def add_secrets(user, overwrite=False):
6868
description: Secrets owner access token.
6969
required: false
7070
type: string
71+
- name: Authorization
72+
in: header
73+
description: The JWT of secrets owner.
74+
required: false
75+
type: string
7176
- name: overwrite
7277
in: query
7378
description: Whether existing secret keys should be overwritten.
@@ -199,6 +204,11 @@ def get_secrets(user): # noqa
199204
description: Secrets owner access token.
200205
required: false
201206
type: string
207+
- name: Authorization
208+
in: header
209+
description: The JWT of secrets owner.
210+
required: false
211+
type: string
202212
responses:
203213
200:
204214
description: >-
@@ -297,6 +307,11 @@ def delete_secrets(user): # noqa
297307
description: API key of the admin.
298308
required: false
299309
type: string
310+
- name: Authorization
311+
in: header
312+
description: The JWT of the admin.
313+
required: false
314+
type: string
300315
- name: secrets
301316
in: body
302317
description: >-

reana_server/rest/users.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ def get_you(user):
5151
description: API access_token of user.
5252
required: false
5353
type: string
54+
- name: Authorization
55+
in: header
56+
description: The JWT of the current user.
57+
required: false
58+
type: string
5459
responses:
5560
200:
5661
description: >-
@@ -246,6 +251,11 @@ def request_token(user):
246251
description: API access_token of user.
247252
required: false
248253
type: string
254+
- name: Authorization
255+
in: header
256+
description: The JWT of the current user.
257+
required: false
258+
type: string
249259
responses:
250260
200:
251261
description: >-
@@ -378,6 +388,11 @@ def get_users_shared_with_you(user):
378388
description: API access_token of user.
379389
required: false
380390
type: string
391+
- name: Authorization
392+
in: header
393+
description: The JWT of the current user.
394+
required: false
395+
type: string
381396
responses:
382397
200:
383398
description: >-
@@ -493,6 +508,11 @@ def get_users_you_shared_with(user):
493508
description: API access_token of user.
494509
required: false
495510
type: string
511+
- name: Authorization
512+
in: header
513+
description: The JWT of current user.
514+
required: false
515+
type: string
496516
responses:
497517
200:
498518
description: >-

reana_server/rest/workflows.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ def get_workflows(user, **kwargs): # noqa
9393
description: The API access_token of workflow owner.
9494
required: false
9595
type: string
96+
- name: Authorization
97+
in: header
98+
description: The JWT of the workflow owner.
99+
required: false
100+
type: string
96101
- name: type
97102
in: query
98103
description: Required. Type of workflows.
@@ -435,6 +440,11 @@ def create_workflow(user): # noqa
435440
description: The API access_token of workflow owner.
436441
required: false
437442
type: string
443+
- name: Authorization
444+
in: header
445+
description: The JWT of the workflow owner.
446+
required: false
447+
type: string
438448
responses:
439449
201:
440450
description: >-
@@ -651,6 +661,11 @@ def get_workflow_specification(workflow_id_or_name, user): # noqa
651661
description: API access_token of workflow owner.
652662
required: false
653663
type: string
664+
- name: Authorization
665+
in: header
666+
description: The JWT of the workflow owner.
667+
required: false
668+
type: string
654669
- name: workflow_id_or_name
655670
in: path
656671
description: Required. Analysis UUID or name.
@@ -846,6 +861,11 @@ def get_workflow_logs(workflow_id_or_name, user, **kwargs): # noqa
846861
description: API access_token of workflow owner.
847862
required: false
848863
type: string
864+
- name: Authorization
865+
in: header
866+
description: The JWT of the workflow owner.
867+
required: false
868+
type: string
849869
- name: workflow_id_or_name
850870
in: path
851871
description: Required. Analysis UUID or name.
@@ -1003,6 +1023,11 @@ def get_workflow_status(workflow_id_or_name, user): # noqa
10031023
description: The API access_token of workflow owner.
10041024
required: false
10051025
type: string
1026+
- name: Authorization
1027+
in: header
1028+
description: The JWT of the workflow owner.
1029+
required: false
1030+
type: string
10061031
responses:
10071032
200:
10081033
description: >-
@@ -1276,6 +1301,11 @@ def start_workflow(workflow_id_or_name, user, **parameters): # noqa
12761301
description: The API access_token of workflow owner.
12771302
required: false
12781303
type: string
1304+
- name: Authorization
1305+
in: header
1306+
description: The JWT of the workflow owner.
1307+
required: false
1308+
type: string
12791309
- name: parameters
12801310
in: body
12811311
description: >-
@@ -1463,6 +1493,11 @@ def set_workflow_status(workflow_id_or_name, user, status, **parameters): # noq
14631493
description: The API access_token of workflow owner.
14641494
required: false
14651495
type: string
1496+
- name: Authorization
1497+
in: header
1498+
description: The JWT of the workflow owner.
1499+
required: false
1500+
type: string
14661501
- name: parameters
14671502
in: body
14681503
description: >-
@@ -1684,6 +1719,11 @@ def upload_file(workflow_id_or_name, user): # noqa
16841719
description: The API access_token of workflow owner.
16851720
required: false
16861721
type: string
1722+
- name: Authorization
1723+
in: header
1724+
description: The JWT of the workflow owner.
1725+
required: false
1726+
type: string
16871727
- name: preview
16881728
in: query
16891729
description: >-
@@ -1840,6 +1880,11 @@ def download_file(workflow_id_or_name, file_name, user): # noqa
18401880
description: The API access_token of workflow owner.
18411881
required: false
18421882
type: string
1883+
- name: Authorization
1884+
in: header
1885+
description: The JWT of the workflow owner.
1886+
required: false
1887+
type: string
18431888
responses:
18441889
200:
18451890
description: >-
@@ -1962,6 +2007,11 @@ def delete_file(workflow_id_or_name, file_name, user): # noqa
19622007
description: The API access_token of workflow owner.
19632008
required: false
19642009
type: string
2010+
- name: Authorization
2011+
in: header
2012+
description: The JWT of the workflow owner.
2013+
required: false
2014+
type: string
19652015
responses:
19662016
200:
19672017
description: >-
@@ -2080,6 +2130,11 @@ def get_files(workflow_id_or_name, user, **kwargs): # noqa
20802130
description: The API access_token of workflow owner.
20812131
required: false
20822132
type: string
2133+
- name: Authorization
2134+
in: header
2135+
description: The JWT of the workflow owner.
2136+
required: false
2137+
type: string
20832138
- name: file_name
20842139
in: query
20852140
description: File name(s) (glob) to list.
@@ -2228,6 +2283,11 @@ def get_workflow_parameters(workflow_id_or_name, user): # noqa
22282283
description: The API access_token of workflow owner.
22292284
required: false
22302285
type: string
2286+
- name: Authorization
2287+
in: header
2288+
description: The JWT of the workflow owner.
2289+
required: false
2290+
type: string
22312291
responses:
22322292
200:
22332293
description: >-
@@ -2379,6 +2439,11 @@ def get_workflow_diff(workflow_id_or_name_a, workflow_id_or_name_b, user): # no
23792439
description: The API access_token of workflow owner.
23802440
required: false
23812441
type: string
2442+
- name: Authorization
2443+
in: header
2444+
description: The JWT of the workflow owner.
2445+
required: false
2446+
type: string
23822447
responses:
23832448
200:
23842449
description: >-
@@ -2516,6 +2581,11 @@ def open_interactive_session(
25162581
description: The API access_token of workflow owner.
25172582
required: false
25182583
type: string
2584+
- name: Authorization
2585+
in: header
2586+
description: The JWT of the workflow owner.
2587+
required: false
2588+
type: string
25192589
- name: interactive_session_type
25202590
in: path
25212591
description: Type of interactive session to use.
@@ -2669,6 +2739,11 @@ def close_interactive_session(workflow_id_or_name, user): # noqa
26692739
description: The API access_token of workflow owner.
26702740
required: false
26712741
type: string
2742+
- name: Authorization
2743+
in: header
2744+
description: The JWT of the workflow owner.
2745+
required: false
2746+
type: string
26722747
responses:
26732748
200:
26742749
description: >-
@@ -2796,6 +2871,11 @@ def move_files(workflow_id_or_name, user): # noqa
27962871
description: The API access_token of workflow owner.
27972872
required: false
27982873
type: string
2874+
- name: Authorization
2875+
in: header
2876+
description: The JWT of the workflow owner.
2877+
required: false
2878+
type: string
27992879
responses:
28002880
200:
28012881
description: >-
@@ -2930,6 +3010,11 @@ def get_workflow_disk_usage(workflow_id_or_name, user): # noqa
29303010
description: The API access_token of workflow owner.
29313011
required: false
29323012
type: string
3013+
- name: Authorization
3014+
in: header
3015+
description: The JWT of the workflow owner.
3016+
required: false
3017+
type: string
29333018
- name: workflow_id_or_name
29343019
in: path
29353020
description: Required. Analysis UUID or name.
@@ -3100,6 +3185,11 @@ def get_workflow_retention_rules(workflow_id_or_name, user):
31003185
description: The API access_token of workflow owner.
31013186
required: false
31023187
type: string
3188+
- name: Authorization
3189+
in: header
3190+
description: The JWT of the workflow owner.
3191+
required: false
3192+
type: string
31033193
- name: workflow_id_or_name
31043194
in: path
31053195
description: Required. Analysis UUID or name.
@@ -3246,6 +3336,11 @@ def prune_workspace(
32463336
description: The API access_token of workflow owner.
32473337
required: false
32483338
type: string
3339+
- name: Authorization
3340+
in: header
3341+
description: The JWT of the workflow owner.
3342+
required: false
3343+
type: string
32493344
- name: workflow_id_or_name
32503345
in: path
32513346
description: Required. Analysis UUID or name.
@@ -3397,6 +3492,11 @@ def share_workflow(workflow_id_or_name, user, **kwargs):
33973492
description: The API access_token of workflow owner.
33983493
required: false
33993494
type: string
3495+
- name: Authorization
3496+
in: header
3497+
description: The JWT of the workflow owner.
3498+
required: false
3499+
type: string
34003500
- name: workflow_id_or_name
34013501
in: path
34023502
description: Required. Workflow UUID or name.
@@ -3555,6 +3655,11 @@ def unshare_workflow(workflow_id_or_name, user, user_email_to_unshare_with):
35553655
description: The API access_token of workflow owner.
35563656
required: false
35573657
type: string
3658+
- name: Authorization
3659+
in: header
3660+
description: The JWT of the workflow owner.
3661+
required: false
3662+
type: string
35583663
- name: workflow_id_or_name
35593664
in: path
35603665
description: Required. Workflow UUID or name.
@@ -3696,6 +3801,11 @@ def get_workflow_share_status(workflow_id_or_name, user):
36963801
description: The API access_token of workflow owner.
36973802
required: false
36983803
type: string
3804+
- name: Authorization
3805+
in: header
3806+
description: The JWT of the workflow owner.
3807+
required: false
3808+
type: string
36993809
- name: workflow_id_or_name
37003810
in: path
37013811
description: Required. Workflow UUID or name.

0 commit comments

Comments
 (0)