From ecdaf52bac011cdd0f17c94abf1174fc722331fa Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 18 Mar 2019 22:33:48 +0300 Subject: WebFinger is HTTPS-only protocol --- src/test/java/com/juick/server/tests/ServerTests.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 7f46968f..ea99fac3 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -33,6 +33,7 @@ import com.juick.model.CommandResult; import com.juick.model.PrivateChats; import com.juick.model.TagStats; import com.juick.server.*; +import com.juick.server.api.activity.Profile; import com.juick.server.api.activity.model.Context; import com.juick.server.api.activity.model.activities.*; import com.juick.server.api.activity.model.objects.Note; @@ -198,6 +199,8 @@ public class ServerTests { private WebApp webApp; @Inject private RestTemplate apClient; + @Inject + private Profile profileController; @Value("classpath:mocks/activity/testuser.json") private Resource testuserResponse; @@ -1408,8 +1411,6 @@ public class ServerTests { .andExpect(jsonPath("$.links[0].href", is("http://localhost:8080/u/ugnich"))); mockMvc.perform(get("/.well-known/webfinger?resource=acct:durov@localhost")) .andExpect(status().isNotFound()); - Person ugnich = (Person) signatureManager.discoverPerson("ugnich@juick.com").get(); - assertThat(ugnich.getName(), is(ugnichName)); } @Test public void userProfileAndBlogShouldBeExposedAsActivityStream() throws Exception { @@ -1747,10 +1748,15 @@ public class ServerTests { @Test public void serviceSignatureAuth() throws Exception { String meUri = "/api/me"; - String testHost = "localhost:8080"; - Person ugnichPerson = (Person) signatureManager.discoverPerson("ugnich@localhost:8080").get(); Instant now = Instant.now(); String requestDate = DateFormattersHolder.getHttpDateFormatter().format(now); + mockMvc.perform(get("/api/me") + .header("Date", requestDate)) + .andExpect(status().isUnauthorized()); + String testHost = "localhost"; + Person ugnichPerson = profileController.getUser("ugnich"); + now = Instant.now(); + requestDate = DateFormattersHolder.getHttpDateFormatter().format(now); String signatureString = signatureManager.addSignature(ugnichPerson, testHost, "GET", meUri, requestDate); MvcResult me = mockMvc.perform(get("/api/me") .header("Host", testHost) -- cgit v1.2.3