From a34350b62784d4332243ba40ffe928afd91f67d3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 26 Apr 2019 16:40:58 +0300 Subject: Authorization checks are in spring-security for a while --- src/test/java/com/juick/server/tests/ServerTests.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/test/java/com/juick') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 32e9929e..770c7e7c 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -2043,4 +2043,13 @@ public class ServerTests { Pair replyId = messagesService.findMessageByProperty("tg_id", "hrhr").orElseThrow(); assertThat(replyId.getRight(), is(rid)); } + @Test + public void forbiddenForAnonymousEndpoints() throws Exception { + mockMvc.perform(post("/api/comment")).andExpect(status().isUnauthorized()); + mockMvc.perform(post("/api/like")).andExpect(status().isUnauthorized()); + mockMvc.perform(post("/api/subscribe")).andExpect(status().isUnauthorized()); + mockMvc.perform(post("/api/react")).andExpect(status().isUnauthorized()); + mockMvc.perform(get("/api/notifications")).andExpect(status().isUnauthorized()); + mockMvc.perform(delete("/api/notifications")).andExpect(status().isUnauthorized()); + } } -- cgit v1.2.3