diff --git a/features/evaluatePolicySync.feature b/features/evaluatePolicySync.feature deleted file mode 100644 index 8e1553e54388d07cab7f4cfefda1fa37b10a68d6..0000000000000000000000000000000000000000 --- a/features/evaluatePolicySync.feature +++ /dev/null @@ -1,17 +0,0 @@ -#As user -#I want to evaluate the policy -#So I am able to execute it in the future -# -#@rest @all -#Scenario: Execute the policy -#When I upload the policy to repository -#And set the policy to productive -#And the policy successfully uploaded to the system -#When I execute the policy -#Then I get successful response -#And response contains the result of execution of the policy -# -#Acceptance criteria: -#- HTTP endpoint to evaluate the policy -#- example policy created and commited to Git repo -#- Green test based on example commited to the system \ No newline at end of file diff --git a/features/resolveDIDSync.feature b/features/resolveDIDSync.feature deleted file mode 100644 index 26d8995e5fa2d4dcb7007a7bf59d2422937e08ac..0000000000000000000000000000000000000000 --- a/features/resolveDIDSync.feature +++ /dev/null @@ -1,17 +0,0 @@ -As policy administrator -I want to evaluate resolving DID feature -So I am able to use my DID features in the custom policies - -Scenario: DID resolution -Given DID document is published -And the policy to resolve did is uploaded to the system -When I send a request containing DID -And DID method is in the list of supported ones -Then I get successful response -And response contains DID document - -Acceptance criteria: -- published did document -- plugin for rego language to get/set values is ready to use -- example of usage of the plugin commited to the system -- green tests based on example commited to the system \ No newline at end of file diff --git a/src/main/resources/REST/json/Policy.json b/src/main/resources/REST/json/Policy.json index 269ce83c443aeb81271e2516acbbf86873bf3eb6..c364041a99798a495bc7bcd64fd3ad01a9250e1c 100644 --- a/src/main/resources/REST/json/Policy.json +++ b/src/main/resources/REST/json/Policy.json @@ -6,6 +6,6 @@ "message": "wrong value!" }, "didResolve_evaluate": { - "did":"did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6" + "did":"did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE" } } \ No newline at end of file diff --git a/src/main/resources/REST/schemas/Policy_EvaluateDID_schema.json b/src/main/resources/REST/schemas/Policy_EvaluateDID_schema.json index 92261228ee480d244536601fe322df0f6032a5c9..2e695fe995638b17a726ffc452e94e096f9f6a48 100644 --- a/src/main/resources/REST/schemas/Policy_EvaluateDID_schema.json +++ b/src/main/resources/REST/schemas/Policy_EvaluateDID_schema.json @@ -1,40 +1,80 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/object1655293265.json", + "title": "Root", "type": "object", + "required": [ + "data" + ], "properties": { - "doc": { + "data": { + "$id": "#root/data", + "title": "Data", "type": "object", + "required": [ + "@context", + "didDocument", + "didResolutionMetadata" + ], "properties": { "@context": { - "type": "string" + "$id": "#root/data/@context", + "title": "@context", + "type": "string", + "default": "", + "pattern": "^.*$" }, "didDocument": { - "type": "null" - }, - "didDocumentMetadata": { - "type": "object" - }, - "didResolutionMetadata": { + "$id": "#root/data/didDocument", + "title": "Diddocument", "type": "object", + "required": [ + "authentication", + "id", + "verificationMethod" + ], "properties": { - "contentType": { - "type": "string" + "authentication": { + "$id": "#root/data/didDocument/authentication", + "title": "Authentication", + "type": "array", + "default": [], + "items":{ + "$id": "#root/data/didDocument/authentication/items", + "title": "Items", + "type": "string", + "default": "", + "pattern": "^.*$" + } + }, + "id": { + "$id": "#root/data/didDocument/id", + "title": "Id", + "type": "string", + "default": "", + "pattern": "^.*$" + }, + "verificationMethod": { + "$id": "#root/data/didDocument/verificationMethod", + "title": "Verificationmethod", + "type": "array", + "default": [], + "items":{ + "$id": "#root/data/didDocument/verificationMethod/items", + "title": "Items", + "type": "object" + } } - }, - "required": [ - "contentType" - ] + } } - }, - "required": [ - "@context", - "didDocument", - "didDocumentMetadata", - "didResolutionMetadata" - ] + , + "didResolutionMetadata": { + "$id": "#root/data/didResolutionMetadata", + "title": "Didresolutionmetadata", + "type": "object" + } + } } - }, - "required": [ - "doc" - ] -} \ No newline at end of file + } +} diff --git a/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java b/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java index 01c239007ca161d92c4159c121f3780863b1897f..9af270fb21a9c4fd63acfc630c04bd1b96d14b15 100644 --- a/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java +++ b/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java @@ -81,13 +81,13 @@ public class PolicyStepDefinitions extends BaseStepDefinitions { MongoDatabase database = client.getDatabase("policy"); MongoCollection<Document> policies = database.getCollection("policies"); Document test = new Document("_id", new ObjectId()) - .append("filename", "didResolve_0.8.rego") - .append("name", "didResolve") + .append("filename", "resolve_1.0.rego") + .append("name", "resolve") .append("group", "example") .append("version", "1.0") .append("locked", false) - .append("rego", "package example.didResolve\n" + - "doc = did.resolve(input.did)\n" + + .append("rego", "package example.resolve\n" + + "data = did.resolve(input.did)\n" + "taskID := \"01234567\""); policies.insertOne(test); } diff --git a/src/test/resources/features/tsa/policy/{group}/{name}/{version}/evaluation/POST.feature b/src/test/resources/features/tsa/policy/{group}/{name}/{version}/evaluation/POST.feature index 5ab7c97e3d834c5c635d3588bfca3bedfea7ab91..4fb3efd66f8f4e1085c6e70aa1dd12a403376306 100644 --- a/src/test/resources/features/tsa/policy/{group}/{name}/{version}/evaluation/POST.feature +++ b/src/test/resources/features/tsa/policy/{group}/{name}/{version}/evaluation/POST.feature @@ -42,14 +42,16 @@ Feature: As user And the field {taskID} has the value {0123456} And delete policy {test1} from repository + @test Scenario: TSA - DID resolution - Positive Given I upload a DID resolver policy to repository Then I load the REST request {Policy.json} with profile {didResolve_evaluate} - And I execute the policy {/example/didResolve/1.0/evaluation} + And I execute the policy {/example/resolve/1.0/evaluation} Then the status code should be {200} And the response is valid according to the {Policy_EvaluateDID_schema.json} REST schema + And the field {data.didDocument.id} has the value {did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE} And the field {taskID} has the value {01234567} - And delete policy {didResolve} from repository + And delete policy {resolve} from repository Scenario: TSA - Evaluate policy synchronously - Negative Given I upload a policy {test6} to repository