From 0736bfd7a02c1c3991be475fae5f70607bf3070f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 19 Jan 2017 23:11:46 +0300 Subject: juick-api: unauthorized response must be 401 --- .../ForbiddenStatusAuthenticationEntryPoint.java | 20 -------------------- .../NotAuthorizedAuthenticationEntryPoint.java | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 juick-server/src/main/java/com/juick/server/security/ForbiddenStatusAuthenticationEntryPoint.java create mode 100644 juick-server/src/main/java/com/juick/server/security/NotAuthorizedAuthenticationEntryPoint.java (limited to 'juick-server/src/main/java/com/juick/server') diff --git a/juick-server/src/main/java/com/juick/server/security/ForbiddenStatusAuthenticationEntryPoint.java b/juick-server/src/main/java/com/juick/server/security/ForbiddenStatusAuthenticationEntryPoint.java deleted file mode 100644 index 92b206dd..00000000 --- a/juick-server/src/main/java/com/juick/server/security/ForbiddenStatusAuthenticationEntryPoint.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.juick.server.security; - -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.AuthenticationEntryPoint; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * Created by vitalyster on 25.11.2016. - */ -public class ForbiddenStatusAuthenticationEntryPoint implements AuthenticationEntryPoint { - @Override - public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) - throws IOException, ServletException { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } -} diff --git a/juick-server/src/main/java/com/juick/server/security/NotAuthorizedAuthenticationEntryPoint.java b/juick-server/src/main/java/com/juick/server/security/NotAuthorizedAuthenticationEntryPoint.java new file mode 100644 index 00000000..d9dc6d61 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/security/NotAuthorizedAuthenticationEntryPoint.java @@ -0,0 +1,20 @@ +package com.juick.server.security; + +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Created by vitalyster on 25.11.2016. + */ +public class NotAuthorizedAuthenticationEntryPoint implements AuthenticationEntryPoint { + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) + throws IOException, ServletException { + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + } +} -- cgit v1.2.3