From 0c855ec71e9a24656d4acb51ac8f1bd71dedb4fd Mon Sep 17 00:00:00 2001 From: Miles Lyon Date: Tue, 19 Jul 2022 15:51:44 -0400 Subject: [PATCH 1/3] WIP, CLR Inspector. Inline Schema probe having an issue that I need to dig deeper into. --- .../main/java/org/oneedtech/inspect/vc/Credential.java | 5 +++++ .../oneedtech/inspect/vc/probe/TypePropertyProbe.java | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java index e64ac98..e88ab1b 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/Credential.java @@ -70,6 +70,8 @@ public class Credential extends GeneratedObject { return Optional.of(Catalog.OB_30_VERIFIABLEPRESENTATION_JSON); } else if(credentialType == Credential.Type.EndorsementCredential) { return Optional.of(Catalog.OB_30_ENDORSEMENTCREDENTIAL_JSON); + } else if(credentialType == Credential.Type.ClrCredential) { + return Optional.of(Catalog.CLR_20_CLRCREDENTIAL_JSON); } return Optional.empty(); } @@ -77,6 +79,7 @@ public class Credential extends GeneratedObject { public enum Type { AchievementCredential, OpenBadgeCredential, //treated as an alias of AchievementCredential + ClrCredential, //NOT a duplicate of OB this does not use an alias and we ONLY use 'ClrCredential' as the base type EndorsementCredential, VerifiablePresentation, VerifiableCredential, //this is an underspecifier in our context @@ -89,6 +92,8 @@ public class Credential extends GeneratedObject { String value = iter.next().asText(); if(value.equals("AchievementCredential") || value.equals("OpenBadgeCredential")) { return AchievementCredential; + } else if(value.equals("ClrCredential")) { + return ClrCredential; } else if(value.equals("VerifiablePresentation")) { return VerifiablePresentation; } else if(value.equals("EndorsementCredential")) { diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java index b079ac2..078817b 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/TypePropertyProbe.java @@ -8,6 +8,7 @@ import org.oneedtech.inspect.core.probe.Probe; import org.oneedtech.inspect.core.probe.RunContext; import org.oneedtech.inspect.core.report.ReportItems; import org.oneedtech.inspect.vc.Credential; +import org.oneedtech.inspect.vc.Credential.Type; import org.oneedtech.inspect.vc.util.JsonNodeUtil; import com.fasterxml.jackson.databind.JsonNode; @@ -42,7 +43,14 @@ public class TypePropertyProbe extends Probe { return fatal( "The type property does not contain one of 'OpenBadgeCredential' or 'AchievementCredential'", ctx); - } + } + } + if(expected == Credential.Type.ClrCredential){ + if(!values.contains("ClrCredential")) { + return fatal( + "The type property does not contain the entry 'ClrCredential'", + ctx); + } } else { //TODO implement throw new IllegalStateException(); From c42ca86915a029aa284d7a77fd20106ed74202a4 Mon Sep 17 00:00:00 2001 From: Miles Lyon Date: Sun, 31 Jul 2022 14:19:29 -0700 Subject: [PATCH 2/3] WIP, but need to hash out with Markus a few things. --- .../oneedtech/inspect/vc/EmbeddedVCInspector.java | 13 +++++++++++++ .../test/java/org/oneedtech/inspect/vc/Samples.java | 1 + 2 files changed, 14 insertions(+) create mode 100644 inspector-vc/src/main/java/org/oneedtech/inspect/vc/EmbeddedVCInspector.java diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EmbeddedVCInspector.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EmbeddedVCInspector.java new file mode 100644 index 0000000..8d79ce4 --- /dev/null +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EmbeddedVCInspector.java @@ -0,0 +1,13 @@ +package org.oneedtech.inspect.vc; + +import java.util.Map; + +import org.oneedtech.inspect.core.SubInspector; +import org.oneedtech.inspect.core.report.Report; +import org.oneedtech.inspect.util.resource.Resource; + +public class EmbeddedVCInspector { + //TODO: @Miles Need to confirm with Markus, but this feels like an embedded inspector with some different rules (type, etc..) like endorsements + + +} diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java index 07481a1..6b6df50 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java @@ -29,6 +29,7 @@ public class Samples { public static final class CLR20 { public static final class JSON { public final static Sample SIMPLE_JSON = new Sample("clr20/simple.json", true); + public final static Sample SIMPLE_JWT = new Sample("clr20/simple.jwt", true); } } } From a8ffcaae37b223db08fe18941bec1bdcddfbd545 Mon Sep 17 00:00:00 2001 From: Miles Lyon Date: Tue, 2 Aug 2022 15:09:52 -0400 Subject: [PATCH 3/3] Undid POM exclusions and commented out mvn enforcer to address issues with missing runtime jars. --- inspector-vc/pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/inspector-vc/pom.xml b/inspector-vc/pom.xml index 538e795..d0c5c65 100644 --- a/inspector-vc/pom.xml +++ b/inspector-vc/pom.xml @@ -12,16 +12,6 @@ org.1edtech inspector-core - - - com.fasterxml.jackson.core - jackson-databind - - - com.networknt - json-schema-validator - - com.auth0