From fd305405b753528dd53934a15c5194feb6deb7a9 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Fri, 21 Jun 2019 13:03:04 +0200 Subject: #915 add support for HTTP Authorization Add APITOKEN= field to ogAdmServer.cfg to specify the REST API key. --- tests/config/ogAdmServer.cfg | 1 + tests/run-tests.sh | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/config/ogAdmServer.cfg b/tests/config/ogAdmServer.cfg index aa20113..41d812b 100644 --- a/tests/config/ogAdmServer.cfg +++ b/tests/config/ogAdmServer.cfg @@ -5,3 +5,4 @@ PASSWORD=test-db datasource=localhost CATALOG=test-db INTERFACE=eth1 +APITOKEN=07b3bfe728954619b58f0107ad73acc1 diff --git a/tests/run-tests.sh b/tests/run-tests.sh index f0cae2a..ca00b5f 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -1,10 +1,12 @@ -curl -X POST http://127.0.0.1:8888/clients -d @post_clients.json -curl -X GET http://127.0.0.1:8888/clients -curl -X POST http://127.0.0.1:8888/wol -d @wol.json -curl -X POST http://127.0.0.1:8888/shell/run -d @post_shell_run.json -curl -X POST http://127.0.0.1:8888/shell/output -d @post_shell_output.json -curl -X POST http://127.0.0.1:8888/session -d @session.json -curl -X POST http://127.0.0.1:8888/poweroff -d @poweroff.json -curl -X POST http://127.0.0.1:8888/reboot -d @reboot.json -curl -X POST http://127.0.0.1:8888/stop -d @stop.json -curl -X POST http://127.0.0.1:8888/refresh -d @refresh.json +API_KEY="07b3bfe728954619b58f0107ad73acc1" + +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/clients -d @post_clients.json +curl -X GET -H "Authorization: $API_KEY" http://127.0.0.1:8888/clients +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/wol -d @wol.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/shell/run -d @post_shell_run.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/shell/output -d @post_shell_output.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/session -d @session.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/poweroff -d @poweroff.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/reboot -d @reboot.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/stop -d @stop.json +curl -X POST -H "Authorization: $API_KEY" http://127.0.0.1:8888/refresh -d @refresh.json -- cgit v1.2.3-18-g5258