diff --git a/README.md b/README.md index bad176e8070e9b9cefc8f9f7f532f8e8985004a2..f2ce81afd4a9de845af2de11bcff5078bc4a5528 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,12 @@ This repository holds the test automation framework based on Java and used for t _{BASE_URL} - should be replaced with the path where the services are deployed: example: http://localhost_ +### Database +In order for the test scenarios to be properly executed a MongoDB database deployment is needed. +The database should have specific structure and imported actual data. +The structure and the data should follow the examples in **test_data** folder. +Part of the data is also available in the Policies repository. + # Manual execution To simplify manual tests execution we have a postman collection with the list of supported endpoints, you can find [here](postman/TSA.postman_collection.json) diff --git a/test_data/mongo/infohub/collections/exports.json b/test_data/mongo/infohub/collections/exports.json new file mode 100644 index 0000000000000000000000000000000000000000..b833f39e54cd4b7a47a6f632d79962d8bbee3072 --- /dev/null +++ b/test_data/mongo/infohub/collections/exports.json @@ -0,0 +1,18 @@ +[ + { + "_id": {"$oid": "63fa2f16b70ed89144e37114"}, + "contexts": ["https://www.w3.org/2018/credentials/examples/v1"], + "exportName": "testexport", + "issuer": "did:web:vault.vereign.com:tsa:policy:policy:policies:example:returnDID:1.0:evaluation", + "key": "key1", + "keyNamespace": "transit", + "policies": { + "policies/example/examplePolicy/1.0": { + "message": "example" + }, + "policies/example/ProofRequestResponse/1.0": { + "hello": "world" + } + } + } +] \ No newline at end of file diff --git a/test_data/mongo/policy/collections/policies.json b/test_data/mongo/policy/collections/policies.json new file mode 100644 index 0000000000000000000000000000000000000000..f2055c8cbae58a8f6081350880c0524ece1d0d48 --- /dev/null +++ b/test_data/mongo/policy/collections/policies.json @@ -0,0 +1,486 @@ +[ + { + "_id": {"$oid": "63fa2f16b70ed89144e3710c"}, + "filename": "example/example/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-02-25T15:53:58.856Z"}, + "locked": false, + "name": "example", + "rego": "package example.example\n\n allow {\n 1 == 1\n }\n\n taskID := \"0123456789abcdef\"\n ", + "repository": "policies", + "version": "1.0" + }, + { + "_id": {"$oid": "63fa2f16b70ed89144e3710d"}, + "filename": "example/example/2.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-02-25T15:53:58.856Z"}, + "locked": false, + "name": "example", + "rego": "package example.example\n\n allow {\n 1 == 2\n }\n \n result := input\n ", + "repository": "policies", + "version": "2.0" + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc134a"}, + "filename": "example/PrincipalCredentialRequest/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "PrincipalCredentialRequest", + "rego": "package example.PrincipalCredentialRequest\n\ndefault allow = true", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc134b"}, + "filename": "example/getKeyDID/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "getKeyDID", + "rego": "package example.getKeyDID\ndid := \"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6\"\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc134c"}, + "filename": "example/selfDescription/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "selfDescription", + "rego": "package example.selfDescription\n\n_ := cache.get(input.key, input.scope, input.namespace)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc134d"}, + "filename": "example/test/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-11-21T06:28:43.150Z"}, + "locked": false, + "name": "test", + "rego": "package example.test\n\ndefault allow = false\n\nallow{\n input.message == \"hello world\"\n}\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc134e"}, + "filename": "example/verifyProof/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "verifyProof", + "rego": "package example.verifyProof\n\nvalid := proof.verify(input)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc134f"}, + "filename": "example/GetLoginProofResult/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "GetLoginProofResult", + "rego": "package example.GetLoginProofResult\n\nclaims := ocm.getLoginProofResult(input.requestId)\n\nname = getName(claims)\ngiven_name = getGivenName(claims)\nfamily_name = getFamilyName(claims)\nmiddle_name = getMiddleName(claims)\npreferred_username = getPreferredUsername(claims)\ngender = getGender(claims)\nbirthdate = getBirthdate(claims)\nemail = getEmail(claims)\nemail_verified = getEmailVerified(claims)\nsub = getSub(claims)\niss = getIss(claims)\nauth_time = getAuthTime(claims)\n\ngetName(c) = x {\n\tx = c.prcFirstName\n}\ngetGivenName(c) = x {\n\tx = c.prcFirstName\n}\ngetFamilyName(c) = x {\n\tx = c.prcLastName\n}\ngetMiddleName(c) = x {\n\tx = c.prcMiddleName\n}\ngetPreferredUsername(c) = x {\n\tx = c.prcPreferredUsername\n}\ngetGender(c) = x {\n\tx = c.prcGender\n}\ngetBirthdate(c) = x {\n\tx = c.prcBirthdate\n}\ngetEmail(c) = x {\n\tx = c.email\n}\ngetEmailVerified(c) = x {\n\tx = c.email_verified\n}\ngetSub(c) = x {\n\tx = c.subjectDID\n}\ngetIss(c) = x {\n\tx = c.issuerDID\n}\ngetAuthTime(c) = x {\n\tx = c.auth_time\n}\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1350"}, + "filename": "example/createTaskList/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "createTaskList", + "rego": "package example.createTaskList\n\nid := tasklist.create(\"exampleList\", input)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1351"}, + "filename": "example/getMultiHeaders/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "getMultiHeaders", + "rego": "package example.getMultiHeaders\n\nkey := external.http.header(\"X-Cache-Key\")\nanother := external.http.header(\"X-Another-Header\")\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1352"}, + "filename": "example/publicKeysForDIDs/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "publicKeysForDIDs", + "rego": "package example.publicKeysForDIDs\n\npublicKeys := getKeys(input)\n\ngetKeys(i) = res {\n\tdoc1 = did.resolve(data.dids[0])\n\tdoc2 = did.resolve(data.dids[1])\n\tres := array.concat([doc1.didDocument.verificationMethod[0].publicKeyMultibase], [doc2.didDocument.verificationMethod[0].publicKeyMultibase])\n}\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"dids\": [\n \"did:key:z6MkpxjNepTaD1xo49dEbbW36FguWgsiToxNdhR8YJMnFQoJ\",\n \"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6\"\n ]\n}\n", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1353"}, + "filename": "example/task/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "task", + "rego": "package example.task\n\nres = task.create(input.name, input.data)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1354"}, + "filename": "example/createTask/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "createTask", + "rego": "package example.createTask\n\nresult = task.create(input.name, input.data)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1355"}, + "filename": "example/resolve/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "resolve", + "rego": "package example.resolve\n\ndata = did.resolve(input.did)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1356"}, + "filename": "example/GetLoginProofInvitation/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "GetLoginProofInvitation", + "rego": "package example.GetLoginProofInvitation\n\n_ = ocm.getLoginProofInvitation(input.scope, data.scopes)\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"scopes\": {\n \"profile\": \"principalMemberCredential\",\n \"openid\": \"principalMemberCredential\",\n \"email\": \"principalMemberCredential\"\n }\n}", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1357"}, + "filename": "example/PresentationFreshnessState/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "PresentationFreshnessState", + "rego": "package example.PresentationFreshnessState\n\n_ = [\n {\n \"presentationId\": \"07f27a99-4ff2-4d3c-82f9-0f49cd6d8203\",\n \"ProofStateValid\": \"true\"\n },\n {\n \"presentationId\": \"07f27a99-4ff2-4d3c-82f9-0f49cd6d8200\",\n \"ProofStateValid\": \"false\"\n }\n ]", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1358"}, + "filename": "example/cacheGet/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "cacheGet", + "rego": "package example.cacheGet\n\ndefault allow = false\n\nresult := cache.get(input.key, data.namespace, data.scope)\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"namespace\": \"mynamespace\",\n \"scope\": \"scope\"\n}\n", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1359"}, + "filename": "example/createProofVP/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "createProofVP", + "rego": "package example.createProofVP\n\n_ := add_vp_proof(\"did:web:example.com\", \"transit\", \"key1\", input)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc135a"}, + "filename": "example/didResolve/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "didResolve", + "rego": "package example.didResolve\n\ndata = did.resolve(input.did)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc135b"}, + "filename": "example/returnDID/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": false, + "name": "returnDID", + "rego": "package example.returnDID\n\n_ = {\n \"@context\": [\"https://www.w3.org/ns/did/v1\", \"https://w3id.org/security/suites/jws-2020/v1\"],\n \"id\": \"did:web:vault.vereign.com:tsa:policy:policy:policies:example:returnDID:1.0:evaluation\",\n \"verificationMethod\": verification_methods(\"did:web:vault.vereign.com:tsa:policy:policy:policies:example:returnDID:1.0:evaluation\", \"transit\")\n}", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc135c"}, + "filename": "example/TrustedConnectionCredentials/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "TrustedConnectionCredentials", + "rego": "package example.TrustedConnectionCredentials\n\ndefault allow = true\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc135d"}, + "filename": "example/getHeader/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "getHeader", + "rego": "package example.getHeader\n\n# gets the value for \"x-cache-key\" header and return it in the result\n# result is empty if the \"x-cache-key\" header is not sent in the request\nkey := external.http.header(\"X-Cache-Key\")\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc135e"}, + "filename": "example/validateVacVC/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "validateVacVC", + "rego": "package example.validateVacVC\n\nimport future.keywords.in\n\ndefault trusted = false\ndefault expired = false\ndefault valid = false\n\ntrusted {\n m := input.issuer\n m in data.trustlist\n}\n\nexpired {\n exp:= time.parse_ns(\"2006-01-02T15:04:05Z07:00\",input.expirationDate)\n now:=time.now_ns()\n now>exp\n}\n\nvalid = semanticallyValid(input)\n\nsemanticallyValid(i) = res {\n now:=time.now_ns()\n vac:= data.vaccines[i.credentialSubject.vaccine.vacCode].active == true\n vacDate:=time.parse_ns(\"2006-01-02T15:04:05Z07:00\",i.credentialSubject.dateOfVaccination)\n vacStillValid:=now < (vacDate+15552000000000000)\n res := vac == vacStillValid\n}\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"trustlist\": [\n \"did:key:z6MkpxjNepTaD1xo49dEbbW36FguWgsiToxNdhR8YJMnFQoJ\",\n \"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6\",\n \"did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL\"\n ],\n \"vaccines\": {\n \"EU/1/20/1528\": {\n \"active\": true,\n \"medicinalProductName\": \"COVID-19 Vaccine Moderna\",\n \"marketingAuthorizationHolder\": \"Moderna Biotech\"\n },\n \"EU/2/18/1678\": {\n \"active\": true,\n \"medicinalProductName\": \"Pfizer–BioNTech COVID-19 vaccine\",\n \"marketingAuthorizationHolder\": \"Pfizer–BioNTech\"\n }\n }\n}\n", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc135f"}, + "filename": "example/cacheSet/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "cacheSet", + "rego": "package example.cacheSet\n\ndefault success = false\n\nsuccess = true {\n msg := cache.set(data.key, \"mynamespace\", data.scope, input)\n msg == \"success\"\n}\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"key\": \"value\",\n \"scope\": \"scope\"\n}\n", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1360"}, + "filename": "example/examplePolicy/1.1/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "examplePolicy", + "rego": "package example.examplePolicy\n\ndefault allow = false\n\nallow{\n input.message == \"new policy\"\n}", + "repository": "policies", + "version": "1.1", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1361"}, + "filename": "example/examplePolicy/1.2/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "examplePolicy", + "rego": "package example.examplePolicy\n\nimport future.keywords.in\n\ndefault trusted = false\n\ntrusted{\n issuer := input.issuer\n issuer in data.trustlist\n}", + "repository": "policies", + "version": "1.2", + "data": "{\n \"trustlist\": [\n \"did:web:123\",\n \"did:web:abc\"\n ]\n}", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1362"}, + "filename": "example/cacheGetByKey/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "cacheGetByKey", + "rego": "package example.cacheGetByKey\n\ndefault buy = false\n\ncurrentPrice := cache.get(input.key, \"\", \"\").currentPrice\nbuy {\n currentPrice < 100\n}\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1363"}, + "filename": "example/examplePolicy/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "examplePolicy", + "rego": "package example.examplePolicy\n\ndefault allow = false\n\nallow{\n input.message == \"example\"\n}\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1364"}, + "filename": "example/hackaton/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "hackaton", + "rego": "package example.hackaton\n\nimport future.keywords.in\n\ndefault trusted = false\ndefault expired = false\ndefault valid = false\n\ntrusted {\n m := input.issuer\n m in data.trustlist\n}\n\nexpired {\n exp:= time.parse_ns(\"2006-01-02T15:04:05Z07:00\",input.expirationDate)\n now:=time.now_ns()\n now>exp\n}\n\nvalid = semanticallyValid(input)\n\nsemanticallyValid(i) = res {\n now:=time.now_ns()\n vac:= data.vaccines[i.credentialSubject.vaccine.vacCode].active == true\n vacDate:=time.parse_ns(\"2006-01-02T15:04:05Z07:00\",i.credentialSubject.dateOfVaccination)\n vacStillValid:=now < (vacDate+15552000000000000)\n res := vac == vacStillValid\n}\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"trustlist\": [\n \"did:key:z6MkpxjNepTaD1xo49dEbbW36FguWgsiToxNdhR8YJMnFQoJ\",\n \"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6\",\n \"did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL\"\n ],\n \"vaccines\": {\n \"EU/1/20/1528\": {\n \"active\": true,\n \"medicinalProductName\": \"COVID-19 Vaccine Moderna\",\n \"marketingAuthorizationHolder\": \"Moderna Biotech\"\n },\n \"EU/2/18/1678\": {\n \"active\": true,\n \"medicinalProductName\": \"Pfizer–BioNTech COVID-19 vaccine\",\n \"marketingAuthorizationHolder\": \"Pfizer–BioNTech\"\n }\n }\n}\n", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1365"}, + "filename": "example/loginEmail/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "loginEmail", + "rego": "package example.loginEmail\n\nimport future.keywords.in\n\ndefault allow = false\n\nallow {\n input.email in data.trustedEmails\n}\n", + "repository": "policies", + "version": "1.0", + "data": "{\n \"trustedEmails\": [\n \"example@example.com\",\n \"test@example.com\",\n \"policy@example.com\"\n ]\n}\n", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1366"}, + "filename": "example/CredentialIssueRequest/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "CredentialIssueRequest", + "rego": "package example.CredentialIssueRequest\n\n_ = {\n \"connectionId\": \"conn-id\",\n \"credentialDefinitionId\": \"cred-def-id\",\n \"comment\": \"Created\",\n \"preview\": {\n \"@type\": \"https://didcomm.org/issue-credential/1.0/credential-preview\",\n \"attributes\": [\n {\n \"name\": \"email\",\n \"value\": \"test_fname_3\"\n },\n {\n \"name\": \"name\",\n \"value\": \"test_lname_3\"\n },\n {\n \"name\": \"number\",\n \"value\": \"test_gender_3\"\n }\n ]\n },\n \"autoAcceptCredential\": \"never\"\n }", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1367"}, + "filename": "example/GetTrustedConnectionState/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "GetTrustedConnectionState", + "rego": "package example.GetTrustedConnectionState\n\n_ = {\n \"comment\": \"Tested participant\",\n \"attributes\": [\n {\n \"attribute_name\": \"email\",\n \"value\": \"\",\n \"condition\": \"\"\n },\n {\n \"attribute_name\": \"name\",\n \"value\": \"\",\n \"condition\": \"\"\n }\n ],\n \"schemaId\": \"schema-id\",\n \"credential_def_id\": \"\",\n \"connectionId\": \"conn-id\"\n }", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1368"}, + "filename": "example/ProofRequestResponse/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "ProofRequestResponse", + "rego": "package example.ProofRequestResponse\n\ndefault allow = true", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "64099b61f0a924f6e5fc1369"}, + "filename": "example/createProofVC/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.451Z"}, + "locked": false, + "name": "createProofVC", + "rego": "package example.createProofVC\n\n_ := add_vc_proof(\"transit\", \"key1\", input)\n", + "repository": "policies", + "version": "1.0", + "data": "", + "dataConfig": "", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + }, + { + "_id": {"$oid": "6554d80e002e0a3841173ff0"}, + "filename": "example/locked/1.0/policy.rego", + "group": "example", + "lastUpdate": {"$date": "2023-03-09T08:40:01.450Z"}, + "locked": true, + "name": "locked", + "rego": "package example.locked\n\n_ = {\n \"@context\": [\"https://www.w3.org/ns/did/v1\", \"https://w3id.org/security/suites/jws-2020/v1\"],\n \"id\": \"did:web:vault.vereign.com:tsa:policy:policy:policies:example:locked:1.0:evaluation\",\n \"verificationMethod\": verification_methods(\"did:web:vault.vereign.com:tsa:policy:policy:policies:example:locked:1.0:evaluation\", \"transit\")\n}", + "repository": "policies", + "version": "1.0", + "data": "{\n \"trustedEmails\": [\n \"example@example.com\",\n \"test@example.com\",\n \"policy@example.com\"\n ]\n}", + "dataConfig": "some data for the config", + "nextDataRefreshTime": {"$date": "0001-01-03T00:00:00.000Z"} + } +] diff --git a/test_data/mongo/tasks/collections/taskListTemplates.json b/test_data/mongo/tasks/collections/taskListTemplates.json new file mode 100644 index 0000000000000000000000000000000000000000..4ea03b668f55869586784ef8c891346cb056f959 --- /dev/null +++ b/test_data/mongo/tasks/collections/taskListTemplates.json @@ -0,0 +1,75 @@ +[ + { + "_id": {"$oid": "63fa2f16b70ed89144e37111"}, + "cacheNamespace": "login", + "cacheScope": "user", + "groups": [ + { + "execution": "sequential", + "tasks": ["exampleTask", "exampleTask2"] + } + ], + "name": "sequentialTaskList" + }, + { + "_id": {"$oid": "63fa2f16b70ed89144e37112"}, + "cacheNamespace": "login", + "cacheScope": "user", + "groups": [ + { + "execution": "parallel", + "tasks": ["exampleTask", "exampleTask2"] + } + ], + "name": "parallelTaskList" + }, + { + "_id": {"$oid": "63fa2f16b70ed89144e37113"}, + "cacheNamespace": "login", + "cacheScope": "user", + "groups": [ + { + "execution": "parallel", + "tasks": ["exampleTask", "exampleTask2"] + }, + { + "execution": "sequential", + "tasks": ["exampleTask", "exampleTask2"] + } + ], + "name": "mixedTaskList" + }, + { + "_id": {"$oid": "6465d0704db48957264a74f1"}, + "groups": [ + { + "execution": "sequential", + "finalPolicy": "", + "tasks": ["getKeyDID", "didResolve"] + } + ], + "name": "testList" + }, + { + "_id": {"$oid": "6465e7e44db48957264a74f8"}, + "groups": [ + { + "execution": "sequential", + "finalPolicy": "", + "tasks": ["getKeyDID", "failingTask", "exampleTask"] + } + ], + "name": "failTestListSync" + }, + { + "_id": {"$oid": "6465e7e54db48957264a74f9"}, + "groups": [ + { + "execution": "parallel", + "finalPolicy": "", + "tasks": ["getKeyDID", "failingTask", "exampleTask"] + } + ], + "name": "failTestListAsync" + } +] \ No newline at end of file diff --git a/test_data/mongo/tasks/collections/taskTemplates.json b/test_data/mongo/tasks/collections/taskTemplates.json new file mode 100644 index 0000000000000000000000000000000000000000..51f1ef3237169d967c5dc259b70b05a805393dfe --- /dev/null +++ b/test_data/mongo/tasks/collections/taskTemplates.json @@ -0,0 +1,53 @@ +[ + { + "_id": {"$oid": "63fa2f16b70ed89144e3710e"}, + "cacheNamespace": "", + "cacheScope": "", + "finalPolicy": "", + "method": "GET", + "name": "exampleTask", + "requestPolicy": "", + "responsePolicy": "", + "url": "https://jsonplaceholder.typicode.com/todos/1" + }, + { + "_id": {"$oid": "63fa2f16b70ed89144e3710f"}, + "cacheNamespace": "", + "cacheScope": "", + "finalPolicy": "", + "method": "GET", + "name": "exampleTaskPolicy", + "requestPolicy": "example/example/1.0", + "responsePolicy": "", + "url": "" + }, + { + "_id": {"$oid": "63fa2f16b70ed89144e37110"}, + "cacheNamespace": "", + "cacheScope": "", + "finalPolicy": "", + "method": "GET", + "name": "exampleTask2", + "requestPolicy": "", + "responsePolicy": "", + "url": "https://jsonplaceholder.typicode.com/todos/1" + }, + { + "_id": {"$oid": "64649b40c16883754e8aff44"}, + "method": "GET", + "name": "didResolve", + "requestPolicy": "policies/example/didResolve/1.0" + }, + { + "_id": {"$oid": "6465d77a4db48957264a74f5"}, + "method": "GET", + "name": "getKeyDID", + "requestPolicy": "policies/example/getKeyDID/1.0" + }, + { + "_id": {"$oid": "6465e8aa4db48957264a74fb"}, + "method": "GET", + "name": "failingTask", + "requestPolicy": "exmaple" + } +]