Added probes for issuer
This commit is contained in:
parent
d654b12919
commit
6f5fea32ed
@ -43,6 +43,7 @@ import org.oneedtech.inspect.vc.probe.CredentialSubjectProbe;
|
|||||||
import org.oneedtech.inspect.vc.probe.ExpirationProbe;
|
import org.oneedtech.inspect.vc.probe.ExpirationProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.InlineJsonSchemaProbe;
|
import org.oneedtech.inspect.vc.probe.InlineJsonSchemaProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.IssuanceProbe;
|
import org.oneedtech.inspect.vc.probe.IssuanceProbe;
|
||||||
|
import org.oneedtech.inspect.vc.probe.IssuerProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.EmbeddedProofProbe;
|
import org.oneedtech.inspect.vc.probe.EmbeddedProofProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.EvidenceProbe;
|
import org.oneedtech.inspect.vc.probe.EvidenceProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.RevocationListProbe;
|
import org.oneedtech.inspect.vc.probe.RevocationListProbe;
|
||||||
@ -208,6 +209,11 @@ public class OB30Inspector extends VCInspector implements SubInspector {
|
|||||||
accumulator.add(new EvidenceProbe().run(ob.getJson(), ctx));
|
accumulator.add(new EvidenceProbe().run(ob.getJson(), ctx));
|
||||||
if(broken(accumulator)) return abort(ctx, accumulator, probeCount);
|
if(broken(accumulator)) return abort(ctx, accumulator, probeCount);
|
||||||
|
|
||||||
|
// issuer
|
||||||
|
probeCount++;
|
||||||
|
accumulator.add(new IssuerProbe().run(ob.getJson(), ctx));
|
||||||
|
if(broken(accumulator)) return abort(ctx, accumulator, probeCount);
|
||||||
|
|
||||||
//embedded endorsements
|
//embedded endorsements
|
||||||
EndorsementInspector endorsementInspector = new EndorsementInspector.Builder().build();
|
EndorsementInspector endorsementInspector = new EndorsementInspector.Builder().build();
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import org.oneedtech.inspect.vc.probe.CredentialSubjectProbe;
|
|||||||
import org.oneedtech.inspect.vc.probe.ExpirationProbe;
|
import org.oneedtech.inspect.vc.probe.ExpirationProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.InlineJsonSchemaProbe;
|
import org.oneedtech.inspect.vc.probe.InlineJsonSchemaProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.IssuanceProbe;
|
import org.oneedtech.inspect.vc.probe.IssuanceProbe;
|
||||||
|
import org.oneedtech.inspect.vc.probe.IssuerProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.EmbeddedProofProbe;
|
import org.oneedtech.inspect.vc.probe.EmbeddedProofProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.EvidenceProbe;
|
import org.oneedtech.inspect.vc.probe.EvidenceProbe;
|
||||||
import org.oneedtech.inspect.vc.probe.TypePropertyProbe;
|
import org.oneedtech.inspect.vc.probe.TypePropertyProbe;
|
||||||
@ -265,6 +266,42 @@ public class OB30Tests {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSimpleJsonInvalidIssuerType() {
|
||||||
|
//add a dumb value to .type and remove the ob type
|
||||||
|
assertDoesNotThrow(()->{
|
||||||
|
Report report = validator.run(Samples.OB30.JSON.SIMPLE_JSON_UNKNOWN_ISSUER_TYPE.asFileResource());
|
||||||
|
if(verbose) PrintHelper.print(report, true);
|
||||||
|
assertInvalid(report);
|
||||||
|
// assertFatalCount(report, 1);
|
||||||
|
assertHasProbeID(report, IssuerProbe.ID, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSimpleJsonInvalidIssuerParentOrgType() {
|
||||||
|
//add a dumb value to .type and remove the ob type
|
||||||
|
assertDoesNotThrow(()->{
|
||||||
|
Report report = validator.run(Samples.OB30.JSON.SIMPLE_JSON_UNKNOWN_ISSUER_PARENTORG_TYPE.asFileResource());
|
||||||
|
if(verbose) PrintHelper.print(report, true);
|
||||||
|
assertInvalid(report);
|
||||||
|
// assertFatalCount(report, 1);
|
||||||
|
assertHasProbeID(report, IssuerProbe.ID, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSimpleJsonInvalidIssuerOtherIdentifierType() {
|
||||||
|
//add a dumb value to .type and remove the ob type
|
||||||
|
assertDoesNotThrow(()->{
|
||||||
|
Report report = validator.run(Samples.OB30.JSON.SIMPLE_JSON_UNKNOWN_ISSUER_OTHERIDENTIFIER_TYPE.asFileResource());
|
||||||
|
if(verbose) PrintHelper.print(report, true);
|
||||||
|
assertInvalid(report);
|
||||||
|
// assertFatalCount(report, 1);
|
||||||
|
assertHasProbeID(report, IssuerProbe.ID, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Disabled //TODO IssuanceVerifierProbe is not run because FATAL: InvalidSignature terminates
|
@Disabled //TODO IssuanceVerifierProbe is not run because FATAL: InvalidSignature terminates
|
||||||
@Test
|
@Test
|
||||||
void testSimpleJsonNotIssued() {
|
void testSimpleJsonNotIssued() {
|
||||||
|
@ -20,6 +20,9 @@ public class Samples {
|
|||||||
public final static Sample SIMPLE_JSON_UNKNOWN_CREDENTIAL_SUBJECT_ACHIEVEMENT_RESULT_DESCRIPTION_TYPE = new Sample("ob30/simple-err-credential-subject-achievement-result-description-type.json", false);
|
public final static Sample SIMPLE_JSON_UNKNOWN_CREDENTIAL_SUBJECT_ACHIEVEMENT_RESULT_DESCRIPTION_TYPE = new Sample("ob30/simple-err-credential-subject-achievement-result-description-type.json", false);
|
||||||
public final static Sample SIMPLE_JSON_UNKNOWN_CREDENTIAL_SUBJECT_PROFILE_TYPE = new Sample("ob30/simple-err-credential-subject-profile-type.json", false);
|
public final static Sample SIMPLE_JSON_UNKNOWN_CREDENTIAL_SUBJECT_PROFILE_TYPE = new Sample("ob30/simple-err-credential-subject-profile-type.json", false);
|
||||||
public final static Sample SIMPLE_JSON_UNKNOWN_EVIDENCE_TYPE = new Sample("ob30/simple-err-evidence-type.json", false);
|
public final static Sample SIMPLE_JSON_UNKNOWN_EVIDENCE_TYPE = new Sample("ob30/simple-err-evidence-type.json", false);
|
||||||
|
public final static Sample SIMPLE_JSON_UNKNOWN_ISSUER_TYPE = new Sample("ob30/simple-err-issuer-type.json", false);
|
||||||
|
public final static Sample SIMPLE_JSON_UNKNOWN_ISSUER_OTHERIDENTIFIER_TYPE = new Sample("ob30/simple-err-issuer-otheridentifier-type.json", false);
|
||||||
|
public final static Sample SIMPLE_JSON_UNKNOWN_ISSUER_PARENTORG_TYPE = new Sample("ob30/simple-err-issuer-parentorg-type.json", false);
|
||||||
public final static Sample SIMPLE_JSON_PROOF_METHOD_ERROR = new Sample("ob30/simple-err-proof-method.json", false);
|
public final static Sample SIMPLE_JSON_PROOF_METHOD_ERROR = new Sample("ob30/simple-err-proof-method.json", false);
|
||||||
public final static Sample SIMPLE_JSON_PROOF_METHOD_NO_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-no-scheme.json", false);
|
public final static Sample SIMPLE_JSON_PROOF_METHOD_NO_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-no-scheme.json", false);
|
||||||
public final static Sample SIMPLE_JSON_PROOF_METHOD_UNKNOWN_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-unknown-scheme.json", false);
|
public final static Sample SIMPLE_JSON_PROOF_METHOD_UNKNOWN_SCHEME_ERROR = new Sample("ob30/simple-err-proof-method-unknown-scheme.json", false);
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/2018/credentials/v1",
|
||||||
|
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
||||||
|
"https://w3id.org/security/suites/ed25519-2020/v1"
|
||||||
|
],
|
||||||
|
"id": "http://example.com/credentials/3527",
|
||||||
|
"type": [
|
||||||
|
"VerifiableCredential",
|
||||||
|
"OpenBadgeCredential"
|
||||||
|
],
|
||||||
|
"issuer": {
|
||||||
|
"id": "https://example.com/issuers/876543",
|
||||||
|
"type": [
|
||||||
|
"Profile"
|
||||||
|
],
|
||||||
|
"name": "Example Corp",
|
||||||
|
"otherIdentifier": [
|
||||||
|
{
|
||||||
|
"type": "IdentifierEntry",
|
||||||
|
"identifier": "12345",
|
||||||
|
"identifierType": "sourcedId"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "InvalidIdentifierEntry",
|
||||||
|
"identifier": "67890",
|
||||||
|
"identifierType": "nationalIdentityNumber"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"issuanceDate": "2010-01-01T00:00:00Z",
|
||||||
|
"name": "Teamwork Badge",
|
||||||
|
"credentialSubject": {
|
||||||
|
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
|
||||||
|
"type": [
|
||||||
|
"AchievementSubject"
|
||||||
|
],
|
||||||
|
"achievement": {
|
||||||
|
"id": "https://example.com/achievements/21st-century-skills/teamwork",
|
||||||
|
"type": [
|
||||||
|
"Achievement"
|
||||||
|
],
|
||||||
|
"criteria": {
|
||||||
|
"narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
|
||||||
|
},
|
||||||
|
"description": "This badge recognizes the development of the capacity to collaborate within a group environment.",
|
||||||
|
"name": "Teamwork"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"proof": [
|
||||||
|
{
|
||||||
|
"type": "Ed25519Signature2020",
|
||||||
|
"created": "2022-11-16T18:54:22Z",
|
||||||
|
"verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv",
|
||||||
|
"proofPurpose": "assertionMethod",
|
||||||
|
"proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/2018/credentials/v1",
|
||||||
|
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
||||||
|
"https://w3id.org/security/suites/ed25519-2020/v1"
|
||||||
|
],
|
||||||
|
"id": "http://example.com/credentials/3527",
|
||||||
|
"type": [
|
||||||
|
"VerifiableCredential",
|
||||||
|
"OpenBadgeCredential"
|
||||||
|
],
|
||||||
|
"issuer": {
|
||||||
|
"id": "https://example.com/issuers/876543",
|
||||||
|
"type": [
|
||||||
|
"Profile"
|
||||||
|
],
|
||||||
|
"name": "Example Corp",
|
||||||
|
"parentOrg": {
|
||||||
|
"id": "https://example.com/issuers/876543",
|
||||||
|
"type": [
|
||||||
|
"InvalidProfile"
|
||||||
|
],
|
||||||
|
"name": "Example Parent Corp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"issuanceDate": "2010-01-01T00:00:00Z",
|
||||||
|
"name": "Teamwork Badge",
|
||||||
|
"credentialSubject": {
|
||||||
|
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
|
||||||
|
"type": [
|
||||||
|
"AchievementSubject"
|
||||||
|
],
|
||||||
|
"achievement": {
|
||||||
|
"id": "https://example.com/achievements/21st-century-skills/teamwork",
|
||||||
|
"type": [
|
||||||
|
"Achievement"
|
||||||
|
],
|
||||||
|
"criteria": {
|
||||||
|
"narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
|
||||||
|
},
|
||||||
|
"description": "This badge recognizes the development of the capacity to collaborate within a group environment.",
|
||||||
|
"name": "Teamwork"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"proof": [
|
||||||
|
{
|
||||||
|
"type": "Ed25519Signature2020",
|
||||||
|
"created": "2022-11-16T18:54:22Z",
|
||||||
|
"verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv",
|
||||||
|
"proofPurpose": "assertionMethod",
|
||||||
|
"proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/2018/credentials/v1",
|
||||||
|
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
||||||
|
"https://w3id.org/security/suites/ed25519-2020/v1"
|
||||||
|
],
|
||||||
|
"id": "http://example.com/credentials/3527",
|
||||||
|
"type": [
|
||||||
|
"VerifiableCredential",
|
||||||
|
"OpenBadgeCredential"
|
||||||
|
],
|
||||||
|
"issuer": {
|
||||||
|
"id": "https://example.com/issuers/876543",
|
||||||
|
"type": [
|
||||||
|
"InvalidProfile"
|
||||||
|
],
|
||||||
|
"name": "Example Corp"
|
||||||
|
},
|
||||||
|
"issuanceDate": "2010-01-01T00:00:00Z",
|
||||||
|
"name": "Teamwork Badge",
|
||||||
|
"credentialSubject": {
|
||||||
|
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
|
||||||
|
"type": [
|
||||||
|
"AchievementSubject"
|
||||||
|
],
|
||||||
|
"achievement": {
|
||||||
|
"id": "https://example.com/achievements/21st-century-skills/teamwork",
|
||||||
|
"type": [
|
||||||
|
"Achievement"
|
||||||
|
],
|
||||||
|
"criteria": {
|
||||||
|
"narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
|
||||||
|
},
|
||||||
|
"description": "This badge recognizes the development of the capacity to collaborate within a group environment.",
|
||||||
|
"name": "Teamwork"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"proof": [
|
||||||
|
{
|
||||||
|
"type": "Ed25519Signature2020",
|
||||||
|
"created": "2022-11-16T18:54:22Z",
|
||||||
|
"verificationMethod": "https://example.com/issuers/876543#z6MknNHHrBzPytzu6CUBP9Lg7fg4KSBjzimc2Frh693YbMiv",
|
||||||
|
"proofPurpose": "assertionMethod",
|
||||||
|
"proofValue": "z5gJZKchSJEYPGeq6bsqiLKuxT6mXqAovPbqYX66CB7u9CSNFdV41vHtysjHFiitvoyhfPxsaZnWftrZZZW2txPQK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user