From ba44e5a57d2689aeab74b86f1dbf6000465c72a3 Mon Sep 17 00:00:00 2001 From: Markus Scheidgen <markus.scheidgen@gmail.com> Date: Fri, 21 Dec 2018 20:19:03 +0100 Subject: [PATCH] Added X-Token auth to swagger. --- nomad/api/app.py | 7 ++++++- tests/test_api.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/nomad/api/app.py b/nomad/api/app.py index 0a16c3e0de..19e85cf594 100644 --- a/nomad/api/app.py +++ b/nomad/api/app.py @@ -41,13 +41,18 @@ CORS(app) authorizations = { 'HTTP Basic': { 'type': 'basic' + }, + 'X-Token': { + 'type': 'apiKey', + 'in': 'header', + 'name': 'X-Token' } } api = Api( app, version='1.0', title='nomad@FAIRDI API', authorizations=authorizations, description='Official API for nomad@FAIRDI services.') -""" Provides the flask restful api instance """ +""" Provides the flask restplust api instance """ @app.errorhandler(HTTPException) diff --git a/tests/test_api.py b/tests/test_api.py index 3f749304e0..d8fddc427d 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -65,7 +65,7 @@ def test_other_user_auth(other_test_user): class TestAuth: def test_xtoken_auth(self, client, test_user, no_warn): rv = client.get('/uploads/', headers={ - 'X-Token': test_user.email + 'X-Token': test_user.email # the test users have their email as tokens for convinience }) assert rv.status_code == 200 -- GitLab