From 6180a82059a761ae0dd9faffa37dc911b006d1f4 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 1 Nov 2018 11:03:58 +0300 Subject: log http signature exceptions --- .../src/main/java/com/juick/server/SignatureManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/SignatureManager.java b/juick-server/src/main/java/com/juick/server/SignatureManager.java index f152796c..8e93846f 100644 --- a/juick-server/src/main/java/com/juick/server/SignatureManager.java +++ b/juick-server/src/main/java/com/juick/server/SignatureManager.java @@ -62,10 +62,15 @@ public class SignatureManager { requestHeaders.add("Signature", signature.toString().substring(10)); HttpEntity request = new HttpEntity<>(Context.build(data), requestHeaders); //boolean valid = verifySignature(Signature.fromString(requestHeaders.getFirst("Signature")), - // keystoreManager.getPublicKey(), "POST", inbox.getPath(), headers); + // keystoreManager.getPublicKey(), "POST", inbox.getPath(), headers); logger.info("Sending context: {}", jsonMapper.writeValueAsString(data)); - ResponseEntity response = apClient.postForEntity(inbox, request, Void.class); - logger.info("accepted follower: {}", response.getStatusCodeValue()); + try { + ResponseEntity response = apClient.postForEntity(inbox, request, Void.class); + logger.info("accepted follower: {}", response.getStatusCodeValue()); + } catch (HttpClientErrorException e) { + logger.warn("Signature exception", e); + } + } public boolean verifySignature(String signatureString, URI actor, String method, String path, Map headers) { Optional context = getContext(actor); -- cgit v1.2.3