From c7d94b1950e630b0fef5ea4c2cb2a6af92c8d140 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 12 Jun 2020 16:49:46 +0800
Subject: [PATCH] 20200612   代码提交

---
 src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java b/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java
index a28ffb8..7f8444c 100644
--- a/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java
+++ b/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java
@@ -6,6 +6,7 @@
 import org.springframework.security.web.AuthenticationEntryPoint;
 
 import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -18,9 +19,10 @@
 
     @Override
     public void commence(HttpServletRequest httpServletRequest, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException {
-        Result result = Result.loginFail("fail");
+        Result result = Result.loginFail("Unauthorized");
         response.setCharacterEncoding("UTF-8");
         response.setContentType("application/json; charset=utf-8");
         response.getWriter().write(new ObjectMapper().writeValueAsString(result));
+        response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
     }
 }

--
Gitblit v1.9.1