Removed duplicated code

This commit is contained in:
Xavi Aracil 2022-11-15 10:14:51 +01:00
parent 347f44e804
commit 2a6b045f0c

View File

@ -47,9 +47,7 @@ public class EmbeddedProofProbe extends Probe<Credential> {
ConfigurableDocumentLoader documentLoader = new ConfigurableDocumentLoader();
documentLoader.setEnableHttp(true);
documentLoader.setEnableHttps(true);
vc.setDocumentLoader(new CachingDocumentLoader());
vc.setDocumentLoader(documentLoader);
URI method = vc.getLdProof().getVerificationMethod();
LdProof proof = vc.getLdProof();
if (proof == null) {
@ -93,11 +91,11 @@ public class EmbeddedProofProbe extends Probe<Credential> {
}
} else if (method.getScheme().equals("http") || method.getScheme().equals("https")) {
// TODO: Can we use proof.getDocumentLoader()?
ConfigurableDocumentLoader documentLoader = new ConfigurableDocumentLoader();
documentLoader.setEnableHttp(true);
documentLoader.setEnableHttps(true);
ConfigurableDocumentLoader keyDocumentLoader = new ConfigurableDocumentLoader();
keyDocumentLoader.setEnableHttp(true);
keyDocumentLoader.setEnableHttps(true);
Document keyDocument = documentLoader.loadDocument(method, new DocumentLoaderOptions());
Document keyDocument = keyDocumentLoader.loadDocument(method, new DocumentLoaderOptions());
Optional<JsonStructure> keyStructure = keyDocument.getJsonContent();
if (keyStructure.isEmpty()) {
return error("Key document not found at " + method, ctx);