From 00782d90e193c9b6884362d2de1fbac52127e0d7 Mon Sep 17 00:00:00 2001 From: "m.lettere" Date: Fri, 14 Jul 2023 16:11:13 +0200 Subject: [PATCH] fixed workflow --- .../create_vre_folder_for_context.json.j2 | 56 ++++++++----------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/templates/create_vre_folder_for_context.json.j2 b/templates/create_vre_folder_for_context.json.j2 index e8a9e8d..3bbdd01 100644 --- a/templates/create_vre_folder_for_context.json.j2 +++ b/templates/create_vre_folder_for_context.json.j2 @@ -10,11 +10,11 @@ "taskReferenceName": "init", "inputParameters": { "base_url": "https://url.gcube.d4science.org/", - "keycloak": "{{ keycloak }}/{{ keycloak_realm }}", - "keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}", + "keycloak": "{{ keycloak }}/{{ keycloak_realm }}", + "keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}", "storagehub" : "{{ storagehub }}", "ctx": "${workflow.input.context}", - "scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))} if(e($.ctx)) throw('Context must not be empty'); return { decoded_context : $.ctx.replaceAll('%2F', '/') }" + "scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))} if(e($.ctx)) throw('Context must not be empty'); return { shubified_context_name : ($.ctx[0] === '%' ? $.ctx.replace('%2F', '') : $.ctx).split('%2F').join('-') }" }, "type": "LAMBDA", "decisionCases": {}, @@ -28,46 +28,38 @@ "loopOver": [] }, { - "name": "pyrest", - "taskReferenceName": "authorize", - "inputParameters": { - "url": "{{ keycloak }}/{{ keycloak_realm }}/protocol/openid-connect/token", - "method": "POST", - "headers": { - "Accept": "application/json" - }, - "body": { - "client_id": "orchestrator", - "client_secret": "{{ keycloak_auth }}", - "grant_type": "client_credentials" + "name" : "pyrest", + "taskReferenceName" : "authorize_with_uma_rpt", + "type" : "SIMPLE", + "inputParameters" : { + "url" : "${init.input.keycloak}/protocol/openid-connect/token", + "method" : "POST", + "headers" : { + "Accept" : "application/json" + }, + "body" : { + "audience" : "${init.input.root_vo}", + "grant_type" : "urn:ietf:params:oauth:grant-type:uma-ticket", + "client_id" : "orchestrator", + "client_secret" : "{{ keycloak_auth }}" + } } - }, - "type": "SIMPLE", - "decisionCases": {}, - "defaultCase": [], - "forkTasks": [], - "startDelay": 0, - "joinOn": [], - "optional": false, - "defaultExclusiveJoinTask": [], - "asyncComplete": false, - "loopOver": [] }, { "name": "pyrest", "taskReferenceName": "create_vre_folder", "inputParameters": { - "url": "https://en5ql62qrka7q.x.pipedream.net/${init.output.result.child}", + "url": "${init.input.storagehub}/groups", "method": "POST", "headers": { - "Authorization": "Bearer bearer_here", - "Accept": "application/json", + "Authorization": "Bearer ${authorize_with_uma_rpt.output.body.access_token}", + "Accept": "text/plain", "Content-Type": "multipart/form-data" }, "body": { - "accessType": "WRITE_ALL", - "folderOwner": "", - "group": "${init.output.result.decoded_context}" + "accessType": "WRITE_OWN", + "folderOwner": "orchestrator", + "group": "${init.output.result.shubified_context_name}" } }, "type": "SIMPLE",