From bfc652c7a15fda06e492aca44d81a69b0f46bcec Mon Sep 17 00:00:00 2001 From: dcore94 Date: Wed, 22 Sep 2021 12:15:47 +0200 Subject: [PATCH] added authorization step for callback --- templates/da_cache_to_shub.json.j2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/templates/da_cache_to_shub.json.j2 b/templates/da_cache_to_shub.json.j2 index 3fdd769..ec25763 100644 --- a/templates/da_cache_to_shub.json.j2 +++ b/templates/da_cache_to_shub.json.j2 @@ -175,6 +175,22 @@ "scriptExpression": "var k,report={requestid:$.input.requestId,orderNumber:$.input.orderNumber,errors:[]},keys=[],errors=[];for(var k in $.output) keys.push(k);keys.sort();for(k in keys){var index=keys[k].split('_')[1],o=$.output[keys[k]];o.endpoint1.error&&errors.push({url:$.input.downloads[index].url,number:index,error_number:1002,error_message:o.endpoint1.error}),o.endpoint2.error&&errors.push({url:$.input.descriptor.downloads[index].url,number:index,error_number:9999,error_message:o.endpoint2.error})};report['errors']=Java.to(errors,'java.util.Map[]');return {report:report}" } }, + { + "name" : "pyrest", + "taskReferenceName" : "bc_data_api_authorize", + "type" : "SIMPLE", + "inputParameters" : { + "url" : "https://data.blue-cloud.org/api/login", + "method" : "POST", + "headers" : { + "Content-type": "application/json" + }, + "body" : { + "username": "blue-cloud-api@isti.cnr.it", + "password": "QNKZLW8mkZdCyNrF" + } + } + }, { "name" : "pyrest", "taskReferenceName" : "send_json_report", @@ -184,6 +200,7 @@ "url" : "${workflow.input.callback.url}", "method" : "POST", "headers" : { + "Authorization" : "Bearer ${bc_data_api_authorize.output.body.token}", "Content-type": "application/json" }, "body" : "${build_json_report.output.result.report}"