Skip to content
Snippets Groups Projects
Verified Commit d5540e73 authored by Georgi Michev's avatar Georgi Michev
Browse files

Reorganise step definitions and ssi-dev resources

Based on merge request comments move method from general definition to
signer definitions.

Add ssi-dev environment specific credential and presentation for proof.
parent 14e28259
No related branches found
No related tags found
1 merge request!39Reorganise step definitions and ssi-dev resources
Pipeline #61782 failed with stage
in 6 minutes and 40 seconds
......@@ -24,7 +24,7 @@
}
}
},
"for_proof_gaiax":{
"for_proof_happypath_gaiax":{
"issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
"namespace": "transit",
......@@ -49,7 +49,7 @@
}
}
},
"for_proof_vault":{
"for_proof_happypath_vault":{
"issuer": "did:web:vault.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
"namespace": "transit",
......@@ -74,6 +74,31 @@
}
}
},
"for_proof_happypath_ssi-dev":{
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
"namespace": "transit",
"credential": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"id": "http://example.edu/credentials/3732",
"type": ["VerifiableCredential", "UniversityDegreeCredential"],
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"issuanceDate": "2010-01-01T00:00:00Z",
"credentialSubject": {
"id": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"allow": true,
"num": 123,
"array": {
"txt1": "1",
"txt2": "2"
}
}
}
},
"for_proof_alumni": {
"issuer": "http://example.edu/credentials/3732",
"key": "key1",
......
......@@ -44,7 +44,7 @@
]
}
},
"for_proof_gaiax": {
"for_proof_happypath_gaiax": {
"issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
"namespace": "transit",
......@@ -89,7 +89,7 @@
]
}
},
"for_proof_vault": {
"for_proof_happypath_vault": {
"issuer": "did:web:vault.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
"namespace": "transit",
......@@ -134,6 +134,51 @@
]
}
},
"for_proof_happypath_ssi-dev": {
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
"namespace": "transit",
"presentation": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/jws-2020/v1"
],
"id": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": "VerifiablePresentation",
"verifiableCredential": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/jws-2020/v1",
"https://schema.org"
],
"credentialSubject": {
"allow": true,
"citizenship": "France",
"age_over": 18,
"id": "https://ssi-dev.vereign.com/tsa/policy/example/ProofRequestResponse/1.0"
},
"issuanceDate": "2022-07-21T10:24:36.203848291Z",
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": "VerifiableCredential"
},
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/jws-2020/v1",
"https://schema.org"
],
"credentialSubject": {
"allow": true,
"id": "https://vault.vereign.com/tsa/policy/example/ProofRequestResponse/1.0"
},
"issuanceDate": "2022-07-21T10:24:36.203861194Z",
"issuer": "did:web:vault.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": "VerifiableCredential"
}
]
}
},
"for_proof_alumni": {
"issuer": "https://example.edu/issuers/565049",
"key": "key1",
......
......@@ -121,22 +121,6 @@ public class RestGeneralStepDefinitions extends BaseStepDefinitions {
}
}
@Given("^I load the REST request \\{(.*)\\} with profile ENV name \\{(.*)\\}$")
public void I_load_the_REST_request_with_profile_ENV_name(String jsonName, String profileName) throws Throwable {
logger.info("Loading REST json into current request body. Json file= [{}] , profile= [{}]", jsonName, profileName);
String fullProfileName = profileName + "_" + System.getProperty("baseUrl").replace("https://", "").replace(".vereign.com/tsa", "");
String loadedProfileData = JsonUtils.getProfileFromJson("/REST/json/" + jsonName, fullProfileName);
if (!loadedProfileData.equals("null")) {
currentRequest.setBody(loadedProfileData);
logger.info("SUCCESS - profile loaded.");
} else {
throw new RAFException(String.format("Profile loading FAILED. Value is \"null\". File= [%s] , profile= [%s]",
jsonName,
profileName)
, RestGeneralStepDefinitions.class);
}
}
@Then("^the response is valid according to the \\{(.*?)\\} REST schema$")
public void the_response_is_valid_according_to_the_REST_schema(String schemaName) throws Throwable {
validateJsonSchema(getLastResponse().getBody(),
......
......@@ -4,7 +4,9 @@ import api.test.core.BaseStepDefinitions;
import api.test.rest.RestGeneralStepDefinitions;
import api.test.rest.RestSessionContainer;
import core.*;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
import exceptions.RAFException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -92,4 +94,20 @@ public class SignerStepDefinitions extends BaseStepDefinitions {
addRequest(currentRequest);
addResponse(response);
}
@Given("^I load \\{(.*)\\} request for environment \\{(.*)\\} via TSA$")
public void I_load__request_for_environment_via_TSA(String jsonName, String profileName) throws Throwable {
logger.info("Loading REST json into current request body. Json file= [{}] , profile= [{}]", jsonName, profileName);
String fullProfileName = profileName + "_" + System.getProperty("baseUrl").replace("https://", "").replace(".vereign.com/tsa", "");
String loadedProfileData = JsonUtils.getProfileFromJson("/REST/json/" + jsonName, fullProfileName);
if (!loadedProfileData.equals("null")) {
currentRequest.setBody(loadedProfileData);
logger.info("SUCCESS - profile loaded.");
} else {
throw new RAFException(String.format("Profile loading FAILED. Value is \"null\". File= [%s] , profile= [%s]",
jsonName,
profileName)
, RestGeneralStepDefinitions.class);
}
}
}
......@@ -26,7 +26,7 @@ Feature: API - TSA - Signer credential verify - v1/credential/verify POST
Given we are testing the TSA Signer Api
Scenario: TSA - verify credential proof - Positive
When I load the REST request {Credential.json} with profile ENV name {for_proof}
When I load {Credential.json} request for environment {for_proof_happypath} via TSA
And I create credential proof via TSA Signer API
Then the status code should be {200}
And the response is valid according to the {Signer_CredentialProof_schema.json} REST schema
......
......@@ -26,7 +26,7 @@ Feature: API - TSA - Signer presentation verify - v1/presentation/verify POST
Given we are testing the TSA Signer Api
Scenario: TSA - verify presentation proof - Positive
When I load the REST request {Presentation.json} with profile ENV name {for_proof}
When I load {Presentation.json} request for environment {for_proof_happypath} via TSA
When I create presentation proof via TSA Signer API
And the status code should be {200}
And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment