diff options
3 files changed, 6 insertions, 8 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 2361a65b..c39cdac9 100644 --- a/juick-server/src/main/java/com/juick/server/SignatureManager.java +++ b/juick-server/src/main/java/com/juick/server/SignatureManager.java @@ -78,7 +78,7 @@ public class SignatureManager { logger.info("person not found"); return false; } - Optional<Context> getContext(URI contextUri) { + public Optional<Context> getContext(URI contextUri) { try { return Optional.of(new RestTemplate().getForEntity(contextUri, Context.class).getBody()); } catch (HttpClientErrorException e) { diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java index 146e78f0..a21601db 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java @@ -245,7 +245,7 @@ public class Profile { @RequestHeader(name = "Signature", required = false) String signature) throws JsonProcessingException { UriComponents componentsBuilder = ServletUriComponentsBuilder.fromCurrentRequestUri().build(); Map<String, String> headers = new HashMap<>(); - headers.put("host", host); + headers.put("host", host.split(":", 2)[0]); headers.put("date", date); headers.put("digest", digest); headers.put("content-type", contentType); diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 3c59fde0..92fc0678 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -970,6 +970,8 @@ public class ServerTests { serverManager.processMessageEvent(new MessageEvent(this, messagesService.getReply(mid, newfreefdrid), Collections.emptyList())); assertThat(userService.isReplyToBL(ugnich, messagesService.getReply(mid, newfreefdrid)), is(true)); + // TODO: test event listeners correctly + Thread.sleep(2000L); assertThat(lastRead.apply(ugnich, mid), is(newfreefdrid)); privacyQueriesService.blacklistUser(ugnich, freefd); newfreefdrid = messagesService.createReply(mid, 0, freefd, "after ban", null); @@ -1691,12 +1693,8 @@ public class ServerTests { } @Test public void signingSpec() throws IOException { - Key fromKey = new Key(); - fromKey.setId("http://localhost:8080/u/freefd#main-key"); - Person from = new Person(); - from.setPublicKey(fromKey); - Person to = new Person(); - to.setInbox("http://localhost:8080/api/inbox"); + Person from = (Person) signatureManager.getContext(URI.create("http://localhost:8080/u/freefd")).get(); + Person to = (Person) signatureManager.getContext(URI.create("http://localhost:8080/u/ugnich")).get(); Follow follow = new Follow(); follow.setActor("http://localhost:8080/u/freefd"); follow.setObject("http://localhost:8080/u/ugnich"); |