Add credentialStatus test

This uses the wellspring2022-portal app. If it ever breaks, the data was probably changed in the app.
This commit is contained in:
Andy Miller (IMS) 2023-05-22 10:30:29 +09:00
parent 74182bf2fc
commit 45734fa9d4
4 changed files with 71 additions and 1 deletions

View File

@ -59,7 +59,7 @@ public class RevocationListProbe extends Probe<Credential> {
JsonNode crdID = crd.getJson().get("id"); //TODO these != checks sb removed (trigger warning)
if(crdID != null) {
List<JsonNode> list = JsonNodeUtil.asNodeList(revocList.get("revokedCredentials"));
List<JsonNode> list = JsonNodeUtil.asNodeList(revocList.get("revokedCredential"));
if(list != null) {
for(JsonNode item : list) {
JsonNode revID = item.get("id");

View File

@ -16,6 +16,7 @@ import org.oneedtech.inspect.vc.probe.ExpirationProbe;
import org.oneedtech.inspect.vc.probe.InlineJsonSchemaProbe;
import org.oneedtech.inspect.vc.probe.IssuanceProbe;
import org.oneedtech.inspect.vc.probe.IssuerProbe;
import org.oneedtech.inspect.vc.probe.RevocationListProbe;
import org.oneedtech.inspect.vc.probe.EmbeddedProofProbe;
import org.oneedtech.inspect.vc.probe.EvidenceProbe;
import org.oneedtech.inspect.vc.probe.TypePropertyProbe;
@ -366,4 +367,16 @@ public class OB30Tests {
});
}
@Test
void testCredentialStatusRevoked() {
// the credential is valid, but credentialStatus reveals it is revoked
assertDoesNotThrow(()->{
Report report = validator.run(Samples.OB30.JSON.CREDENTIAL_STATUS_REVOKED.asFileResource());
if(verbose) PrintHelper.print(report, true);
assertInvalid(report);
assertErrorCount(report, 0);
assertFatalCount(report, 1);
assertHasProbeID(report, RevocationListProbe.ID, true);
});
}
}

View File

@ -38,6 +38,7 @@ public class Samples {
public final static Sample ENDORSEMENT_VALID = new Sample("ob30/endorsement-valid.json", false);
public final static Sample SIMPLE_JSON_ALIAS_CONTEXT = new Sample("ob30/simple-context-alias.json", true);
public final static Sample SIMPLE_JSON_VERSION_CONTEXT = new Sample("ob30/simple-context-version.json", true);
public final static Sample CREDENTIAL_STATUS_REVOKED = new Sample("ob30/credential-status-revoked.json", false);
}
public static final class PNG {
public final static Sample SIMPLE_JWT_PNG = new Sample("ob30/simple-jwt.png", true);

View File

@ -0,0 +1,56 @@
{
"@context" : [ "https://www.w3.org/2018/credentials/v1", "https://purl.imsglobal.org/spec/ob/v3p0/context.json", "https://purl.imsglobal.org/spec/ob/v3p0/extensions.json", "https://w3id.org/security/suites/ed25519-2020/v1" ],
"id" : "https://dc.1edtech.org/wellspring2022/wellspring-portal/credential/54418d3f-ec01-4652-800a-861c890a51a1",
"type" : [ "VerifiableCredential", "AchievementCredential" ],
"issuer" : {
"id" : "did:web:dc.1edtech.org:wellspring2022:wellspring-portal:org:da1e96e9-afcc-4eed-b9a2-2ddf7353214c",
"type" : "Profile",
"address" : {
"type" : "Address",
"addressCountry" : "Japan"
},
"name" : "1EdTech Testing"
},
"awardedDate" : "2023-05-22T10:21:00Z",
"issuanceDate" : "2023-05-22T01:25:28Z",
"name" : "credential-status-revoked",
"description" : "This achievement credential is used in ims-inspector OB30Tests.",
"credentialSubject" : {
"id" : "did:web:dc.1edtech.org:wellspring2022:wellspring-portal:learner:6896f98f-6b42-4c75-98ec-8befd0dc0b29",
"type" : "AchievementSubject",
"achievement" : {
"id" : "https://dc.1edtech.org/wellspring2022/wellspring-portal/achievement/45badd38-e201-4cf3-927f-be55bc7eb414",
"type" : "Achievement",
"achievementType" : "Achievement",
"criteria" : {
"narrative" : "Passes tests"
},
"description" : "Test achievement 1",
"name" : "Achievement 1"
},
"source" : {
"id" : "did:web:dc.1edtech.org:wellspring2022:wellspring-portal:org:da1e96e9-afcc-4eed-b9a2-2ddf7353214c",
"type" : "Profile",
"address" : {
"type" : "Address",
"addressCountry" : "Japan"
},
"name" : "1EdTech Testing"
}
},
"credentialStatus" : {
"id" : "https://dc.1edtech.org/wellspring2022/wellspring-portal/api/revocations/da1e96e9-afcc-4eed-b9a2-2ddf7353214c",
"type" : "1EdTechRevocationList"
},
"refreshService" : {
"id" : "https://dc.1edtech.org/wellspring2022/wellspring-portal/api/refresh/54418d3f-ec01-4652-800a-861c890a51a1",
"type" : "1EdTechCredentialRefresh"
},
"proof" : {
"type" : "Ed25519Signature2020",
"created" : "2023-05-22T01:25:28Z",
"proofPurpose" : "assertionMethod",
"verificationMethod" : "did:web:dc.1edtech.org:wellspring2022:wellspring-portal:org:da1e96e9-afcc-4eed-b9a2-2ddf7353214c#key-0",
"proofValue" : "zXx8gzfqZT6snD9ZkJfMmRDVm1qoKt5gRoSnev6rTeQ4tCLPivv4ocpDEFpKwxyXakAqa76duAhfNcqUeWfnBasp"
}
}