From 808eb511c71c45aad7f8fff24e24dbc70e189327 Mon Sep 17 00:00:00 2001 From: Georgi Michev <georgi.michev@vereign.com> Date: Fri, 15 Dec 2023 16:41:16 +0200 Subject: [PATCH] Add Call of external URLs Signed-off-by: Georgi Michev <georgi.michev@vereign.com> --- .../{name}/{version}/evaluation/POST.feature | 14 ++++++++++ .../{name}/{version}/export/GET.feature | 2 +- .../mongo/policy/collections/policies.json | 26 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/evaluation/POST.feature b/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/evaluation/POST.feature index ad4a183d..f212fb5a 100644 --- a/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/evaluation/POST.feature +++ b/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/evaluation/POST.feature @@ -35,6 +35,20 @@ Feature: API -TSA - Policy - {repository}/{group}/{name}/{version}/evaluation PO Then the status code should be {200} And the field {key} has the value {someValue} + @phase2 @IDM.TSA.E1.00013 + Scenario: TSA - Calling external URL - Positive + When I execute the Policy group {example} name {externalURL} version {1.0} via TSA Policy API + Then the status code should be {200} + And the field {body.service} has the value {policy} + And the field {body.status} has the value {up} + And the field {status} has the value {200 OK} + + @phase2 @IDM.TSA.E1.00013 + Scenario: TSA - DID resolution using external URL - Positive + When I execute the Policy group {example} name {externalURL} version {1.1} via TSA Policy API + Then the status code should be {200} + And the field {body.data.didDocument.id} has the value {did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6} + Scenario: TSA - using multiple header values for policy execution - Positive When I load the REST request {Policy.json} with profile {empty} And I load value {someValue} into current request HEADER {X-Cache-Key} diff --git a/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/export/GET.feature b/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/export/GET.feature index 923e6bde..d5c8bcff 100644 --- a/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/export/GET.feature +++ b/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/export/GET.feature @@ -1,6 +1,6 @@ #Copyright (c) 2023 Vereign AG [https://www.vereign.com] -@rest @all @tsa @policy @phase2 @IDM.TSA.E1.00005 @IDM.TSA.E1.00006 +@rest @all @tsa @policy @phase2 @IDM.TSA.E1.00005 @IDM.TSA.E1.00006 @IDM.TSA.E1.00011 Feature: API - TSA - policy - {repository}/{group}/{name}/{version}/export GET As user I want to be able to export policy diff --git a/test_data/mongo/policy/collections/policies.json b/test_data/mongo/policy/collections/policies.json index bc8da8cc..d2954e96 100644 --- a/test_data/mongo/policy/collections/policies.json +++ b/test_data/mongo/policy/collections/policies.json @@ -506,5 +506,31 @@ "dataConfig": "{\n \"url\": \"http://example.com/data.json?page=3\",\n \"method\": \"GET\",\n \"period\": \"10h\",\n \"body\": {\n \"key\": \"value\"\n }\n}\n", "exportConfig": "{\n\t\"namespace\":\"transit\",\n\t\"key\":\"key1\"\n}", "outputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"foo\": {\n \"type\": \"string\",\n \"minLength\": 5\n }\n }\n}" + }, + { + "_id": {"$oid": "657c5a7718f39c409b152a70"}, + "filename": "example/externalURL/1.0/policy.rego", + "group": "example", + "locked": false, + "name": "externalURL", + "rego": "package example.externalURL\n\n_ := http.send({\"method\": \"get\", \"url\": \"https://vault.vereign.com/tsa/policy/liveness\"})", + "repository": "policies", + "version": "1.0" + }, + { + "_id": {"$oid": "657c5c7c18f39c409b152a71"}, + "filename": "example/externalURL/1.1/policy.rego", + "group": "example", + "lastUpdate": null, + "locked": false, + "name": "externalURL", + "rego": "package example.externalURL\n\n_ := http.send({\n \"method\": \"post\",\n \"url\": \"https://vault.vereign.com/tsa/policy/policy/policies/example/resolve/1.0/evaluation\",\n \"body\": {\"did\": \"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6\"}\n})", + "repository": "policies", + "version": "1.1", + "data": null, + "dataConfig": null, + "nextDataRefreshTime": null, + "exportConfig": null, + "outputSchema": null } ] -- GitLab