Fixed refresh service

This commit is contained in:
Xavi Aracil 2023-11-13 09:21:38 -05:00
parent 8ce52dec27
commit c91099313f

View File

@ -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.code.Defensives.checkNotNull;
import static org.oneedtech.inspect.util.json.ObjectMapperCache.Config.DEFAULT; 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.Credential.CREDENTIAL_KEY;
import static org.oneedtech.inspect.vc.VerifiableCredential.REFRESH_SERVICE_MIME_TYPES;
import static org.oneedtech.inspect.vc.VerifiableCredential.ProofType.EXTERNAL; import static org.oneedtech.inspect.vc.VerifiableCredential.ProofType.EXTERNAL;
import java.net.URI; import java.net.URI;
@ -115,10 +116,11 @@ public class EndorsementInspector extends VCInspector implements SubInspector {
if(resource.getContext().get(REFRESHED) != TRUE) { if(resource.getContext().get(REFRESHED) != TRUE) {
Optional<String> newID = checkRefreshService(endorsement, ctx); Optional<String> newID = checkRefreshService(endorsement, ctx);
if(newID.isPresent()) { if(newID.isPresent()) {
//TODO resource.type // If the refresh is not successful, continue the verification process using the original EndorsementCredential.
return this.run( UriResource uriResource = new UriResource(new URI(newID.get()), null, REFRESH_SERVICE_MIME_TYPES);
new UriResource(new URI(newID.get())) if (uriResource.exists()) {
.setContext(new ResourceContext(REFRESHED, TRUE))); return this.run(uriResource.setContext(new ResourceContext(REFRESHED, TRUE)));
}
} }
} }