From c91099313f8d1cd88891b3412f01537008867ee5 Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Mon, 13 Nov 2023 09:21:38 -0500 Subject: [PATCH] Fixed refresh service --- .../org/oneedtech/inspect/vc/EndorsementInspector.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EndorsementInspector.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EndorsementInspector.java index ce1b10a..c0b761a 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EndorsementInspector.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/EndorsementInspector.java @@ -7,6 +7,7 @@ import static org.oneedtech.inspect.core.report.ReportUtil.onProbeException; import static org.oneedtech.inspect.util.code.Defensives.checkNotNull; import static org.oneedtech.inspect.util.json.ObjectMapperCache.Config.DEFAULT; import static org.oneedtech.inspect.vc.Credential.CREDENTIAL_KEY; +import static org.oneedtech.inspect.vc.VerifiableCredential.REFRESH_SERVICE_MIME_TYPES; import static org.oneedtech.inspect.vc.VerifiableCredential.ProofType.EXTERNAL; import java.net.URI; @@ -115,10 +116,11 @@ public class EndorsementInspector extends VCInspector implements SubInspector { if(resource.getContext().get(REFRESHED) != TRUE) { Optional newID = checkRefreshService(endorsement, ctx); if(newID.isPresent()) { - //TODO resource.type - return this.run( - new UriResource(new URI(newID.get())) - .setContext(new ResourceContext(REFRESHED, TRUE))); + // If the refresh is not successful, continue the verification process using the original EndorsementCredential. + UriResource uriResource = new UriResource(new URI(newID.get()), null, REFRESH_SERVICE_MIME_TYPES); + if (uriResource.exists()) { + return this.run(uriResource.setContext(new ResourceContext(REFRESHED, TRUE))); + } } }