aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src')
-rw-r--r--juick-server/src/main/java/com/juick/server/SignatureManager.java11
1 files changed, 4 insertions, 7 deletions
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 3b8a59a7..d43efd4a 100644
--- a/juick-server/src/main/java/com/juick/server/SignatureManager.java
+++ b/juick-server/src/main/java/com/juick/server/SignatureManager.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.server.api.activity.model.Context;
import com.juick.server.api.activity.model.objects.Person;
import com.juick.service.activities.DeleteUserEvent;
+import com.juick.util.DateFormattersHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
@@ -48,7 +49,7 @@ public class SignatureManager {
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(to.getInbox());
URI inbox = uriComponentsBuilder.build().toUri();
Instant now = Instant.now();
- String requestDate = DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneId.of("UTC")).format(now);
+ String requestDate = DateFormattersHolder.getHttpDateFormatter().format(now);
Signature templateSignature = new Signature(from.getPublicKey().getId(), "rsa-sha256", null,
"(request-target)", "host", "date");
Signer signer = new Signer(keystoreManager.getPrivateKey(), templateSignature);
@@ -65,12 +66,8 @@ public class SignatureManager {
// keystoreManager.getPublicKey(), "POST", inbox.getPath(), headers);
logger.info("Sending context: {}", jsonMapper.writeValueAsString(data));
logger.info("Request date: {}", requestDate);
- try {
- ResponseEntity<Void> response = apClient.postForEntity(inbox, request, Void.class);
- logger.info("accepted follower: {}", response.getStatusCodeValue());
- } catch (HttpClientErrorException e) {
- logger.warn("Signature exception", e);
- }
+ ResponseEntity<Void> response = apClient.postForEntity(inbox, request, Void.class);
+ logger.info("accepted follower: {}", response.getStatusCodeValue());
}
public boolean verifySignature(String signatureString, URI actor, String method, String path, Map<String, String> headers) {